Jump to content
C4 Forums | Control4

Questions about Driverworks


zyroad

Recommended Posts

Hello, everyone!

I wrote a driver for a Zigbee device which have two RELAY output and has been linked to two Motorized Screens. The driver receive proxy commands from and send notifies to the motorized screens. I want the relay state to be show in the UI icon of motorized screen. I think C4:SendToProxy() should be used but I can't find details in the documents of DriverWorks. I tried some different ways and still not work.

In c4i file

----------connections definition-----------------

<connection>

<id>1</id>

<facing>6</facing>

<connectionname>Relay 1</connectionname>

<type>1</type>

<consumer>False</consumer>

<audiosource>False</audiosource>

<videosource>False</videosource>

<linelevel>False</linelevel>

<hidden>False</hidden>

<classes>

<class>

<classname>RELAY</classname>

</class>

</classes>

</connection>

<connection>

<id>2</id>

<facing>6</facing>

<connectionname>Relay 2</connectionname>

<type>1</type>

<consumer>False</consumer>

<audiosource>False</audiosource>

<videosource>False</videosource>

<linelevel>False</linelevel>

<hidden>False</hidden>

<classes>

<class>

<classname>RELAY</classname>

</class>

</classes>

</connection>

----------------------------------

I have tried to send notifies through:

C4:SendToProxy(1, "STATE_CLOSED", "")

C4:SendToProxy(1, "CLOSED", "")

C4:SendToProxy(1, "STATE_CLOSED", "NOTIFY")

C4:SendToProxy(1, "CLOSED", "NOTIFY")

C4:SendToProxy(1, "STATE_CHANGED", {STATE = 1})

......

But the icon of toggle did not changed. What's the exact usage of C4:SendToProxy?

Link to comment
Share on other sites


C4:SendToProxy(1, "CLOSED", {}, "NOTIFY")

CLOSED and OPEN do not have parameters, but they require an 'empty' parameters table before the 4th parameter, which in this case is required, and indicates that the Message Type being sent is a 'Notify', not a 'Command', as this is a control binding.

i.e. Proxy bindings default to 'notifies', control bindings default to 'commands'.

A bit confusing, but it makes it work without requiring the Message Type most of the time.

RyanE

Link to comment
Share on other sites

  • 4 years later...

Not sure if documentation has changed around this, however, this does not seem to work for me.  

I have a RELAY connection on binding 2.  This is connected to say a FAN or RADIANT FLOOR.  When in the FAN is switched on, the following is received:

          PRX_CMD.CLOSE received on Binding 2

The relay is closed on the device and the following is executed

 

 

Link to comment
Share on other sites

Not sure if documentation has changed around this, however, this does not seem to work for me.  

I have a RELAY connection on binding 2.  This is connected to say a FAN or RADIANT FLOOR.  When in the FAN is switched on, the following is received:

          PRX_CMD.CLOSE received on Binding 2

The relay is closed on the device and the following is executed

  C4:SendToProxy(2, "CLOSED", {}, "NOTIFY")

Nothing changes on the UI or the status date/time.  Similarly if C4:SendToProxy(2, "OPEN", {}, "NOTIFY") is executed.  If I invert the relay, the UI does change.

 Please assist.

 

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...