dkjonas / Wavin-AHC-9000-mqtt

Esp8266 mqtt interface for Wavin AHC-9000/Jablotron AC-116
MIT License
82 stars 35 forks source link

Handle "turn on" at same time as the Wavin product itself #36

Open exetico opened 4 months ago

exetico commented 4 months ago

Hi,

Thank you for all the work into the AHC 9000. I'd like just to hear, if you'd done anything to prevent issues in the case of a power outage? All the time I've turned of my grid power, and turned it back on, I don't get any states publiched from the ESP.

The AHC 9000 and ESP turns on at the same time, so I think that's the problem.

Our unit also have a touch screen connected, if that matters.

I'd like to get this fixed somehow, but I'm not that into the Wavin product itself, so I'm not really sure that's the actual problem is.

After I turn on the AHC 9000 (which also powers my ESP and the touch screen), the touch screen does not start up, as i'd expect. I need to turn it off, and on again (remove + replug cable). After that's done, it's working fine, if the ESP are not connected. Else, it's not really working as expected. If the ESP are not in the Wavin unit, it starts up just fine. So, I've personally though about a "cold-period" before the ESP starts to communicate with the Wavin solution... But... I'm not really sure if that's the best work-around?

dkjonas commented 4 months ago

The ahc doesn't allow two "masters" to communicate on the bus at the same time. So if you connect both the display and the esp at the same time, you may experience errors. At power on, both the display and the esp will try to communicate with the ahc at the same time, and in that case the ahc will just receive garbage.

Once the initial communication is done, both the esp and the display will have larger periods, where they don't send anything on the bus, so the chance of communication collision is lower.

If it is working reliably for you, when the esp is connected later than the display, you could just add a delay in the startup of the esp. Collisions may still occur, so it is not a perfect fix.

You can add a delay(30000); in main.cpp, line 226 (end of setup method) to make it sleep for 30 seconds at startup.