enwi / hueplusplus

A simple C++ library to control Philips Hue lights on Linux, MacOS, Windows, Espressif ESP32 SDK and Arduino. Full documentation at
https://enwi.github.io/hueplusplus/
GNU Lesser General Public License v3.0
53 stars 22 forks source link

Bridge reconnect #63

Closed nandra closed 3 years ago

nandra commented 3 years ago

Hello, is there in library some functionality which reconnect to Bridge is it was disconnected during operation? Thanks.

enwi commented 3 years ago

Each command sent to the bridge opens up its own connection so there is no need to reconnect. If you mean the token, that needs to be retrieved while pressing the button of the bridge, you need to store and provide it to hueplusplus if you restart your program.

nandra commented 3 years ago

I mean if e.g. bridge is disconnected from power or lost network how it is handled.

enwi commented 3 years ago

There is nothing specific for that case, but you will probably get some Exceptions like (in the case of Linux/MacOS) https://github.com/enwi/hueplusplus/blob/83d4883211e61a66867f5736a96c667652ce333e/hueplusplus/LinHttpHandler.cpp#L72 https://github.com/enwi/hueplusplus/blob/83d4883211e61a66867f5736a96c667652ce333e/hueplusplus/LinHttpHandler.cpp#L87 https://github.com/enwi/hueplusplus/blob/83d4883211e61a66867f5736a96c667652ce333e/hueplusplus/LinHttpHandler.cpp#L100 https://github.com/enwi/hueplusplus/blob/83d4883211e61a66867f5736a96c667652ce333e/hueplusplus/LinHttpHandler.cpp#L123