I have a few Nexa remote controls (433 MHz) lying around and I got myself a Telldus ZNet Lite v2 to be able to use them with Home Assistant.
In some instances, I would like to use two (or more, for that matter) remotes to control the same switch(es). For example, I could put one remote at each end of a room (or top and bottom of stairs) so that I could control the light from both locations.
The remotes have two buttons per channel: “On” and “Off”. The Telldus box keeps track of the last command (On or Off). If the last command was “On” and I press the “On” button, nothing happens as there is no change. Therefore, if I switch the light off with the first remote and then on again with the second, I can’t switch if off again with the first remote without setting (in Home Assistant) the first remote to toggle when the second remote is used.
I have solved this with two automations for “On” and two for “Off”. For “On”: One automation that switches the light on when the first remote gives the command “On” and sets the second remote to “On” as well, and one automation that sets the first remote to “On” when the second remote gives the “On” command. Similarly for “Off”, of course. Like this:
- id: automation_on_1
alias: Automation On 1
trigger:
platform: state
entity_id: switch.remote1
from: 'off'
to: 'on'
action:
service: switch.turn_on
entity_id:
- switch.light
- switch.remote2
- id: automation_on_2
alias: Automation On 2
trigger:
platform: state
entity_id: switch.remote2
from: 'off'
to: 'on'
action:
service: switch.turn_on
entity_id:
- switch.remote1
This works fine when the remotes are operated. However, if I set one of the switches from the Home Assistant front end, the light sometimes starts toggling on and off. I can’t understand why.
Similarly, I tried to do something similar with my MyQ garage cover. The cover can be controlled via a hard wired switch as well as an app, but I thought “hey, it would be cool to use one of the 433 MHz remotes as well”. To make the remote track the actual cover state, I thought I’d monitor the cover state and set the 433 MHz remote state accordingly. I tried this:
- id: open_cover_by_remote3
alias: Open cover by Remote3
trigger:
- entity_id: switch.remote3
platform: state
from: 'off'
to: 'on'
action:
service: cover.open_cover
data:
entity_id: cover.garagecover
- id: set_remote3_when_cover_open
alias: Set Remote3 when cover open
trigger:
- platform: state
entity_id: cover.garagecover
to: 'open'
- platform: state
entity_id: cover.garagecover
to: 'opening'
action:
service: homeassistant.turn_on
data:
entity_id: switch.remote3
What happened then is if I open the cover by other means than Remote3 (app or hard wired), the cover will start opening (as it should). After a few seconds, I can see on the front-end that the Remote3 state changes from “Off” to “On” and a second or so after that, the cover stops (half-way open).
I guess I’m on thin ice when I change the state of a switch that triggers another automation (sort of in a loop), both with the lights and multiple remotes as well as with the cover and the additional remote, but I’m not sure how to do this better.
Suggestions or pointers would be highly appreciated.