I managed to use my sonoff button so I can control (toggle) 3 items, but I created 3 separate files for that.
I hoped that I could integrate it into 1 file, but nevertheless this works
(I have my automations in a separate folder : automation jja: !include_dir_list …/automations)
The problem i have though the entity is not showing as a ZHA event but as a state changed event instead. I’m thinking the only way around this may be to flash my sonoff bridge with tasmota and see if this would make any difference.
It’s difficult to choose the best option, because there are many. I eventually chose for the conbee 2 stick with ZHA.
I also have a sonoff zigbee bridge witch now I have disconnected
ok, made some progress. I may have to write 3 separate automations I believe.
Below is working automation for “Single” press.
I read in blogs that switch press is not an entity, just an event. But somhow state status is retained in the entity of switch (which only has battery and friendly name otherwise).
There is templating, but that is not something i will be able to do.
Conditional actions also failed (probably because I do not now how to write them properly) .
But i think I got a start, its time for HA geniuses to jump in
and Google sent me to this thread.
I listened to events, created an automation which works but I heard another device relay clicking. Somehow, this new button is triggering this device by itself without any automations…
I use conbee too. I configered the same way. I can click to each automatisation and its working perfectly. When I press the snzb-0, it starts turn-on two lights at the same time, toggles between the two lights. Only the third light (3 sec hold) works correctly. I have no idea why.
I’m using conbee 2 without the sonoff bridge. Personally, I don’t use the ZHA integration, I’m using deCONz and sensing the button presses from deconz_events referencing the unique_id of the switch.
And using the event number to differentiate toggle, on or hold.
1002 is single click
1004 is double click (On)
1003 is 3 sec hold
For Example, I have a switch under my coffee table to control different lights and scenes.
I have 1 automation for each type of action (toggle, on, hold)
In this example of one of my automations I am using the single press (toggle) code of 1002 as the trigger portion of the automation;
Thanks. Here, what happens:
I have 2 Zigbee Plugs, 1 WiFi-Plug and 1 Zigbee Light
I defined the 3 Plugs.
when I press 1 x --> Light and Plug 1 turns on/off
when I press 2 x --> Light and Plug1, Plug 2 turns on, pressing 2 x again, plug 2 turns off
long press --> Plug 3 turns on/off (WiFi Tuya)
Guys … I’ve added the switch trough the sonoff gateway and then found it in HA with Sonoff Lan.
When I listen to all events (*) and I press the button, I got this feedback:
Thanks @SteveM363! Newish to HA, and your comment led me to install Node-Red. After a bit of familiarisation with it, I managed to quickly get my Sonoff switch working with all command types.
If anyone else finds this via google, this was pretty straightforward, and Node-Red looks amazing for automation.
Hi there. Coming a bit late to the party but here we go:
I just flashed a sonoff zbbridge and added the ZHA integration. I have a few sonoff zb devices: plug, temperature sensor, motion sensor and button. I get all the right entities in HA but I only get the battery status for the button.
I think I shouldn’t have used the ZHA integration. After all, I am controlling all my other devices (wifi mostly) via MQTT.
The documentaiton saids:
" you cannot use any Zigbee commands in Tasmota console in this mode. All setup needs to be done from Home Assistant ZHA integration."
How do I disable ZHA and enable the zigbee events broadcasting on MQTT? I basically want to control my zigbee devices via MQTT. If I get that working, then it is very easy to setup inside HA via the MQTT integration.