I’m trying to migrate from domoticz to homeassistant with my standalone gate controller, I have only this device left.
Everything works on ESP_Easy_mega_20201016_test_ESP32_4M316k (since newer version they put gpio into core and my config is not working on it)
ButtonA is set as Push Button Active High
on System#Boot do TaskValueSet,1,2,1 timerSet,3,5 endon on ButtonA#State=0 do if [Task#Block]=0 and [Foto#State]=0 event,gateclose else gpio,23,0 timerSet,2,1 endif endon on ButtonA#State=1 do if [Task#Block]=0 event,gateopen endif endon on gateclose do gpio,13,1 gpio,15,1 timerSet,4,1 delay,1000 longpulse,12,0,160 delay,1500 longpulse,14,0,160 timerSet,1,70 //disable barrier endon on gateopen do TaskValueSet,1,1,1 timerSet,4,1 gpio,12,1 gpio,14,1 delay,1000 longpulse,15,0,160 delay,1300 longpulse,13,0,160 endon on Foto#State=1 do //Foto if [ButtonA#State]=0 and [Task#Dummy]=1 gpio,23,0 timerSet,2,1 endif endon on Rules#Timer=1 do TaskValueSet,1,1,0 endon on Rules#Timer=2 do gpio,23,1 endon on Rules#Timer=3 do TaskValueSet,1,2,0 endon
On GPIO 23 I have physical button in push button active high mode, when I press him gate is closing or opening and reporting that state to domoticz, and when I’m doing that same in domoticz, always I have press button only once to change gate state. When gate is closing and something cross photo barier, rules immediately open gate and reporting state to domoticz.
I spent few days to move it to HA but unsuccessfully. I just need to have synced gpio23 with entity in HA with possibility to execute events, it would be nice if it would works like in domoticz as one icon.
I tried a lot of varation as:
switch: - platform: mqtt name: "Gate" command_topic: "ESP/cmd" payload_on: "event,gateopen" payload_off: "event,gateclose"
In that case I can execute events and it works when I’m pressing buttons in HA.
- platform: mqtt name: "GateState" state_topic: "ESP/ButtonA/State" state_on: "1" state_off: "0" retain: true
In this case I can read state of button.
- platform: mqtt name: "GateSt" state_topic: "ESP/GateSt" state_on: "close" state_off: "open" device_class: garage_door
and I tried to put Publish to send state in rules
on ButtonA#State=0 do if [Task#Block]=0 and [Foto#State]=0 Publish ESP/GateSt,close event,gateclose else gpio,23,0 timerSet,2,1 endif endon on ButtonA#State=1 do if [Task#Block]=0 Publish ESP/GateSt,open event,gateopen endif endon
Other problem is on reboot esp, on beginning in rules I put dummy device with 5s timer to prevent to open gate at boot, it works with domoticz mqtt but not when I selected HA as controller it won’t.