mqtt-scripts icon indicating copy to clipboard operation
mqtt-scripts copied to clipboard

getProp() needs extra "val" property

Open zustellr opened this issue 3 years ago • 0 comments

Hi. I am starting to use this library (thanks for your work!) and stuggled quite a bit with the getProp() function.

When reading a topic with a value of

{
  "state": "OFF",
}

I was expecting to use

     var state = getProp(path, "state");

but instead had to use

     var state = getProp(path, "val", "state");

to read it correctly. Could be that I missed something in the documentation, or that this is general quirk of mqtt.

Please check and feel free to close if this is the expected behavior. Could also be that this is a thing that could be added to the documentation, if it is expected behavior.

Thanks!

zustellr avatar Dec 18 '21 23:12 zustellr