This is an integration of an esp8266 and 433Mhz remote (it has two buttons on/off that need to be be toggled)
Also I have a relay that should be on when Main PW is ON and OFF when Main PW is OFF.
This code controls the 433mhz remote fine. ( The replay is just a switch in HA for now.)
Of course in HA I see to buttons Main Power ON and Main Power OFF. these will show ON for 3 sec end go OFF.
I’m wondering how to present Main power switch as one button in HA that would show ON when Main power ON ( this action will toggle GPIO4 and pull GPIO14 High) and OFF when Main power OFF (this will toggle GPIO5 and pull GPIO14 Low)
Thank you.
@zoogara, It was fast. Thank you. Found a typo in line, should be OFF (mentioned in case some one will try to follow this thread.
In any case. the Master switch will turn ON Main PW and Water relay fine and then will show OFF in HA GUI. I guess expected based on the code. I was hoping to see it ON when Main Power is ON. Also nothing would happen if I toggle Main Switch OFF (it will not turn off either Main power or water relay.
@Karosm, These 433mhz remotes have On and Off push buttons. In my case I need to push the button and hold for a second for 433Mhz receiver to take action. So I want to automate ON/OFF for the equipment controlled by receiver. The same time use second 433mhs remote to control equipment manually.
So I wired esp8266 to 433Mhz receiver: GPIO4 to ON button and GPIO5 to OFF button.
Really? Post the logs from the ESP.. EDIT: My mistake, you probably need to use optimistic mode as we aren’t setting the state explicitly. Try adding optimistic: true: