@bramschats I now have two sensors in the REST Api:
Sensor 42:
{
"config": {
"battery": 88,
"on": true,
"reachable": true,
"temperature": 2200
},
"ep": 2,
"etag": "db00e7dbfd724436dc2771a907944141",
"manufacturername": "LUMI",
"mode": 1,
"modelid": "lumi.sensor_cube",
"name": "living_room_cube",
"state": {
"buttonevent": 7007,
"gesture": 1,
"lastupdated": "2019-09-14T18:56:58"
},
"swversion": "20160407",
"type": "ZHASwitch",
"uniqueid": "00:15:8d:00:01:04:1d:e0-02-0012"
}
and
Sensor 46:
{
"config": {
"battery": 88,
"on": true,
"reachable": true,
"temperature": 2200
},
"ep": 3,
"etag": "25f7594e13ab043a86d9ae745b80ebc4",
"manufacturername": "LUMI",
"mode": 1,
"modelid": "lumi.sensor_cube",
"name": "living_room_cube",
"state": {
"buttonevent": -5641,
"gesture": 8,
"lastupdated": "2019-09-14T18:56:44"
},
"type": "ZHASwitch",
"uniqueid": "00:15:8d:00:01:04:1d:e0-03-000c"
}
With this I use these automations:
Rotate clockwise:
---
# Turn the volume up in the living room with the Xiaomi Cube
#
alias: living_room_cube_turn_volume_up
initial_state: 'on'
trigger:
platform: event
event_type: deconz_event
event_data:
id: living_room_cube
condition:
condition: template
value_template: >
{{ trigger.event.data.event | int > 0 }}
action:
- service: media_player.volume_set
data_template:
entity_id: media_player.woonkamer
volume_level: >
{% set state = states.media_player.woonkamer.attributes.volume_level + 0.05 -%}{{ state }}
and
Rotate counter clockwise:
---
# Turn the volume down in the living room with the Xiaomi Cube
#
alias: living_room_cube_turn_volume_down
initial_state: 'on'
trigger:
platform: event
event_type: deconz_event
event_data:
id: living_room_cube
condition:
condition: template
value_template: >
{{ trigger.event.data.event | int < 0 }}
action:
- service: media_player.volume_set
data_template:
entity_id: media_player.woonkamer
volume_level: >
{% set state = states.media_player.woonkamer.attributes.volume_level - 0.05 %}
{% if state <= 0 %}
{% set state = 0 %}{{ state }}
{% else %}
{{ state }}
{% endif %}