fasmide / deflux

deconz sensors to influxdb
MIT License
21 stars 9 forks source link

Auto-reconnect to websocket and improved event parsing #2

Closed runger1101001 closed 5 years ago

runger1101001 commented 5 years ago

Hi,

I implemented reconnecting to deconz, which is working nicely.

I also made event parsing more robust by checking for sensor events, and only parsing those. In my setup I have several groups and switches, which were sending "group" events, which were being parsed as sensors, and in some cases the ids matched existing sensors causing 0-valued sensor readings to be logged to InfluxDB.

I had to refactor the code a bit to enable reconnection. I moved the goroutine and web socket handling into SensorEventReader and Reader, so that reconnects can be part of the sensor-reading loop. I hope the code is understandable.

It has been running without problems for a week now:

image

Regards from Vienna,

Richard

fasmide commented 5 years ago

:+1:

Nice addition!