sinricpro / esp8266-esp32-sdk

Library for https://sinric.pro - simple way to connect your device to Alexa, Google Home, SmartThings and cloud
https://sinric.pro
Other
230 stars 124 forks source link

Not really an issue but maybe a feature request? #27

Closed Sterling-101 closed 4 years ago

Sterling-101 commented 4 years ago

I have a Wemos D1 running a light switch that is running perfectly at the moment unless I lose wifi connection or there's an issue with the Sinric service (this happened today). The wifi link I've got around by periodically checking for connection and reconnecting if it's dropped out (we have a problem with our router sometimes and it kicks the wifi connections off). However I seemed to have an issue today where the Alexa routine to switch on the light wouldn't work and when I went to log in to sinric.pro it seemed that the service was unavailable which explained why I couldn't control the light via Alexa. After a while I checked and the Sinric services were back up ok but I still had no control until I had rebooted the Wemos that runs the switch.

Is there a simple routine that could periodically check for connection to the Sinric service and do a forced reconnect if there's a problem at all?

Would definitely make it a little easier if I can't get to the power supply to reset the board.

sivar2311 commented 4 years ago

Usually, reconnect is done automaticly by websocket library. All my devices reconnected automaticly yesterday...i had no need for a manual reset. Which SinricPro library version do you use? Latest version is 2.3.0

You can set callbacks for connected / disconnected events. Please see documentation for these callbacks

Sterling-101 commented 4 years ago

Currently running 2.2.7 so will update and see if that helps out the next time I have a connection problem at this end. I'll look into the call backs too especially the RestoreDeviceStates() as that would definitely come in handy I think.

sivar2311 commented 4 years ago

2.2.7 is fine (no changes about reconnect), but updating to latest version is always good. The restoreDeviceStates was made for power failures, so when device resets and reconnect to server it will get last known states from server.