trigger condition, compare device state to variable

Posted on
Fri Dec 27, 2019 8:01 am
welchgregusa offline
Posts: 101
Joined: May 29, 2013
Location: Orlando, FL

trigger condition, compare device state to variable

Hello.

Adding an Aeotec Water Sensors 6 as a device creates four devices: Water Sensor, Temperature, Tamper, and Tilt.

I have a trigger type "Z-Wave Command Received" with the event "Incoming Command Received from Device."

I would like to have the Condition compare the "Sensor Value" from the Temperature "device" to a variable, e.g., a variable holding a minimum temperature for the house. However the "device" condition seems to only allow a sensor value comparison to a literal number (the input field). I would have sworn I remember reading an announcement once that you could somehow specify a variable in the input field, e.g., something like $variableName. But for the life of me I cannot find that documented anywhere.

Is there a way to compare a device "sensor value" with a variable in a trigger condition?

Alternatively can anyone suggest Python code to pull the temperature from the device? I cannot figure that out. (I might need to re/cross-post this in another forum.)

Thanks.

Posted on
Fri Dec 27, 2019 8:58 am
FlyingDiver offline
User avatar
Posts: 7189
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: trigger condition, compare device state to variable

If that field supports variable substitution, then you would put "%%v:VariableID%% in there. I don't know if conditions support it, but it's easy to try it and see.

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Posted on
Fri Dec 27, 2019 9:50 am
welchgregusa offline
Posts: 101
Joined: May 29, 2013
Location: Orlando, FL

Re: trigger condition, compare device state to variable

Excellent—that is exactly what I was thinking. Thank you.

Unfortunately it does not appear to work, or rather I cannot make it work. (Perhaps Matt or Jay con confirm at some point.)

Will separately post for some Python help.

Thanks again!

Posted on
Fri Dec 27, 2019 12:55 pm
matt (support) offline
Site Admin
User avatar
Posts: 21411
Joined: Jan 27, 2003
Location: Texas

Re: trigger condition, compare device state to variable

It is on the request list, but currently the UI doesn't support doing a conditional comparing one device state value to a variable value. You can do it via a python script conditional though like this:

Code: Select all
varObj = indigo.variables[1234567]  # use ID of your Indigo variable (get from right-clicking on variable in UI)
devObj = indigo.devices[77889966]  # use ID of your Indigo device (get from right-clicking on device in UI)
return devObj.sensorValue < varObj.getValue(float)  # not sure if you want to use <, <=, >, or >= here.

Lastly, you might want to consider changing your Trigger type from Z-Wave Command Received to Device State Change (any). That will then trigger whenever the sensor device gets a new value and it will be more protocol agnostic such that if you ever change out the underlying device hardware for a different type (not Z-Wave) the trigger will continue to function.

Image

Posted on
Fri Dec 27, 2019 1:08 pm
welchgregusa offline
Posts: 101
Joined: May 29, 2013
Location: Orlando, FL

Re: trigger condition, compare device state to variable

Thank you Matt! Exactly what I needed. And I will take your advice on the Trigger type.

Thanks again,
--greg

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 2 guests