Hello, it is possible to do different actions rotating the cube to the left or to the right?
At the moment, the only thing I see is rotate, doesn’t matter the direction…
Thanks
Hello, it is possible to do different actions rotating the cube to the left or to the right?
At the moment, the only thing I see is rotate, doesn’t matter the direction…
Thanks
Hello.
Possible cube actions are predefined in it and communicated to the gateway.
You can find more details about the possible ones here:
https://home-assistant.io/components/binary_sensor.xiaomi/
I’ll check… Thanks
Hello, I’m still not ableto do it…
platform: event
event_type: cube_action
event_data:
entity_id: binary_sensor…
action_type: rotate
action_value: 90
Last lines is what I’m not sure how to do it
Hi,
I use it too. And you can see how much it was rotated. I use it to turn the HT volume up/down. What i have:
automation:
alias: ‘Cube rotate’
trigger:
platform: event
event_type: cube_action
event_data:
entity_id: binary_sensor.cube_xxxxxxxxxx
action_type: rotate
action:
Great… I’ll try…
Thanks
Hello again, could you help me a little bit,
My action looks like that:
action:
- service: switch.turn_on
entity_id: switch.focos_tele_comedor
I’m not sure how do it… I just want tu turn ON the light with that switch, If I turn to the right
And another if I turn to the left
Thanks in advance…
like below if rotate right increase volume, rotate left it decreases volume
- alias: "Cube rotate - Volume livingroom home"
initial_state: 'on'
trigger:
platform: event
event_type: cube_action
event_data:
entity_id: binary_sensor.cube_158d00011a0108
action_type: rotate
action:
- service: media_player.volume_set
data_template:
entity_id: media_player.living_room_home
volume_level: >
{% set state = states.media_player.living_room_home.attributes.volume_level + (trigger.event.data.action_value|float)/90 -%}
{%- if state > 1 -%}
{%- set state = 1 -%}
{%- elif state < 0 -%}
{%- set state = 0 -%}
{%- endif %}
{{ state }}
It’s hard to export the idea, just to turn on the light!! I thnik I understand the concept… but
Hard? no. The cube reports positive values when you rotate it to right, and negative when you rotate to the left. You just have to use the service_template. Look here: https://home-assistant.io/docs/scripts/service-calls/), “USE TEMPLATES TO DECIDE WHICH SERVICE TO CALL”. I guess it’s exactly what you want.
Thanks… I’ll try
Isn’t working…
Here I don’t know what I have write
{% if states.binary_sensor.cube_158d0001041c9f.state | float > 15 %}
What you want to do? Turn on the lights when you rotate to right and turn of when to the left? Or just turn on, without turn off?
I have two couples of light in the living room… then I want…
Turning Right:
If lights are OFF, turn them ON
If lights are ON, turn then OFF
Turning Left:
If lights are OFF, turn them ON
If lights are ON, turn them OFF
Right now, without templates, I can turn the cube in any direction and lights in one side turn ON or OFF, that is easy… But, I just want to be abble to do that…
Thanks
You dont have to test the condition as you can just use the “toggle” service. You may need something like:
I’ll try too… thanks
I’m not abble… It should be easy, but Im not abble to do that, with templates…
I’ll tried
service: switch.toggle
data_template:
entity_id: >
{% if states.binary_sensor.cube_158d0001041c9f.state | float > 0 %}
switch.focos_tele_comedor
{% else %}
switch.focos_another_one
{% endif %}
And nothing
Hi,
My bad… there’s error in the automation. Change the line:
{% if states.binary_sensor.cube_158d0001041c9f.state | float > 0 %}
to
{%if trigger.event.data.action_value | float > 0 %}
as the action_value is the variable which holds how much did you rotate the cube.
2017-08-22 20:46:46 ERROR (Thread-2) [homeassistant.util.yaml] while scanning for the next token
found character ‘%’ that cannot start any token
in “/home/homeassistant/.homeassistant/automation/focos_techo_comedor.yaml”, line 91, column 10
2017-08-22 20:46:46 ERROR (MainThread) [homeassistant.bootstrap] Error loading /home/homeassistant/.homeassistant/configuration.yaml: while scanning for the next token
found character ‘%’ that cannot start any token
in “/home/homeassistant/.homeassistant/automation/focos_techo_comedor.yaml”, line 91, column 10
Sorry for being so nerd… I’ll apreciate a lot if you could write me down all the sentence,
alias: Encender Focos Zona Tele Con Rotacion
trigger:
platform: event
event_type: cube_action
event_data:
entity_id: binary_sensor.cube_158d0001041c9f
action_type: rotate
action:
service: switch.turn_on
entity_id: switch.focos_tele_comedor
Thanks a lot again…
Finally! Thanks