Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RF Bridge: Add support for relay toggle with same code #270

Closed
xoseperez opened this issue Nov 9, 2017 · 5 comments
Closed

RF Bridge: Add support for relay toggle with same code #270

xoseperez opened this issue Nov 9, 2017 · 5 comments
Labels

Comments

@xoseperez
Copy link
Owner

Originally reported by: Tiago (Bitbucket: dummyinput, GitHub: Unknown)


Hi,

would it be possible to add support for each relay to toggle its state when receiving a code code (instead of having a separate ON/OFF code). This would simplify interaction with Homeassistant mqtt automations. Maybe the simplest implementations would be: if you set the same code for ON/OFF it will set the behavior to toggle, this way no UI changes would be required.

thanks,
Tiago.

@xoseperez
Copy link
Owner Author

Right now it supports "1" or "ON" to switch it on and "0" or "OFF" to switch it off.
But it also supports "2" or "TOGGLE" to toggle the state. Is this what you need?
Strings are case insensitive.

@xoseperez
Copy link
Owner Author

Original comment by Tiago (Bitbucket: dummyinput, GitHub: Unknown):


I guess you are referring to the MQTT commands that can be sent to the bridge. I meant adding the option for when the bridge receives an RF remote code it toggles the internal state, so the MQTT message it sends will alternate between '1' and '0' even when pressing the same remote button (instead of having a separate RF code for 'on' and one for 'off'). Right now I have an automation in HASS that toggles a light when it receives a message from the bridge with the relay topic (ignoring the payload), however this doesn't work since the bridge will periodical send the relay states with the same topic, which will also trigger the toggle.

@xoseperez
Copy link
Owner Author

Sorry, I misunderstood.

Currently, it supports using the same code for ON and OFF. So when the switch is triggered (either via MQTT, API, or web UI) it sends the code only once. That is the WIFI to RF part of the bridge.

But I guess you need that when the rfbridge receives an RF message for a switch with equal codes for on and off it should report a 2 (toggle) via MQTT. Is that it?

@xoseperez
Copy link
Owner Author

Original comment by Tiago (Bitbucket: dummyinput, GitHub: Unknown):


Yes, an option for when an RF code is received, send a MQTT message with a '2' state payload would be what I would need (so at least I could distinguish that from the state update message).

@xoseperez
Copy link
Owner Author

Version 1.9.9 just released handles this use case, when the RF code is received it correctly toggles the switch and reports the new value via MQTT.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant