Use custom variables %value% in notification

normally you will use %value% in notification.

notification: alert -> co2 : %value%

if it does not show properly.
*note it is pulled from the trigger variable.

you can create and set local variables ->

action -> set local variable
set it to a custom attribute on the device

then refer to local variables in the notification

notification: 'alert -> co2 : %v_alertLevel% -> %v_level%'

example actions:

example local vars:

make action to set local var:

tags: blank wrong empty null

1 Like

What are you trying to say? %value% will be the trigger value for the trigger event. So, in this case "good" would the %value%. The only way you can have an event with no value is if the driver creates an event with no value which is really not something that a driver should be doing. It's part of the whole event system that every event have, at minimum, a name and a value. What driver are you using to generate the data? It seems to not be following any of the Hubitat standard capabilities. Do you have the capabilities reference for you use when writing a driver?

from my testing %value% is set by the last variable set (also)

the problem was actuality the driver did not sync with RM until I did a reboot

The driver doesn't sync with Rule Machine. Rule Machine queries for the necessary device attributes when the rule is triggered. And the variable %value% is definitely set to the trigger value of the event.

Can one do numeric comparisons with string variables anyway? Within the rule machine that is?

No, you cannot. If the variable is defined as a string type and you try to do a > or < comparison it will error out.

A fix for this bug is in the upcoming hot fix release.

1 Like

I really appreciate this is a weird edge-case, I hit this in develop of a driver, RM has a time seeing newly coded attributes, on a existing devices.

it shows up in the rule,but it can't evaluate the new attribute until -> reboot or remove/add the device.

big thanks to @bravenel for getting a fix in.
I changed to root-post to better reflect the idea is not a bug.

If you modify attributes on a device within a rule, RM won't know about those changes since they are loaded when the rule fires. So, at the beginning of rule execution. It assumes that since you are setting the attribute within the rule, you would have no need to query it's value, since you just set it. I don't understand why you need to set the attribute to anything. Why no use a local or global variable instead of a device attribute?

Download the Hubitat app