First of i am new to node red, but have some experience from arduino.
I am trying to controll my Phillips Hue lights with a Hue switch, that outputs the following when pressed (in this case the "on" button have been pushed):
button: 1002
name: "On"
action: "short released"
updated: "2020-01-08T12:28:17+00:00"
When i listen to msg.payload.name i get "on" and "off" respectively. How do i turn these two string values into a boolean true and false as output?
I know i should be able to do this with the function block, but i am suspecting that there should be an easier way to do this?
ahh nice spottet.... now it works... sort of. Problem here being that there are 4 buttons (On, Off, Dim, Bright). This means that Dim and Bright are also reported as Off, using the first suggestions.
In my defence you did say 'When i listen to msg.payload.name i get "on" and "off" respectively'. I had not noticed that this was inconsistent with data a few lines earlier.
Thank you for your reply. I was in no way suggesting that you had anyway of knowing that there were 4 cases. You did answer correctly with the info given by me... i just recaped why i ended up not using your suggestion, because i forgot to mention the full case
Just wanted to jump in and say thanks to everyone!
I've been using Node-RED with my raspberry pi for awhile using MQTT to control LED lights and a solar powered container watering system. Got stuck when trying Peter Scargills Big Timer which outputs a string to my node-RED Dashboard switch which needed a boolean.
I chose the Change node and need to take some time to learn to use the function node