-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
JSON input can only match on exact msg.payload string #48
Comments
Hello @deelerke !
Edit below: It's been a little since I've messed around with the node, just played a little more and I have some thoughts, let me know what you think: Right now the node is using Node-RED's So for example: MatchTest {
"value" : false,
"value2" : true
} Payload {
"value" : false,
"value1.5" : false,
"value2" : true
} No matchTest {
"value" : false,
"value2" : true
} Payload // Missing "value2" {
"value" : false,
"value1.5" : false
} Payload // value2's value does not match {
"value" : false,
"value1.5" : false,
"value2" : false
} |
Looking back on this I think there isn't a very extendable but also non-power user style interface that I can imagine, and it feels like it would be more flexible to keep this functionality in a separate place, such as a function or switch node. However if anyone still has a strong argument feel free to drop it here! |
hi, there is an option to select JSON input for the msg.payload, but it seems to only test the whole string. So the LED would only colorize when the complete string is matched.
Is it possible to select which JSON element & value to test?
For example: an input would look like: { "Light1":0,"Light2":1,"Light3":0,"Light4":1 }
And then have the led node to test:
if "Light1" == "1" then color = "green"
if "Light1" == "0" then color = "grey"
That way you can connect many ui-leds to a single input and select on what element to light up.
see: https://discourse.nodered.org/t/simple-json-input-string-to-leds-on-dash/20003
THANKS!
The text was updated successfully, but these errors were encountered: