Changing custom attribute from char to number?

Hi Guys,

I want to execute an action when an internal parameter in a motion sensor is displayed and has the a value exceeding 500 in the event log. But, (as far as I can see) the internal parameter is interpreted as a character why (I guess) the options I get in rule machine using a custom attribute for compairing the value of the internal parameter does not include '>' or '<'. Is there a way to alter the value of the parameter found in the log from a char to a number so that I will get '>' in the list of the available comparison options for the custom attribute?

I have an Aqara motion sensor on my washing machine. I want to do a rule that tells Alexa to tell me when the washing is done. I have found examples on how to do this but none of them have worked, so I wanted to use another approach.
There is an internal parameter on the motion sensor called activity level. The activity level is shown in the event log and is proportional to the degree of motion. When my washing machine centrefuges the value of the activity level parameter goes above 500. So I thought I'd do the following

If the motion sensor is inactive then
Exit
Else wait for condition activity level > 500 (with a time out)
Wait for 10 min and send a message to Alexa stating that the washing has finished
End if

Easy peasy. Or so I thought. All ideas welcome.

Cheers,

1 Like

What driver are you using for the motion sensor? Can you post a screenshot from the Events page for the device that shows the "activity" value you are wanting to use?

image

Hi @FriedCheese2006 ,

I am using the 'Xiaomi Aqara vibration sensor' driver.


EDIT: This is what it looks like when I want to find out if the activity level is above 500 in rule machine.

1 Like

Go to the driver's code section. Find that driver. There's probably a line like:

attribute "activityLevel", "String"

change that line to:

attribute "activityLevel", "Number"

Save the driver. Rule Machine should work like you intend.

3 Likes

Thanks Fred, that solved the issue. :slight_smile: :+1:

2 Likes