Network Light UPnp Nightmare

I’ve tried to build three different upnp examples and get them to interface with my Vera Lite with current firmware (1.7.855). I’ve been reading for aund 6 hours and I guess that UPNP has been broken for the last 5-6 years?

The closest I have come yet is the “Network Light” example from Intel. The other two have the problem with the SCPDURL not getting populated automatically.

When the device is imported it does NOT appear in the device list in the UI7 desktop web interface. It DOES appear in the current Vera iPhone app, BUT there is NO on/off control in the app and adjusting the brightness does NOT send any upnp requests. By looking at the LuaUPnP.log log file I was able to find the device number during LuaPnp reboots. I was not able to see any errors. Surprisingly VERA knows enough about the imported device to be able to control the device through web requests!!! I would be very happy if someone could help me figure out why there is NO icon in the Vera web interface and why the iPhone app interface doesn’t have the On/Off control. I must be SOOOO close if I can control the fake light using web queries!!!

The goal here is to get a little linux board to create some I/O that vera can interface to via WiFi…I am about to go crazy with this plug and pray stuff!!!

This turns the fake network light ON:


<u:SetTargetResponse xmlns:u=“urn:schemas-upnp-org:service:SwitchPower:1”/>

Vera Log File:
08 10/23/16 18:13:28.966 JobHandler_LuaUPnP::HandleActionRequest device: 18 service: urn:upnp-org:serviceId:SwitchPower.0001 action: SetTarget <0x2e477680>
08 10/23/16 18:13:28.967 JobHandler_LuaUPnP::HandleActionRequest argument DeviceNum=18 <0x2e477680>
08 10/23/16 18:13:28.967 JobHandler_LuaUPnP::HandleActionRequest argument serviceId=urn:upnp-org:serviceId:SwitchPower.0001 <0x2e477680>
08 10/23/16 18:13:28.968 JobHandler_LuaUPnP::HandleActionRequest argument action=SetTarget <0x2e477680>
08 10/23/16 18:13:28.968 JobHandler_LuaUPnP::HandleActionRequest argument newTargetValue=1 <0x2e477680>

Here an example of dimming working:


<u:SetLoadLevelTargetResponse xmlns:u=“urn:schemas-upnp-org:service:Dimming:1”/>

Vera Log Output:
08 10/23/16 18:16:55.372 JobHandler_LuaUPnP::HandleActionRequest device: 18 service: urn:upnp-org:serviceId:Dimming.0001 action: SetLoadLevelTarget <0x2e077680>
08 10/23/16 18:16:55.373 JobHandler_LuaUPnP::HandleActionRequest argument DeviceNum=18 <0x2e077680>
08 10/23/16 18:16:55.373 JobHandler_LuaUPnP::HandleActionRequest argument serviceId=urn:upnp-org:serviceId:Dimming.0001 <0x2e077680>
08 10/23/16 18:16:55.374 JobHandler_LuaUPnP::HandleActionRequest argument action=SetLoadLevelTarget <0x2e077680>
08 10/23/16 18:16:55.374 JobHandler_LuaUPnP::HandleActionRequest argument NewLoadLevelTarget=100 <0x2e077680>

Here are LuaPNP.log entries having to do with the fake Network Light:

02 10/23/16 18:22:37.688 Device_Basic::m_eConfigured_set device 18 was 0 now 0 startup <0x2b9b6310> 09 10/23/16 18:22:39.881 JobHandler_LuaUPnP::Run device 18 Network Light (HP) room 0 type urn:schemas-upnp-org:device:DimmableLight:1 cat 2:0 id parent 0/0xed90d8 upnp: 1 plugin:0 pnp:0 mac:24:BE:05:E2:59:25 ip: <0x2b9b6310>

Here is the file: D_FUP_uuid acde4a2a-4e64-4592-be68-c39691630e56.xml

