Okey.
I have an xiaomi cube controlling my volume and other things.
Here is the automation.
- alias: Spin the cube
trigger:
platform: event
event_type: deconz_event
event_data:
id: rosa_kub_1
action:
- service: media_player.volume_set
entity_id: media_player.vaggen
data_template:
volume_level: >
{% if trigger.event.data.event | float > 0 %}
{{ states.media_player.vaggen.attributes.volume_level + 0.05 }}
{% else %}
{{ states.media_player.vaggen.attributes.volume_level - 0.05 }}
{% endif %}
It is working great. The automation check if i get a positive value or a negative value (depending of right/left turn of the cube).
BUT! I also use the cube for play/pause
All other commands from the cube is positive values.
Here is a list:
These are the event ID’s available for each move you can do with the cube.
x000 for push, so 1000, 2000, 3000, 4000, 5000, 6000;
x00x for double tap, so 1001, 2002, 3003, 4004, 5005, 6006;
x00o for 180° flip (where o = 7 - x), so 1006, 2005, 3004, 4003, 5002, 6001;
x00y for 90° flip (where y ≠ x and y ≠ 7 - x), so 1002, 1003, 1004, 1005, 2001, 2003, 2004, 2006, 3001,
3002, 3005, 3006, 4001, 4002, 4005, 4006, 5001, 5003, 5004, 5006, 6002, 6003, 6004, 6005;
7007 for shake.
7000 for wakeup (the cube sends raw value 2 when I just tap it after a while).
All those commands is 00 in the middle.
Using wildcards in some conditions maybe should work? But HomeAssistant doesn’t support windcard in that way, right?
Is there any way to prevent my automation to trigger if i get any of these values from the cube?
This is some of the values i get when i rotate the cube:
2018-05-30 21:44:59 DEBUG (MainThread) [pydeconz.websocket] Websocket data: b'\x81t{"e":"changed","id":"5","r":"sensors","state":{"buttonevent":-3364,"lastupdated":"2018-05-30T19:44:59"},"t":"event"}'
2018-05-30 21:44:59 DEBUG (MainThread) [pydeconz.deconzdevice] Rosa kub 1: update lastupdated with 2018-05-30T19:44:59
2018-05-30 21:44:59 DEBUG (MainThread) [pydeconz.deconzdevice] Rosa kub 1: update buttonevent with -3364
2018-05-30 21:44:59 INFO (MainThread) [homeassistant.core] Bus:Handling <Event deconz_event[R]: id=rosa_kub_1, event=-3364>
2018-05-30 21:45:01 DEBUG (MainThread) [pydeconz.websocket] Websocket data: b'\x81t{"e":"changed","id":"5","r":"sensors","state":{"buttonevent":-2182,"lastupdated":"2018-05-30T19:45:01"},"t":"event"}'
2018-05-30 21:45:01 DEBUG (MainThread) [pydeconz.deconzdevice] Rosa kub 1: update lastupdated with 2018-05-30T19:45:01
2018-05-30 21:45:01 DEBUG (MainThread) [pydeconz.deconzdevice] Rosa kub 1: update buttonevent with -2182
2018-05-30 21:45:01 INFO (MainThread) [homeassistant.core] Bus:Handling <Event deconz_event[R]: id=rosa_kub_1, event=-2182>
2018-05-30 21:45:02 DEBUG (MainThread) [pydeconz.websocket] Websocket data: b'\x81t{"e":"changed","id":"5","r":"sensors","state":{"buttonevent":-3364,"lastupdated":"2018-05-30T19:45:02"},"t":"event"}'
2018-05-30 21:45:02 DEBUG (MainThread) [pydeconz.deconzdevice] Rosa kub 1: update lastupdated with 2018-05-30T19:45:02
2018-05-30 21:45:02 DEBUG (MainThread) [pydeconz.deconzdevice] Rosa kub 1: update buttonevent with -3364
2018-05-30 21:45:02 INFO (MainThread) [homeassistant.core] Bus:Handling <Event deconz_event[R]: id=rosa_kub_1, event=-3364>
2018-05-30 21:45:02 DEBUG (MainThread) [pydeconz.websocket] Websocket data: b'\x81t{"e":"changed","id":"5","r":"sensors","state":{"buttonevent":-2845,"lastupdated":"2018-05-30T19:45:02"},"t":"event"}'
2018-05-30 21:45:02 DEBUG (MainThread) [pydeconz.deconzdevice] Rosa kub 1: update lastupdated with 2018-05-30T19:45:02
2018-05-30 21:45:02 DEBUG (MainThread) [pydeconz.deconzdevice] Rosa kub 1: update buttonevent with -2845
2018-05-30 21:45:02 INFO (MainThread) [homeassistant.core] Bus:Handling <Event deconz_event[R]: id=rosa_kub_1, event=-2845>
2018-05-30 21:45:03 DEBUG (MainThread) [pydeconz.websocket] Websocket data: b'\x81t{"e":"changed","id":"5","r":"sensors","state":{"buttonevent":-8635,"lastupdated":"2018-05-30T19:45:03"},"t":"event"}'
2018-05-30 21:45:03 DEBUG (MainThread) [pydeconz.deconzdevice] Rosa kub 1: update lastupdated with 2018-05-30T19:45:03
2018-05-30 21:45:03 DEBUG (MainThread) [pydeconz.deconzdevice] Rosa kub 1: update buttonevent with -8635
2018-05-30 21:45:03 INFO (MainThread) [homeassistant.core] Bus:Handling <Event deconz_event[R]: id=rosa_kub_1, event=-8635>
2018-05-30 21:45:04 DEBUG (MainThread) [pydeconz.websocket] Websocket data: b'\x81s{"e":"changed","id":"5","r":"sensors","state":{"buttonevent":2510,"lastupdated":"2018-05-30T19:45:04"},"t":"event"}'
2018-05-30 21:45:04 DEBUG (MainThread) [pydeconz.deconzdevice] Rosa kub 1: update lastupdated with 2018-05-30T19:45:04
2018-05-30 21:45:04 DEBUG (MainThread) [pydeconz.deconzdevice] Rosa kub 1: update buttonevent with 2510
2018-05-30 21:45:04 INFO (MainThread) [homeassistant.core] Bus:Handling <Event deconz_event[R]: id=rosa_kub_1, event=2510>
2018-05-30 21:45:05 DEBUG (MainThread) [pydeconz.websocket] Websocket data: b'\x81s{"e":"changed","id":"5","r":"sensors","state":{"buttonevent":6831,"lastupdated":"2018-05-30T19:45:05"},"t":"event"}'
2018-05-30 21:45:05 DEBUG (MainThread) [pydeconz.deconzdevice] Rosa kub 1: update lastupdated with 2018-05-30T19:45:05
2018-05-30 21:45:05 DEBUG (MainThread) [pydeconz.deconzdevice] Rosa kub 1: update buttonevent with 6831
2018-05-30 21:45:05 INFO (MainThread) [homeassistant.core] Bus:Handling <Event deconz_event[R]: id=rosa_kub_1, event=6831>
2018-05-30 21:45:06 DEBUG (MainThread) [pydeconz.websocket] Websocket data: b'\x81s{"e":"changed","id":"5","r":"sensors","state":{"buttonevent":3104,"lastupdated":"2018-05-30T19:45:06"},"t":"event"}'
2018-05-30 21:45:06 DEBUG (MainThread) [pydeconz.deconzdevice] Rosa kub 1: update lastupdated with 2018-05-30T19:45:06
2018-05-30 21:45:06 DEBUG (MainThread) [pydeconz.deconzdevice] Rosa kub 1: update buttonevent with 3104
2018-05-30 21:45:06 INFO (MainThread) [homeassistant.core] Bus:Handling <Event deconz_event[R]: id=rosa_kub_1, event=3104>
2018-05-30 21:45:07 DEBUG (MainThread) [pydeconz.websocket] Websocket data: b'\x81s{"e":"changed","id":"5","r":"sensors","state":{"buttonevent":8275,"lastupdated":"2018-05-30T19:45:07"},"t":"event"}'
2018-05-30 21:45:07 DEBUG (MainThread) [pydeconz.deconzdevice] Rosa kub 1: update lastupdated with 2018-05-30T19:45:07
2018-05-30 21:45:07 DEBUG (MainThread) [pydeconz.deconzdevice] Rosa kub 1: update buttonevent with 8275
2018-05-30 21:45:07 INFO (MainThread) [homeassistant.core] Bus:Handling <Event deconz_event[R]: id=rosa_kub_1, event=8275>
2018-05-30 21:45:07 DEBUG (MainThread) [pydeconz.websocket] Websocket data: b'\x81s{"e":"changed","id":"5","r":"sensors","state":{"buttonevent":2931,"lastupdated":"2018-05-30T19:45:07"},"t":"event"}'
2018-05-30 21:45:07 DEBUG (MainThread) [pydeconz.deconzdevice] Rosa kub 1: update lastupdated with 2018-05-30T19:45:07
2018-05-30 21:45:07 DEBUG (MainThread) [pydeconz.deconzdevice] Rosa kub 1: update buttonevent with 2931
2018-05-30 21:45:07 INFO (MainThread) [homeassistant.core] Bus:Handling <Event deconz_event[R]: id=rosa_kub_1, event=2931>
2018-05-30 21:45:08 DEBUG (MainThread) [pydeconz.websocket] Websocket data: b'\x81s{"e":"changed","id":"5","r":"sensors","state":{"buttonevent":2286,"lastupdated":"2018-05-30T19:45:08"},"t":"event"}'
2018-05-30 21:45:08 DEBUG (MainThread) [pydeconz.deconzdevice] Rosa kub 1: update lastupdated with 2018-05-30T19:45:08
2018-05-30 21:45:08 DEBUG (MainThread) [pydeconz.deconzdevice] Rosa kub 1: update buttonevent with 2286
2018-05-30 21:45:08 INFO (MainThread) [homeassistant.core] Bus:Handling <Event deconz_event[R]: id=rosa_kub_1, event=2286>
I don’t know how many comibations there is.
Or is it possible to prevent the automation to trigger if some of my other automations trigger at the same time?
I tried to put a delay on this automation and in my other automation triggering the I play/pause use homeassistant.turn_off and turn this one off but it triggers once anyway before it get turned off.