UDP data to HA sensors

Hi
I have a logger that’s sending data using UDP that I’m hoping to get into HA. I’ve been searching for a solution but since I’m a total beginner I need more specific info than what I’ve found.

The data comes as:
0B0014EF523A01C0=100.0&0B0014EF523A00C4=71.7&EB3314EF523A01C5=200.0&13EF14EF523A00C5=51.7
Format being:
sensor1_ID=sensor1_value&sensor2_ID=sensor2_value… and so on. Hope that makes sense.

The data is sent at a selectable interval of 1-60 min

Hope someone can help
Thanks

//Knappen

Likely not what you wanted to hear, but you’ll have to program a custom integration for this…

Hi Chris and thanks for answering.
I figured that since node red can receive UDP traffic it is also possible to process that data within it and send it forward as a sensor in HA. Am I mistaken in that assumption? If so, I’m probably screwed :slight_smile:

Ah, nevermind, didn’t notice this was about NR. No clue about that.

you must configure the udp in node. Split node divides the incoming data/string in chuncks, leaving out the & symbols. Which sensor? node gets the substring before every “=” symbol, compares its value with the known IDs and divides the flow for every sensor_ID. Entity node gets the substring after the “=” symbol, which is the value of every sensor, and sets it to the corresponding ID. You will want to set the appropiate name for every sensor whithin every entity node, that’s the name the sensor will display in HA.

[{"id":"9274c290.7fdd7","type":"split","z":"937ef78.ec6b408","name":"","splt":"&","spltType":"str","arraySplt":1,"arraySpltType":"len","stream":false,"addname":"","x":290,"y":2240,"wires":[["302749a.72287b6"]]},{"id":"302749a.72287b6","type":"switch","z":"937ef78.ec6b408","name":"Which sensor?","property":"$substringBefore(payload,\"=\")","propertyType":"jsonata","rules":[{"t":"eq","v":"0B0014EF523A01C0","vt":"str"},{"t":"eq","v":"0B0014EF523A00C4","vt":"str"},{"t":"eq","v":"EB3314EF523A01C5","vt":"str"},{"t":"eq","v":"13EF14EF523A00C5","vt":"str"}],"checkall":"true","repair":false,"outputs":4,"x":460,"y":2240,"wires":[["d23c5abe.6df0a8"],["bbf3a3da.dfd57"],["432b4736.879fa8"],["41ca9572.e2512c"]]},{"id":"d23c5abe.6df0a8","type":"ha-entity","z":"937ef78.ec6b408","name":"sensor1","server":"9405c3fe.d0a6c","version":1,"debugenabled":false,"outputs":1,"entityType":"sensor","config":[{"property":"name","value":"sensor1"},{"property":"device_class","value":""},{"property":"icon","value":""},{"property":"unit_of_measurement","value":""}],"state":"$substringAfter(payload,\"=\")","stateType":"jsonata","attributes":[],"resend":true,"outputLocation":"","outputLocationType":"none","inputOverride":"allow","outputOnStateChange":false,"outputPayload":"$entity().state ? \"on\": \"off\"","outputPayloadType":"jsonata","x":680,"y":2180,"wires":[[]]},{"id":"bbf3a3da.dfd57","type":"ha-entity","z":"937ef78.ec6b408","name":"sensor2","server":"9405c3fe.d0a6c","version":1,"debugenabled":false,"outputs":1,"entityType":"sensor","config":[{"property":"name","value":"sensor2"},{"property":"device_class","value":""},{"property":"icon","value":""},{"property":"unit_of_measurement","value":""}],"state":"$substringAfter(payload,\"=\")","stateType":"jsonata","attributes":[],"resend":true,"outputLocation":"","outputLocationType":"none","inputOverride":"allow","outputOnStateChange":false,"outputPayload":"$entity().state ? \"on\": \"off\"","outputPayloadType":"jsonata","x":680,"y":2220,"wires":[[]]},{"id":"432b4736.879fa8","type":"ha-entity","z":"937ef78.ec6b408","name":"sensor3","server":"9405c3fe.d0a6c","version":1,"debugenabled":false,"outputs":1,"entityType":"sensor","config":[{"property":"name","value":"sensor3"},{"property":"device_class","value":""},{"property":"icon","value":""},{"property":"unit_of_measurement","value":""}],"state":"$substringAfter(payload,\"=\")","stateType":"jsonata","attributes":[],"resend":true,"outputLocation":"","outputLocationType":"none","inputOverride":"allow","outputOnStateChange":false,"outputPayload":"$entity().state ? \"on\": \"off\"","outputPayloadType":"jsonata","x":680,"y":2260,"wires":[[]]},{"id":"41ca9572.e2512c","type":"ha-entity","z":"937ef78.ec6b408","name":"sensor4","server":"9405c3fe.d0a6c","version":1,"debugenabled":false,"outputs":1,"entityType":"sensor","config":[{"property":"name","value":"sensor4"},{"property":"device_class","value":""},{"property":"icon","value":""},{"property":"unit_of_measurement","value":""}],"state":"$substringAfter(payload,\"=\")","stateType":"jsonata","attributes":[],"resend":true,"outputLocation":"","outputLocationType":"none","inputOverride":"allow","outputOnStateChange":false,"outputPayload":"$entity().state ? \"on\": \"off\"","outputPayloadType":"jsonata","x":680,"y":2300,"wires":[[]]},{"id":"878d793f.5afbf8","type":"udp in","z":"937ef78.ec6b408","name":"","iface":"","port":"","ipv":"udp4","multicast":"false","group":"","datatype":"buffer","x":150,"y":2240,"wires":[["9274c290.7fdd7"]]},{"id":"9405c3fe.d0a6c","type":"server","name":"Home Assistant","version":2,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true,"heartbeat":false,"heartbeatInterval":30}]
1 Like

Thanks Obaldius
That worked perfectly :slight_smile: