You can do this by creating a trigger (in addition to the notification trigger you already have):
Type: Variable Changed
Variable: [SELECT THE VARIABLE THAT IS THE SOURCE TEMP]
Select the "changes" radio button (so that it fires every time the variable changes)
For the action, use the following script:
- Code: Select all
notification_trigger = indigo.triggers[NOTIFICATIONTRIGGERID] # "Your current notification trigger ID here"
temp_source_variable = indigo.variables[VARTEMPSOURCEID] # "The variable ID that is the source temp here"
# Get the target temperature as an integer
target_temp = temp_source_variable.getValue(int)
# Do this test as anything other than a number will result in a value of 0
if target_temp > 0:
# Set the state value (must be a string so we cast it to a string)
notification_trigger.stateValue = str(target_temp)
# Save the change to the trigger
notification_trigger.replaceOnServer()
else:
# Write an error to the Event Log to help debug any issues.
indigo.server.log("Source temp variable doesn't contain a valid number greater than 0", isError=True, type="Temp Notification Sync")
Basically, whenever the variable value changes, the above trigger fires and updates the notification trigger with the value from the variable.