Following this thread I´m trying to use some of these values in a rule to write to a tile (using @Mariano_Colmenarejo ‘s Number Field from his Virtual Devices) to compare with my home AirQ sensor values. Triggering from changes in location UltraFineDust value I can write without problem from my PM2.5 dust sensor but can’t find the syntax to write the location value. Unable to see how to use `LocationAttribute’ string you mention here - don´t know if there are any examples or documentation anywhere.
Trying as an alternative on a text field the rule is accepted but, logically being numeric fails - on the API browser Execute button it shows failure but I do see the values, so they are being retrieved. Any ideas on this one? Thanks
The code I’m trying, but the API browser returns “operand not valid for operation” is
Curious, but it seems to choke on the number field device. When I tried to set the number field using the location/UltraFineDust I couldn’t publish it, but when I changed the device to the virtual text field device I was able to publish it.
Exactly, but it doesn’t write the value to the field.
I have tried it with the UltraFineDustIndex which is an integer and the result is the same. When (for the purpose of testing) I changed the trigger, published and clicked the Execute button in the API browser I get
Yes I’m sure you’re right. I tried using the location / weather attribute and that writes and updates “Clear”, “Cloudy” etc perfectly in the text field.
The question is why location numeric values are not understood. Would like to understand how LocationAttribute that @orangebucket refers to is used
Thanks for your help.
All my encounters with arguments have been based on trial and error and hoping for the best. I never know when I need a type key and whether it should be a JSON type or the type used in the capability. And that’s just with simple arguments. When it comes to including things like device or location attributes I really don’t know what works and what doesn’t. Presumably it depends on what the developers chose to allow, which is anybody’s guess.
But I’m new to rules, so if more experienced users don’t know, I for sure have no idea on syntax for arguments, and the worst is I cannot see any documentation on this. Which is frustrating for anyone, not just me, trying to be a bit creative with rules.
Been having a good look at this and trying using LocationAttribute but I can’t find the way to write to a numerical field, so I’ll tag @nayelyz and @AlejandroPadilla to see if someone can find a moment to look at it and we can get some help.
No hurry, but thanks in advance!
I’m checking the arguments with the team, also I was checking the rule on this post and I’m no sure about somethings, as far as I saw you are trying to sent a value on the attribute numberFieldOne but I’m no sure about the next.
In my case example Cannot post rules with location capabilities - #20 by Johnnybegoode I am using changes in the value of the location attribute “UltraFineDust” to trigger writing the value of my sensor attribute"fineDustLevel" to numeric field 1, and to write the location attribute “UltraFineDust” to numeric field 2. It triggers perfectly as (if I eliminate the location command to enable me to post the rule) the sensor value continually updates on the numeric field.
The attributes available for location are from the API Reference, found by another contributor earlier in the thread.
“UltraFineDustIndex” is one of these, but to avoid the team having to ask you so many questions we can try with any of these numeric location values, e.g temperature.
To make my question more straightforward, what is the arguments syntax to write any one of these values?
With any sensor device, the syntax is -
How do we write in the case of a location attribute? I´ve tried this but it doesn´t work -
Have you any feedback from the team on this? I appreciate this is not a priority issue but it would be good to move forward with the Rules API, both regarding syntax on arguments and also location capabilites.