<root xmlns="urn:schemas-upnp-org:device-1-0"> <specVersion> <major>1</major> <minor>0</minor> </specVersion> <device> <deviceType>urn:schemas-upnp-org:device:DimmableLight:1</deviceType> <presentationURL>/</presentationURL> <friendlyName>Network Light (HP)</friendlyName> <manufacturer>OpenSource</manufacturer> <manufacturerURL></manufacturerURL> <modelDescription>Software Emulated Light Bulb</modelDescription> <modelName>Network Light Bulb</modelName> <modelNumber>XPC-L1</modelNumber> <modelURL></modelURL> <UDN>uuid:acde4a2a-4e64-4592-be68-c39691630e56</UDN> <iconList> <icon> <mimetype>image/png</mimetype> <width>32</width> <height>32</height> <depth>32</depth> <url>/icon.png</url> </icon> <icon> <mimetype>image/jpg</mimetype> <width>32</width> <height>32</height> <depth>32</depth> <url>/icon.jpg</url> </icon> </iconList> <serviceList> <service> <serviceType>urn:schemas-upnp-org:service:Dimming:1</serviceType> <serviceId>urn:upnp-org:serviceId:Dimming.0001</serviceId> <SCPDURL>_urn-upnp-org-serviceId-Dimming.0001_scpd.xml</SCPDURL> <controlURL>_urn-upnp-org-serviceId-Dimming.0001_control</controlURL> <eventSubURL>_urn-upnp-org-serviceId-Dimming.0001_event</eventSubURL> </service> <service> <serviceType>urn:schemas-upnp-org:service:SwitchPower:1</serviceType> <serviceId>urn:upnp-org:serviceId:SwitchPower.0001</serviceId> <SCPDURL>_urn-upnp-org-serviceId-SwitchPower.0001_scpd.xml</SCPDURL> <controlURL>_urn-upnp-org-serviceId-SwitchPower.0001_control</controlURL> <eventSubURL>_urn-upnp-org-serviceId-SwitchPower.0001_event</eventSubURL> </service> </serviceList> </device> </root>

Here is _urn-upnp-org-serviceId-Dimming.0001_scpd.xml

1 0 GetLoadLevelStatus RetLoadLevelStatus out LoadLevelStatus GetLoadLevelTarget NewLoadLevelTarget out LoadLevelTarget GetMinLevel MinLevel out MinLevel SetLoadLevelTarget NewLoadLevelTarget in LoadLevelTarget LoadLevelStatus ui1 0 100 MinLevel ui1 LoadLevelTarget ui1 0 100

Here is the file _urn-upnp-org-serviceId-SwitchPower.0001_scpd.xml

<scpd xmlns="urn:schemas-upnp-org:service-1-0"> <specVersion> <major>1</major> <minor>0</minor> </specVersion> <actionList> <action> <name>GetStatus</name> <argumentList> <argument> <name>ResultStatus</name> <direction>out</direction> <relatedStateVariable>Status</relatedStateVariable> </argument> </argumentList> </action> <action> <name>GetTarget</name> <argumentList> <argument> <name>newTargetValue</name> <direction>out</direction> <relatedStateVariable>Target</relatedStateVariable> </argument> </argumentList> </action> <action> <name>SetTarget</name> <argumentList> <argument> <name>newTargetValue</name> <direction>in</direction> <relatedStateVariable>Target</relatedStateVariable> </argument> </argumentList> </action> </actionList> <serviceStateTable> <stateVariable sendEvents="yes"> <name>Status</name> <dataType>boolean</dataType> </stateVariable> <stateVariable sendEvents="no"> <name>Target</name> <dataType>boolean</dataType> </stateVariable> </serviceStateTable> </scpd>

I modified a version of D_DimmableLight1.json and called it D_DimmableNetworkLight1.json. After this file was added the light appears in the desktop interface with a dimming and on/off control.

The desktop interface is now sending dimming commands successfully.

The desktop interface is adding an argument “rand” ONLY to the on/off switch control and I can’t figure out how to stop that. I could just ignore it, but I’d like to know where it is controlled so that we can get rid of it!!!

In the JSON file I miscased NewLoadlevelTarget and so far my iPhone hasn’t picked up the new version with the correct case, but at least the desktop interface is correctly dimming the light bulb. For some reason it is not picking up on the new JSON file…

I guess the next step is figuring out how to add the UPNP proxy to it since the vera doesn’t support upnp change notifications??? Right now vera is not polling the status of the light and the bulb icon is stuck on default.

Vera started with UPnP as the objective … but it never worked … and they now use HTTP with t’s own protocols to access Vera and the devices that Vera manages.

It’s UPnP history is still visible in how the Plugins Devices are defined … But Vera is NOT a working UPnP gateway.

Since they use and HTTP Get protocol … they add the RAND argument to prevent accessing an HTTP cache instead of the current state of the device.