Deconz Xiaomi Button - Automations aren't working

Hi

I have gotten automations working well with the Deconz sensors added via the Phoscon. Now I am trying to get automations based on sensors from the REST API working. Not sure if this is a bug or an issue with my configuration.

My trigger is:
image

(I have also tried with the variation of the id lumi.sensor_switch and the event 1000)
I have no condition and have tested the action is working.

With debugging on Home Assistant I am registering events for example:

2018-04-13 23:55:34 INFO (MainThread) [homeassistant.core] Bus:Handling <Event deconz_event[R]: id=lumisensor_switch, event=1000>
2018-04-13 23:55:36 DEBUG (MainThread) [pydeconz.websocket] Websocket data: b'\x81t{"e":"changed","id":"10","r":"sensors","state":{"buttonevent":1002,"lastupdated":"2018-04-13T13:55:36"},"t":"event"}'
2018-04-13 23:55:36 DEBUG (MainThread) [pydeconz.deconzdevice] lumi.sensor_switch: update buttonevent with 1002
2018-04-13 23:55:36 DEBUG (MainThread) [pydeconz.deconzdevice] lumi.sensor_switch: update lastupdated with 2018-04-13T13:55:36

The button appears in the REST API:

"10": {
	"config": {
		"on": true,
		"reachable": true
	},
	"ep": 1,
	"etag": "10ac<removed>",
	"manufacturername": "LUMI",
	"mode": 1,
	"modelid": "lumi.sensor_switch",
	"name": "lumi.sensor_switch",
	"state": {
		"buttonevent": 1002,
		"lastupdated": "2018-04-13T13:55:36"
	},
	"type": "ZHASwitch",
	"uniqueid": "<removed>00:01:f3:dd<removed>"
},

I have of course restarted HA during testing.

Thanks

Have you tried to rename your button so that there is no dot in the name? It seems as if ha is removing it and maybe there are issues matching the old id to the new id.
I have the same event trigger for a aquara smart button and it works

1 Like

It could be as simple as you removing the " around your event (“1002”), since it’s supposed to be an integer, not a string.

1 Like

@jo-me and @Robban both of those together fixed the problem! Thank you both for the help. Its always the simple things…

1 Like

@chrisvella

Could you post your yaml code for this automation?

@Oliviakrk my HA system isn’t up atm but I should be able to help you. What exactly do you want to do?

I am trying to use Xiaomi switch to toggle light…

I enabled debug for deconz. I can see the event…

2018-12-13 23:14:42 DEBUG (MainThread) [pydeconz.deconzdevice] KatesXiaomiSwitch: update buttonevent with 1000
2018-12-13 23:14:42 DEBUG (MainThread) [pydeconz.deconzdevice] KatesXiaomiSwitch: update lastupdated with 2018-12-13T22:14:42
2018-12-13 23:14:42 DEBUG (MainThread) [pydeconz.deconzdevice] KatesXiaomiSwitch: update buttonevent with 1002

I made automation:

alias: XiaomiButton in Kates room
  trigger:
    platform: event
    event_type: deconz_event
    event_data:
      id: 5
      event: 1002
  action:
    service: light.toggle
    entity_id: light.katedeskled

But it doesn’t work. I tried to use numer and switch name in the od field, but it didn’t work.

Ok found it. id is case sensitive and always small letters.

So did you fix your problem?

Yes. Thanks!

Hi,

trying to avoid any errors mentioned above i still don’t get my simple switch automation to work.
Any help appreciated.

automation.yaml

- id: 'baumtoggle'
  alias: baum_toggle
  hide_entity: false
  initial_state: 'on'
  trigger:
    platform: event
    event_type: deconz_event
    event_data:
      id: Schalter1
      event: 1002
  action:
  - service: switch.toggle
    entity_id: switch.steckdose_ii    

Fireing the event from hassbian gui is executing the automation rule. Pushing the button device isn’t…
2018-12-24%2023_22_47-Home%20Assistant
Hassbian log:

2018-12-24 23:24:26 DEBUG (MainThread) [pydeconz.deconzdevice] Schalter1: update buttonevent with 1000
2018-12-24 23:24:26 DEBUG (MainThread) [pydeconz.deconzdevice] Schalter1: update lastupdated with 2018-12-24T22:24:26
2018-12-24 23:24:26 DEBUG (MainThread) [pydeconz.websocket] Websocket data: {"e":"changed","id":"6","r":"sensors","state":{"buttonevent":1000,"lastupdated":"2018-12-24T22:24:26"},"t":"event","uniqueid":"00:15:8d:00:02:b2:21:8a-01-0006"}
2018-12-24 23:24:27 DEBUG (MainThread) [pydeconz.deconzdevice] Schalter1: update buttonevent with 1002
2018-12-24 23:24:27 DEBUG (MainThread) [pydeconz.deconzdevice] Schalter1: update lastupdated with 2018-12-24T22:24:27
2018-12-24 23:24:27 DEBUG (MainThread) [pydeconz.websocket] Websocket data: {"e":"changed","id":"6","r":"sensors","state":{"buttonevent":1002,"lastupdated":"2018-12-24T22:24:27"},"t":"event","uniqueid":"00:15:8d:00:02:b2:21:8a-01-0006"}

id should only be lowercase

1 Like

thank you!!! changed to lowercase - works :slight_smile:

1 Like