I use it to change radio volume with the cube actions, but i really don’t know how to change it to increment the volume value when rotating to the right and lower the volume when rotating to the left.
Can somebody help me ?
I think you are going to have to track the binary_sesnor.cube_158d00010df2f4_2.attributes.action_value as a template then compare the previous value to the new value:
This is assuming alot. First i’m assuming that you actually have an attribute ‘action_value’ in the object itself (and not just in the event). Second it assumes that you are only using that action.
Ok, i’ll add that sensor, but then how to change the automation also for the service “input_number.decrement” so to have the input_number value of the volume will decrease or increase depending from the rotation?
Ouch, ok, this might get difficult then. That sensor doesn’t store the event data. so you’ll probably need to make an automation based on the event and store the information in an MQTT sensor so that you can reference the last event data.
Pretty much you need to know where it was last in order to determine the rotation direction. At least that’s my assumption. Then you could do math to find out if the rotation direction is negative or positive.
I mean you could also do it with a python script. I guess a question I should have asked: Is the rotation in the event based on the previous value or does it just give a position it’s moving to?
Yeah, i get that, but I"m talking about this value:
trigger.event.data.action_value
in the event data. Does that value have a numerical value that is related to a position 0 to 360 or is it related to the last rotation position?
Example: We are at position 52 (But the user doesn’t know this). The rotation moved 40 degrees clockwise. FYI clockwise in math is typically a negative rotation.
I mean, that would be seen in your event data with your original automation that you were using. I have no idea how the device works so i’m taking stabs in the dark here.