Parity Posted September 19, 2016 Share Posted September 19, 2016 I have created a proxy driver to control 4 relays. 5 connections: Connection 1 for RS232; Connection 2, 3, 4, 5 for Light (V2) devices. Everything is working well including scenes, etc. The only thing is the UI updating on the various IOS devices. According to Proxy and Protocol Guide 2.9.0 Lighting (V2) protocol Notifications the following should be used to notify the light on binding 2 is OFF or ON: C4:SendToProxy(2,"LIGHT_LEVEL",0,"NOTIFY") C4:SendToProxy(2,"LIGHT_LEVEL",100,"NOTIFY") Neither changes the state of the lights on the UI or in Composer. I have tried various combinations such as local tParams = {} tParams["LEVEL"] = 0 tParams["STATE"] = "off" C4:SendToProxy(2,"LIGHT_LEVEL",0,"NOTIFY") C4:SendToProxy(2,"LIGHT_LEVEL","0","NOTIFY") C4:SendToProxy(2,"LIGHT_LEVEL",tParams,"NOTIFY") C4:SendToProxy(2,"LIGHT_LEVEL", {LEVEL=0}, "NOTIFY") C4:SendToProxy(2,"LIGHT_LEVEL_CHANGED",tParams,"NOTIFY") C4:SendToProxy(2, "LIGHT_LEVEL_CHANGED", {LEVEL=0}, "NOTIFY") C4:SendToProxy(2, "LIGHT_LEVEL_CHANGED", 0 , "NOTIFY") Quote Link to comment Share on other sites More sharing options...
jackstone Posted January 15, 2017 Share Posted January 15, 2017 for Light v2 proxy, LIGHT_LEVEL must be string, and NOTIFY is not required. C4:SendToProxy(2,"LIGHT_LEVEL,"0") For Level 0 C4:SendToProxy(2,"LIGHT_LEVEL,"100") For Level 100 Parity 1 Quote Link to comment Share on other sites More sharing options...
Parity Posted February 13, 2017 Author Share Posted February 13, 2017 do you know how the RELAY works to update the UI on the devices? I have tried the following: C4:SendToProxy(2, "OPEN", {}, "NOTIFY") C4:SendToProxy(2, "CLOSE", {}, "NOTIFY") Quote Link to comment Share on other sites More sharing options...
alanchow Posted February 13, 2017 Share Posted February 13, 2017 Opened and closed Parity 1 Quote Link to comment Share on other sites More sharing options...
Parity Posted February 14, 2017 Author Share Posted February 14, 2017 Thanks Alan. You're a star! Quote Link to comment Share on other sites More sharing options...
jackstone Posted February 15, 2017 Share Posted February 15, 2017 And don't forget to send an "ONLINE_CHANGED", {STATE = "True"} to the relay binding to set the initial state. Quote Link to comment Share on other sites More sharing options...
Claudio Posted September 12, 2017 Share Posted September 12, 2017 I have a similar problem with a driver with a LIGHT proxy binding (5001) and a network connection (6001). Everything works with commands, but I cannot update the user interface with state coming from the network connection... The first "strange" thing is that the preview popup in Composer does not hilight buttons neither offers any interaction, differently from other lighting drivers (cfr screenshot). The driver comes from the SDK blind proxy template, modified to use the LIGHT proxy/class instead of BLIND; the original one, of course, works well... When monitored inside a navigator, the corresponding item does not change aspect... Essentially the driver must act as a ON/OFF light. This is the list of driver proxies... <proxies qty="1"> <proxy proxybindingid="5001" primary="True">light</proxy> </proxies> ... and connections: <connections> <connection> <id>5001</id> <facing>6</facing> <connectionname>Light</connectionname> <type>2</type> <consumer>False</consumer> <hidden>True</hidden> <audiosource>False</audiosource> <videosource>False</videosource> <linelevel>False</linelevel> <classes> <class> <classname>LIGHT</classname> </class> </classes> </connection> <connection> <id>6001</id> <facing>1</facing> <connectionname>Commands</connectionname> <type>4</type> <consumer>true</consumer> <audiosource>false</audiosource> <videosource>false</videosource> <linelevel>false</linelevel> <classes> <class> <classname>TCP</classname> <ports> <port> <number>1607</number> <auto_connect>true</auto_connect> <monitor_connection>true</monitor_connection> <keep_connection>true</keep_connection> </port> </ports> </class> </classes> </connection> </connections> Capabilities: <capabilities> <on_off>True</on_off> <set_level>False</set_level> <ramp_level>False</ramp_level> <has_single_led>False</has_single_led> <has_double_led>False</has_double_led> <can_detach_buttons>False</can_detach_buttons> <can_detach_led>False</can_detach_led> <has_press_events>False</has_press_events> <has_release_events>False</has_release_events> <single_button>False</single_button> <double_button>False</double_button> <do_push>False</do_push> <do_release>False</do_release> </capabilities> The following code is used to notify the proxy of status change: function NOTIFY.LIGHT_LEVEL(bindingID, level) LogTrace("NOTIFY.LIGHT_LEVEL(bindingID = %s, level = %s", bindingID, level) --local tParams = {} --tParams["LIGHT_LEVEL"] = level --tParams["LEVEL"] = level local sLevel = "" if(level == 0) then sLevel = "0" else sLevel = "100" end SendNotify("LIGHT_LEVEL", level, bindingID) SendNotify("LEVEL", level, bindingID) end It calls the following function: function SendNotify(notifyText, tParams, bindingID) C4:SendToProxy(bindingID, notifyText, tParams) end Can anyone help me in solving the issue? Thanks Quote Link to comment Share on other sites More sharing options...
RyanE Posted September 13, 2017 Share Posted September 13, 2017 As mentioned upthread, you have to send an ONLINE_CHANGED with value of True when you get a GET_CONNECTED_STATE message from the proxy... function ReceivedFromProxy(idBinding, strCommand, tParams) if (strCommand == "GET_CONNECTED_STATE") then C4:SendToProxy(idBinding, "ONLINE_CHANGED", "True") return end -- The rest of your ReceivedFromProxy code goes here... end It should work if you do that. RyanE Quote Link to comment Share on other sites More sharing options...
Claudio Posted September 13, 2017 Share Posted September 13, 2017 Thanks for suggestion! Something changed, now preview window in Composer reacts by hilighting ON/OFF buttons and they work, but still status does not reflect correctly: in preview window of Composer I still do not see anything in "current light level" and, for real (e.g. in touch) the toggle button still returns back to OFF state after a while. I am implementing a simple ON/OFF driver, without dimming level capability (and corresonding "set_level" capability set to false), is it correct to inform the proxy via "LIGHT_LEVEL" message, or is there another more appropriate message? In any case, is it correct to use "100" as level for light switched ON, or "1" would be correct? Thanks in advance! Claudio Quote Link to comment Share on other sites More sharing options...
RyanE Posted September 14, 2017 Share Posted September 14, 2017 0 = off, 100 = on. RyanE Quote Link to comment Share on other sites More sharing options...
Claudio Posted September 14, 2017 Share Posted September 14, 2017 Thanks for confirmation about values Still not updating GUI with level. Is it correct to use "LIGHT_LEVEL" notify to update the interface about ON/OFF state, or do I need other messages? Thanks Quote Link to comment Share on other sites More sharing options...
Gabor Posted January 2, 2022 Share Posted January 2, 2022 Hello, I am struggle with something similar than Claudio, I am trying to use an existing light driver to connect to my driver, but in composer properties I cannot make it work. I have relay connectons to my driver and if I try to use those they are working fine. On 9/13/2017 at 1:01 AM, RyanE said: function ReceivedFromProxy(idBinding, strCommand, tParams) if (strCommand == "GET_CONNECTED_STATE") then C4:SendToProxy(idBinding, "ONLINE_CHANGED", "True") return end -- The rest of your ReceivedFromProxy code goes here... end I tried to use the above code, but it didn't help, but giving me an errorr message which made me thinking was there any changes to this on os 3? Quote Link to comment Share on other sites More sharing options...
Gabor Posted January 3, 2022 Share Posted January 3, 2022 13 hours ago, Gabor said: Hello, I am struggle with something similar than Claudio, I am trying to use an existing light driver to connect to my driver, but in composer properties I cannot make it work. I have relay connectons to my driver and if I try to use those they are working fine. I tried to use the above code, but it didn't help, but giving me an errorr message which made me thinking was there any changes to this on os 3? I have managed to sort this out it's working now Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.