Author Topic: Virtual Door Sensor implementation file  (Read 38 times)

Offline zang

  • Newbie
  • *
  • Posts: 11
  • Karma: +0/-0
Virtual Door Sensor implementation file
« on: November 18, 2017, 12:39:11 pm »
I'm trying to create a Virtual Door sensor on my Vera Plus so I can trigger it via HTTP from an DIY wifi sensor but I'm struggling with creating a Vera implementation file for the sensor.  I just need to be able to "Arm" it and toggle "Tripped"

The device:
device_type: urn:schemas-micasaverde-com:device:DoorSensor:1
device_file: D_DoorSensor1.xml
device_json: D_DoorSensor1.json
impl_file: I_DoorSensor.xml

My I_DoorSensor.xml implementation file looks like this:

Code: [Select]


    luup.variable_set("urn:micasaverde-com:serviceId:SecuritySensor1", "Armed", lul_settings.newArmedValue, lul_device)

    luup.variable_set("urn:micasaverde-com:serviceId:SecuritySensor1", "Tripped", lul_settings.newTrippedValue, lul_device)


I am able to Arm and Disarm the device within the GUI but when i try and trigger "tripped" via http I'm getting a message in the logs saying 501/No implementation.

My http string is:

In the logs I see:

Code: [Select]
08      11/18/17 12:26:02.308   JobHandler_LuaUPnP::HandleActionRequest device: 58 service: urn:micasaverde-com:serviceId:SecuritySensor1 action: SetTripped <0x72110520>
08      11/18/17 12:26:02.308   JobHandler_LuaUPnP::HandleActionRequest argument DeviceNum=58 <0x72110520>
08      11/18/17 12:26:02.309   JobHandler_LuaUPnP::HandleActionRequest argument serviceId=urn:micasaverde-com:serviceId:SecuritySensor1 <0x72110520>
08      11/18/17 12:26:02.309   JobHandler_LuaUPnP::HandleActionRequest argument action=SetTripped <0x72110520>
08      11/18/17 12:26:02.309   JobHandler_LuaUPnP::HandleActionRequest argument newTrippedValue=1 <0x72110520>
02      11/18/17 12:26:02.309   Device_LuaUPnP::HandleActionRequest 58 none of the 1 implementations handled it <0x72110520>
02      11/18/17 12:26:02.309   JobHandler_LuaUPnP::RunAction device 58 action urn:micasaverde-com:serviceId:SecuritySensor1/SetTripped failed with 501/No implementation <0x72110520>

When I arm and disarm the device in the GUI or using this URL:

It works fine and I see this in the logs:

Code: [Select]
50      11/18/17 12:22:53.131   luup_log:21: VeraConnectWWN::isStreaming> Streaming: true <0x7574c520>
08      11/18/17 12:22:57.149   JobHandler_LuaUPnP::HandleActionRequest device: 58 service: urn:micasaverde-com:serviceId:SecuritySensor1 action: SetArmed <0x71aec520>
08      11/18/17 12:22:57.149   JobHandler_LuaUPnP::HandleActionRequest argument DeviceNum=58 <0x71aec520>
08      11/18/17 12:22:57.150   JobHandler_LuaUPnP::HandleActionRequest argument serviceId=urn:micasaverde-com:serviceId:SecuritySensor1 <0x71aec520>
08      11/18/17 12:22:57.150   JobHandler_LuaUPnP::HandleActionRequest argument action=SetArmed <0x71aec520>
08      11/18/17 12:22:57.150   JobHandler_LuaUPnP::HandleActionRequest argument newArmedValue=0 <0x71aec520>
08      11/18/17 12:22:57.150   JobHandler_LuaUPnP::HandleActionRequest argument rand=0.843259718578375 <0x71aec520>
06      11/18/17 12:22:57.151   Device_Variable::m_szValue_set device: 58 service: urn:micasaverde-com:serviceId:SecuritySensor1 variable: Armed was: 1 now: 0 #hooks: 0 upnp: 0 skip: 0 v:0xb77bc0/NONE duplicate:0 <0x71aec520>

I don't understand why I keep getting "No implementation" when trying to "trip" the sensor.  Am I missing something obvious?


Offline rigpapa

  • Full Member
  • ***
  • Posts: 138
  • Karma: +20/-0
Re: Virtual Door Sensor implementation file
« Reply #1 on: November 18, 2017, 02:02:06 pm »
The action should be declared in the S_.xml file for the service. Since you are using urn:micasaverde-com:serviceId:SecuritySensor1, you're going to run afoul of Vera's built-in definition for this service, which doesn't include your desired action.

You should move your new action to your own service (e.g. urn:zang-org:serviceId:DoorSensor1). Make an S_DoorSensor1.xml service file for it that contains an action declaration for SetTripped in its actionList, declare your new service in your D_DoorSensor1.xml file's serviceList section, and then use your new service in your implementation (I_) file to declare the implementation of your new SetAction.
Author of Rachio, Deus Ex Machina II, SiteSensor, and Auto Virtual Thermostat plugins. Using Vera Plus (1.7.3232), Vera3 (1.7.855), 50 dimmers and 40 switches (mostly Leviton, some Linear and GE), a dozen sensors, a truckload of PLEG, and of course, my own plugins.