Function node not consistent

I am trying to make an automation where my EVSE (car charger) displays on my Homeseer wd200 status lights.

I want one to change color with temperature, and another to change with the status.

I have the status change working, but when I copy my Function node, changing from looking for a string to comparing values (if payload >= # ) I get a completely different type of output from the function node.

In the working operation I get this message:

{"topic":"sensor.status_of_evse","payload":{"data":{"node_id":15,"parameter":21,"value":"Blue"}},"data":{"entity_id":"sensor.status_of_evse","old_state":{"entity_id":"sensor.status_of_evse","state":"charging","attributes":{"friendly_name":"Status of EVSE"},"last_changed":"2020-02-01T01:00:24.819859+00:00","last_updated":"2020-02-01T01:00:24.819859+00:00","context":{"id":"17cfb3db5bb847ec84cbcdddd75bf9f1","parent_id":null,"user_id":null}},"new_state":{"entity_id":"sensor.status_of_evse","state":"charging","attributes":{"friendly_name":"Status of EVSE"},"last_changed":"2020-02-01T01:00:24.819859+00:00","last_updated":"2020-02-01T01:00:24.819859+00:00","context":{"id":"17cfb3db5bb847ec84cbcdddd75bf9f1","parent_id":null,"user_id":null},"timeSinceChangedMs":9322}},"_msgid":"6cd2b8ae.04e5f8"}

BUT from the other I get this message:

{"topic":"sensor.temperature_of_evse","payload":"32.5","data":{"entity_id":"sensor.temperature_of_evse","old_state":{"entity_id":"sensor.temperature_of_evse","state":"32.5","attributes":{"unit_of_measurement":"C","friendly_name":"temperature of EVSE"},"last_changed":"2020-02-01T01:00:24.814171+00:00","last_updated":"2020-02-01T01:00:24.814171+00:00","context":{"id":"aecd031c7a484f53b295d1341d7bce7e","parent_id":null,"user_id":null}},"new_state":{"entity_id":"sensor.temperature_of_evse","state":"32.5","attributes":{"unit_of_measurement":"C","friendly_name":"temperature of EVSE"},"last_changed":"2020-02-01T01:00:24.814171+00:00","last_updated":"2020-02-01T01:00:24.814171+00:00","context":{"id":"aecd031c7a484f53b295d1341d7bce7e","parent_id":null,"user_id":null},"timeSinceChangedMs":9341}},"_msgid":"ba461a2d.1054a8"}

If you didn’t see it, in the second, I’m expecting to get a
{"topic":"sensor.temperature_of_evse","payload".{data:{"node_id":15,"parameter":21,"value":"Blue"}}
And that is not in the message. I am very very N00B at nodeRed and more comfortable with C++, so I’m at a loss here as to what I’ve missed or haven’t done.
Help would be greatly appreciated, if you see what i’ve missed, or have an explanation I would love to hear it.

Here is an export of the entire flow

[{"id":"edda18d.6bf57e8","type":"tab","label":"Zwave Status Lights","disabled":false,"info":""},{"id":"8c1fdc00.bc6b4","type":"server-state-changed","z":"edda18d.6bf57e8","name":"EVSE Status","server":"46657b58.0752c4","version":1,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"sensor.status_of_evse","entityidfiltertype":"exact","outputinitially":true,"state_type":"str","haltifstate":"","halt_if_type":"str","halt_if_compare":"is","outputs":1,"output_only_on_state_change":true,"x":130,"y":140,"wires":[["9131489f.23d198","c85be1e.ed0542"]]},{"id":"52747ac8.bb6f64","type":"api-call-service","z":"edda18d.6bf57e8","name":"Send to Zwave","server":"46657b58.0752c4","version":1,"debugenabled":false,"service_domain":"zwave","service":"set_config_parameter","entityId":"","data":"{{msg.payload}}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":740,"y":140,"wires":[["4dcd7748.a9c088"]]},{"id":"9131489f.23d198","type":"function","z":"edda18d.6bf57e8","name":"set color","func":"var payload = msg.payload;\nif (payload==\"connected\"){\n    msg.payload={ data: {\"node_id\":15,\n    \"parameter\":21,\n    \"value\":\"Blue\"\n    }}\n}\nif (payload==\"charging\"){\n    msg.payload={ data: {\"node_id\":15,\n    \"parameter\":21,\n    \"value\":\"Blue\"\n    }}\n}\nif (payload==\"ready\"){\n    msg.payload={ data: {\"node_id\":15,\n    \"parameter\":21,\n    \"value\":\"Magenta\"\n    }}\n}\nif (payload==\"error\"){\n    msg.payload={ data: {\"node_id\":15,\n    \"parameter\":21,\n    \"value\":\"Red\"\n    }}\n}\n\nreturn msg;","outputs":1,"noerr":0,"x":380,"y":140,"wires":[["1785d6de.243369","52747ac8.bb6f64"]]},{"id":"e8297e56.f0318","type":"debug","z":"edda18d.6bf57e8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":610,"y":280,"wires":[]},{"id":"1785d6de.243369","type":"debug","z":"edda18d.6bf57e8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":530,"y":180,"wires":[]},{"id":"a182cabc.bab8f8","type":"server-state-changed","z":"edda18d.6bf57e8","name":"EVSE Temp","server":"46657b58.0752c4","version":1,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"sensor.temperature_of_evse","entityidfiltertype":"exact","outputinitially":true,"state_type":"str","haltifstate":"","halt_if_type":"num","halt_if_compare":"lt","outputs":1,"output_only_on_state_change":true,"x":130,"y":240,"wires":[["4fb40df4.16e164","b62723ef.296d"]]},{"id":"4fb40df4.16e164","type":"function","z":"edda18d.6bf57e8","name":"set color","func":"var payload = msg.payload;\nif (payload >= 55){\n    msg.payload={ data: {\"node_id\":15,\n    \"parameter\":22,\n    \"value\":\"Yellow\"\n    }};\n}\nif (payload >= 60){\n    msg.payload={ data: {\"node_id\":15,\n    \"parameter\":22,\n    \"value\":\"Red\"\n    }};\n}\nif (payload <= 30){\n    msg.payload={ data: {\"node_id\":15,\n    \"parameter\":22,\n    \"value\":\"Blue\"\n    }};\n}\nreturn msg;","outputs":1,"noerr":0,"x":380,"y":240,"wires":[["e8297e56.f0318"]]},{"id":"4dcd7748.a9c088","type":"debug","z":"edda18d.6bf57e8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":1180,"y":140,"wires":[]},{"id":"c85be1e.ed0542","type":"debug","z":"edda18d.6bf57e8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":280,"y":80,"wires":[]},{"id":"b62723ef.296d","type":"debug","z":"edda18d.6bf57e8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":260,"y":200,"wires":[]},{"id":"46657b58.0752c4","type":"server","z":"","name":"Home Assistant"}]
if (payload >= 55){
}
if (payload >= 60){
}
if (payload <= 30){
}

32.5 doesn’t meet any of the conditionals so the payload stays the same, 32.5.

1 Like

OH GOD, really. I’m that dumb? Shit… :frowning:

Well, Thank you for taking the time to point that out to me!!