The $entity()
variable is only available in the home assistant nodes. Also when using the nodered nodes the path changes from attributes.longitude
to data.attributes.longitude
.
Inside ha nodes omit data if it is part of the path, in nodered, use it. Most of the time. There are also differences between JSON and Jexpression aka jsonata
[{"id":"2a3de46120e39c8e","type":"api-current-state","z":"60f2d2277843c698","name":"","server":"6b1110b5.183a4","version":3,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","entity_id":"device_tracker.pixel_7_5","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":440,"y":2620,"wires":[["36ef6e34a902d7ec"]]},{"id":"2a5d383dd1367854","type":"inject","z":"60f2d2277843c698","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":210,"y":2620,"wires":[["2a3de46120e39c8e"]]},{"id":"36ef6e34a902d7ec","type":"change","z":"60f2d2277843c698","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"{\t \"lat\": data.attributes.latitude,\t \"lon\": data.attributes.longitude \t}","tot":"jsonata"},{"t":"delete","p":"data","pt":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":700,"y":2620,"wires":[["1e2e6826354e97f1"]]},{"id":"1e2e6826354e97f1","type":"debug","z":"60f2d2277843c698","name":"debug 32","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":860,"y":2620,"wires":[]},{"id":"6b1110b5.183a4","type":"server","name":"Home Assistant","version":5,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":false,"heartbeat":false,"heartbeatInterval":"30","areaSelector":"friendlyName","deviceSelector":"friendlyName","entitySelector":"friendlyName","statusSeparator":"at: ","statusYear":"hidden","statusMonth":"short","statusDay":"numeric","statusHourCycle":"h23","statusTimeFormat":"h:m","enableGlobalContextStore":true}]