nspanel icon indicating copy to clipboard operation
nspanel copied to clipboard

Faulty payload of Widget 3 as scene

Open R1N4x opened this issue 3 years ago • 5 comments

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

R1N4x avatar Jan 03 '22 20:01 R1N4x

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

blakadder avatar Jan 04 '22 09:01 blakadder

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!

martingrayson avatar Jan 08 '22 19:01 martingrayson

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.

yvesdm3000 avatar Mar 04 '22 14:03 yvesdm3000

See https://github.com/blakadder/nspanel/pull/27

yvesdm3000 avatar Mar 05 '22 08:03 yvesdm3000

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.

slime1982 avatar Feb 08 '23 22:02 slime1982