Help with device attribute in message

I´m stuck with a problem about notficiation.
I try to get the amount of rain that have fall by the end of the day. I have create an local variable (called "Regn"), but everything that I try to write in the message between % % come out in "null" or empty.
Here is a Picture of my rule:

The device is: "Champinjonv 6 Regn". The device attribut is: "rainSumDay" and the local variable is: "Regn".
I hope someone can help me.
Thanks, Ingela

The built-in %value% variable refers to the device that triggered your rule (which in your example would be the hub/"location" itself, not your rain measurement device...or possibly nothing at all and just the last value from when there was a "real" device if you ever had one during testing; I can't remember, but it's not what you want, in any case). Does your device have an attribute that reports the value you're looking for? If so, you could create a local variable, assign the value of that variable to this attribute, then use that variable in your notification string instead. (You do need a variable since you can't just directly access the attribute when building the notification string, as you may have noticed.)

Thanks for trying to help me!
I have create a local variable:
local variable
I have try to type %Rain% (the name on the local variable) in my notification, but that didn't helped. I think I have set the variable to the device attribute (sumRainDay).
But I think I doing something wrong:)

You want to do this instead:

Notify Ingelas iPhone, Ingelas iPad: 'Idag har det regnat %Regn% mm.'

I have tried, it come out "null" in the message. It's so frustrating...!

Show the device page for this device, the upper right side where it shows the current state.


OK, %Regn%, not %Rain%, right? Just hit Run Actions on that rule, and see if Regn is updated to 3.0. Turn on Actions logging for the rule.

The "Regn" is updated with 3.4 and here is the how the logg is:

Did you get the notification? With 3.4 as value?

No, the message says "null".

Please add this Action to the rule, and then run again with Run Actions. Please post a screenshot of the logs and a screenshot of the modified rule. This is under Send Messages, Log, etc.

Log 'Regn=%Regn%'

I have made the changes that you wrote and Run Actions. Message says "null".
Here are the screenshots:

It looks like maybe there's an extra space at the end of your variable name "Regn" as you defined it?(Just trying to figure out the odd spacing in your first action.) Check that and see if it helps.

Thanks! I made the rule all over again, so I would be shure that it is not an extra space somewhere and now everythting works!
Thank you all for the help!


1 Like