Possible to create zwave trigger from plugin?

Posted on
Tue Oct 29, 2013 5:07 pm
autolog offline
Posts: 3991
Joined: Sep 10, 2013
Location: West Sussex, UK [GMT aka UTC]

Possible to create zwave trigger from plugin?

My plugin requires that it receives a trigger when a zwave command reporting a thermostat's temperature is received.

I can set this up manually but after having looked at the Trigger documentation I was wondering if it is possible to dynamically create a new trigger for this at run time in the Plugin as a device is created :?:

The trigger details are:
Trigger = Z-Wave Event, Z-wave Command, Thermostat, Temperature Update
Condition = Always
Actions = Plugin Action, Plugin Device

I have looked in the database at the trigger created via the UI, which shows as:
Code: Select all
      <Trigger type="dict">
         <ActionGroup type="dict">
            <ActionSteps type="vector">
               <Action type="dict">
                  <Class type="integer">999</Class>
                  <DeviceID type="integer">503785618</DeviceID>
                  <ObjVers type="integer">12</ObjVers>
                  <PluginID type="string">com.perceptiveautomation.indigoplugin.stellaZcontroller</PluginID>
                  <TypeIdPlugin type="string">zwave</TypeIdPlugin>
                  <TypeLabelPlugin type="string">Process Z-Wave Command</TypeLabelPlugin>
               </Action>
            </ActionSteps>
            <ObjVers type="integer">2</ObjVers>
         </ActionGroup>
         <Class type="integer">598</Class>
         <Condition type="dict">
            <ObjVers type="integer">5</ObjVers>
            <Type type="integer">0</Type>
         </Condition>
         <Enabled type="bool">false</Enabled>
         <FolderID type="integer">611445155</FolderID>
         <ID type="integer">38026735</ID>
         <MetaProps type="dict">
            <com.perceptiveautomation.indigoplugin.zwave type="dict">
               <commandReceived type="string">17</commandReceived>
               <description type="string">z-wave &quot;T10_Thermostat&quot; temperature update received</description>
               <targetDev type="string">525749084</targetDev>
            </com.perceptiveautomation.indigoplugin.zwave>
         </MetaProps>
         <Name type="string">Stella-Z10 Zwave</Name>
         <ObjVers type="integer">7</ObjVers>
         <PluginID type="string">com.perceptiveautomation.indigoplugin.zwave</PluginID>
         <PluginUiName type="string">Z-Wave</PluginUiName>
         <TypeIdPlugin type="string">zwaveCommand</TypeIdPlugin>
         <TypeLabelPlugin type="string">Z-Wave Command</TypeLabelPlugin>
         <UploadToInterface type="bool">true</UploadToInterface>
      </Trigger>


Thanks for any help :)

Posted on
Tue Oct 29, 2013 5:27 pm
jay (support) offline
Site Admin
User avatar
Posts: 18221
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Possible to create zwave trigger from plugin?

Unfortunately, not yet. We haven't finished the IOM for Triggers and Schedules and more specifically haven't yet implemented Action support. It's on the list but demand has been fairly low.

However, I think a better approach for your use is to subscribe to device changes. You will then get device update messages any time a device has any change. You can then check to see if the device is a thermostat and then further check to see what exactly changed and perform whatever functionality you need.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Wed Oct 30, 2013 8:28 am
autolog offline
Posts: 3991
Joined: Sep 10, 2013
Location: West Sussex, UK [GMT aka UTC]

Re: Possible to create zwave trigger from plugin?

jay (support) wrote:
... However, I think a better approach for your use is to subscribe to device changes. You will then get device update messages any time a device has any change. You can then check to see if the device is a thermostat and then further check to see what exactly changed and perform whatever functionality you need.

Thanks for the suggestion which seems a lot easier than what I was asking for :)

I have tried it out but notice that I am getting two messages for every temperature update event e.g.:
Code: Select all
  Z-Wave                          sent "T01_Thermostat" temperature status request
  Z-Wave                          received "T01_Thermostat" temperature update to 18.0 °C
  Autolog Device                  AUTOLOG PLUGIN: Device Updated = T01_Thermostat
  Autolog Device                  AUTOLOG PLUGIN: Device Updated = T01_Thermostat


i was doing a bit more reading in the forum and see that there is a indigo.insteon.subscribeToIncoming() method.
I tried indigo.zwave.subscribeToIncoming() but got an error.
Ideally, I am looking to only handle one event instead of two.

Am I doing something wrong or is this function not (yet?) available for zwave?

Posted on
Wed Oct 30, 2013 8:33 am
matt (support) offline
Site Admin
User avatar
Posts: 21417
Joined: Jan 27, 2003
Location: Texas

Re: Possible to create zwave trigger from plugin?

There is not yet a way to subscribe to raw Z-Wave messages.

How about filtering the messages to avoid the duplicates? If you are only interested in temperature changes, then you could save off the last value sent and compare that to the incoming in a conditional such that your logic is only executed if there is a real change.

Image

Posted on
Wed Oct 30, 2013 8:48 am
autolog offline
Posts: 3991
Joined: Sep 10, 2013
Location: West Sussex, UK [GMT aka UTC]

Re: Possible to create zwave trigger from plugin?

matt (support) wrote:
There is not yet a way to subscribe to raw Z-Wave messages.

How about filtering the messages to avoid the duplicates? If you are only interested in temperature changes, then you could save off the last value sent and compare that to the incoming in a conditional such that your logic is only executed if there is a real change.

OK, I'll do as you suggest - Thanks for the quick reply :)

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 6 guests