nspanel
nspanel copied to clipboard
Faulty payload of Widget 3 as scene
So I found a weird bug while testing widgets, especially scenes.
If I set the index 3 widget as a scene the MQTT output has an additional brace at the end breaking the parsing.
Console output:
23:28:57.903 NSP: Received Raw = bytes('55AA860A007B226964223A2233227D7DAF00')
23:28:57.915 bytes('7B226964223A2233227D7D')
23:28:57.931 MQT: tele/NSPanel/RESULT = {"NSPanel":{"id":"3"}}}
My quick and dirty workaround so far: R1N4x:widget-3-fix
That's a second report of malformed JSON. Need to investigate whether its a bug in the NSPanel firmware or the drives is reading something incorrectly
I can also confirm widget 3 gives me some funky result when using a scene. I've been scratching my head for a few days, its good to see someone else has spotted the malformed payload!
I think the parsing code in nspanel.be is wrong, the piece where it finds the end is done by searching for the '}' character, but if there is some additional data that also happens to be 0x125 (== curly close brace) then it points to the wrong data at the end of the payload.
See https://github.com/blakadder/nspanel/pull/27
Was this ever fixed? I've just run into this exact problem with the extra } on 3. It's preventing my rule (triggered by NSPanel#id) from running when selecting 3.