I want to see if my payload contains specific data, but if i was going too far in, it wouldn’t allow me to use typeof, if the preceding key wasnt there.
Ill use this and try writing something up and post later.
I’m not sure where they came from, I just looked at my script, and couldn’t them there.
Can you make a test, for a key that isn’t in the object? Eg. typeof msg.data.attributes.unknown ?
Because, when the key is there, I don’t get an error, only when it’s missing.
At the moment I’m working towards either converting the msg object to an javascript array and search for the key, og just convert to json string, and search for the specific text.
If the state node only allows to pass when the light is on, then it shouldn’t fail to check the rgb_color property should always be there if that’s the only light you are checking, if is a binary simple light with no attributes it will fail of course
Main problem being that if I set a philips hue color lamp to the white ambiance from the app, it dosn’t show the rgb color, and the other way around too…