I can see the incoming button clicks for each button as a notification, for testing (thanks to this article)
These show up like this:
Sonoff RF Receive
Name: 3wayA1
Command: 0
…where 3wayA1 is the name of the button in eWeLink, and Command=0 is its unique ID
…and, for the other two buttons, 3wayA2 and 3wayA3, I get Command=1 and Command = 2
Good: HA sees each button individually.
My test automation - below - runs whenever any of the three buttons is clicked, so I must be nearly there! But I’ve fiddled and fiddled in trying to use the incoming parameters so that I can, obviously, have separate automations for each button.
Can someone tell me what I need to do? …and preferably without MQTT, which I haven’t learnt yet. Thanks!
You are not saying how exactly the actions should be different depending on the button pressed, but let’s suppose you want to turn on different scenes.
My understanding of the Sonoff bridge integration is that the “name” relates to the RF device and the “command” is just a number of the button in this case. The following condition checks for the device name, and the action calls different scenes. Something like the following should work:
Many thanks for looking at this. Yes I want different actions per button, but I can Call Service as needed. I can also work with either data.command = 0 or data.name = ‘3wayA1’, as either identifies the button involved.
I’m now stuck on your value_template syntax I’m afraid. I get:
Message malformed: template value should be a string for dictionary value @ data[‘condition’][0][‘value_template’]
…when I run the code below. NB I’ve stripped out your elseif/endifs for simplicity. Thanks in advance!
alias: Test RF button (with template)
description: ‘’
trigger:
I am not using that particular Sonoff bridge integration myself, but it looks as only the name and the command together uniquely identify a button press. In other words, if you ever get a second RF button device then it would also send command values of 0, 1, etc. but the name should be different.
And, please format your YAML code using the </> button, otherwise it’s really hard for us to help you with the syntax of your configuration.
Are you sure that the “name” in the event data is actually “Off”?
My understanding of the Sonoff bridge integration is that the “name” actually refers to the RF device and the “command” is a number refering to the button pressed.
And I’m just repeating my warning from above: This easier approach works as long as you only have a single device. As soon as you have multiple devices, they will all have a button that comes in as command: 1 and you will need to start distinguishing by name, too.
Probably right but i currently only have the one device tho the video i watched showed a guy useing 2 buttons and a motion sensor and it was. Command: 0,1,2