mark-j / Caseta2Mqtt

A gateway to connect a Lutron Caseta Smart Bridge Pro and MQTT.
MIT License
13 stars 3 forks source link

`GNET>` output can show up mid-line, cause parse errors #119

Open lilyball opened 2 years ago

lilyball commented 2 years ago

I just started this up and while I was watching it populate the initial data, I noticed that one of my lights reported a level of NaN. Looking at the logs, I found this

[02/25/2022 00:52:51.802] dbug: 192.168.1.173: ~OUTPUT,27,1,GNET>
[02/25/2022 00:52:51.804] trce: Device 27 (master-bedroom/main-light) updated: level = NaN
[02/25/2022 00:52:51.806] dbug: 192.168.1.173: 0.00
[02/25/2022 00:52:51.809] trce: Successfully published message casetas/master-bedroom/main-light/level = NaN

And this isn't just during initial setup. After running for a few minutes, one of my other lights flipped over to NaN as well, with the logs showing

[02/25/2022 00:56:06.843] dbug: 192.168.1.173: ~OUTPUT,8,1,GNET>
[02/25/2022 00:56:06.844] trce: Device 8 (outside/back-flood) updated: level = NaN
[02/25/2022 00:56:06.847] dbug: 192.168.1.173: 0.00
[02/25/2022 00:56:06.849] trce: Successfully published message casetas/outside/back-flood/level = NaN

I don't know why this is happening, but the string GNET> should never show up as part of a valid command, and so it should probably just be stripped from all output before parsing.

lilyball commented 2 years ago

For that matter, it looks like it's not even looking for CRLF terminators, it's just processing every packet of data.

marks-ci-bot commented 1 year ago

@mark-j this issue has been sitting for a while. Can you take a look?