Pull multiple entity state values to insert into one notification

I’ve been trying to accomplish this for the past few days and a lot of googling but can’t find a solution.

I have my ford vehicle integrated with HA. I’m trying to create a flow that does the following:

When Ignition is turned on, take the specified current entity states and hold onto the values (ODO, EV Battery Level and Fuel Level). Once the ignition is turned off, take the same readings, subtract them and send a push message to my phone with the values listed for that trip.

I have this working great with just one entity value, but I can’t figure it out with multiple. I tried adding multiple “current sate” nodes but it just pushes multiple payloads out.

I also tried using a change node with the variables set to the expression “$number($entities(“sensor.fordpass_ev_battery_level”).state)” but that node doesn’t like the $entitites function.

I want to modify this working code to allow for more then one entity:

[{"id":"8673e30f.fb9b4","type":"tab","label":"Ford","disabled":false,"info":""},{"id":"4b26a5671d9bbfa5","type":"server-state-changed","z":"8673e30f.fb9b4","name":"Ford Ignition","server":"df9a019b.0518b","version":4,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"sensor.fordpass_ignition_status","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"","halt_if_type":"str","halt_if_compare":"is","outputs":1,"output_only_on_state_change":true,"for":0,"forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":true,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":true,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"}],"x":210,"y":180,"wires":[["8e637a32a2637047"]]},{"id":"8e637a32a2637047","type":"switch","z":"8673e30f.fb9b4","name":"State","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"Run","vt":"str"},{"t":"eq","v":"Off","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":380,"y":210,"wires":[["834e5742fe22dab2","eba2a8cce5ed34f8"],["834e5742fe22dab2"]]},{"id":"834e5742fe22dab2","type":"trigger","z":"8673e30f.fb9b4","d":true,"name":"15 Minute Timer","op1":"","op2":"Run","op1type":"nul","op2type":"str","duration":"1","extend":false,"overrideDelay":false,"units":"min","reset":"Off","bytopic":"all","topic":"topic","outputs":1,"x":560,"y":250,"wires":[["32f399696e69cabe"]]},{"id":"32f399696e69cabe","type":"api-call-service","z":"8673e30f.fb9b4","name":"Ford Refresh","server":"df9a019b.0518b","version":5,"debugenabled":false,"domain":"fordpass","service":"refresh_status","areaId":[],"deviceId":[],"entityId":[],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":550,"y":290,"wires":[["834e5742fe22dab2"]]},{"id":"eba2a8cce5ed34f8","type":"api-current-state","z":"8673e30f.fb9b4","name":"ODO Reading","server":"df9a019b.0518b","version":3,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","entity_id":"sensor.fordpass_odometer","state_type":"num","blockInputOverrides":false,"outputProperties":[{"property":"start_odo","propertyType":"msg","value":"","valueType":"entityState"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":570,"y":170,"wires":[["6f1d245538571712"]]},{"id":"6f1d245538571712","type":"ha-wait-until","z":"8673e30f.fb9b4","name":"Wait","server":"df9a019b.0518b","version":1,"outputs":1,"entityId":"sensor.fordpass_ignition_status","entityIdFilterType":"exact","property":"state","comparator":"is","value":"Off","valueType":"str","timeout":"","timeoutType":"num","timeoutUnits":"seconds","entityLocation":"data","entityLocationType":"none","checkCurrentState":true,"blockInputOverrides":true,"x":750,"y":170,"wires":[["2fd0c8c47d655072"]]},{"id":"2fd0c8c47d655072","type":"api-current-state","z":"8673e30f.fb9b4","name":"ODO Reading","server":"df9a019b.0518b","version":3,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","entity_id":"sensor.fordpass_odometer","state_type":"num","blockInputOverrides":false,"outputProperties":[{"property":"end_odo","propertyType":"msg","value":"$sum($number($entities(\"sensor.fordpass_odometer\").state) - $.start_odo)","valueType":"jsonata"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":920,"y":170,"wires":[["28e8cd08cd8aa253"]]},{"id":"ef18aadc28abb60f","type":"api-call-service","z":"8673e30f.fb9b4","name":"Notify Phone","server":"df9a019b.0518b","version":5,"debugenabled":false,"domain":"notify","service":"mobile_app_m_iphone","areaId":[],"deviceId":[],"entityId":[],"data":"{\"message\":\"Your trip was {{end_odo}} miles!\",\"title\":\"Your Trip Results\"}","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1130,"y":220,"wires":[[]]},{"id":"28e8cd08cd8aa253","type":"switch","z":"8673e30f.fb9b4","name":"Result Validate","property":"end_odo","propertyType":"msg","rules":[{"t":"gt","v":"0","vt":"num"}],"checkall":"true","repair":false,"outputs":1,"x":1130,"y":170,"wires":[["ef18aadc28abb60f"]]},{"id":"6661b045f64bf0e0","type":"inject","z":"8673e30f.fb9b4","name":"Test (Ignition On)","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"Run","payloadType":"str","x":200,"y":260,"wires":[["8e637a32a2637047"]]},{"id":"df9a019b.0518b","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}]

[{"id":"9c29318d45e234ba","type":"inject","z":"8673e30f.fb9b4","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":172,"y":480,"wires":[["5aee6097fd480530"]]},{"id":"5aee6097fd480530","type":"api-current-state","z":"8673e30f.fb9b4","name":"start of trip car sensors","server":"","version":3,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","entity_id":"sensor.sensor1","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"start_sensor1","propertyType":"msg","value":"","valueType":"entityState"},{"property":"start_sensor2","propertyType":"msg","value":"$number($entities(\"sensor.sensor2\").state)","valueType":"jsonata"},{"property":"start_sensor3","propertyType":"msg","value":"$number($entities(\"sensor.sensor3\").state)","valueType":"jsonata"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":372,"y":480,"wires":[["bf3d24a515bcb3c6"]]},{"id":"bf3d24a515bcb3c6","type":"ha-wait-until","z":"8673e30f.fb9b4","name":"Wait","server":"","version":1,"outputs":1,"entityId":"sensor.fordpass_ignition_status","entityIdFilterType":"exact","property":"state","comparator":"is","value":"Off","valueType":"str","timeout":"","timeoutType":"num","timeoutUnits":"seconds","entityLocation":"data","entityLocationType":"none","checkCurrentState":true,"blockInputOverrides":true,"x":558,"y":480,"wires":[["499ed6c7e8a51af4"]]},{"id":"499ed6c7e8a51af4","type":"api-current-state","z":"8673e30f.fb9b4","name":"end of trip car sensors","server":"","version":3,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","entity_id":"sensor.sensor1","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"sensor1","propertyType":"msg","value":"start_sensor1 - $number($entity().state)","valueType":"jsonata"},{"property":"sensor2","propertyType":"msg","value":"start_sensor2 - $number($entities(\"sensor.sensor2\").state)","valueType":"jsonata"},{"property":"sensor3","propertyType":"msg","value":"start_sensor3 - $number($entities(\"sensor.sensor3\").state)","valueType":"jsonata"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":740,"y":480,"wires":[["80e6b35d3d5b6859"]]},{"id":"80e6b35d3d5b6859","type":"switch","z":"8673e30f.fb9b4","name":"Result Validate","property":"end_odo","propertyType":"msg","rules":[{"t":"gt","v":"0","vt":"num"}],"checkall":"true","repair":false,"outputs":1,"x":944,"y":480,"wires":[["152ccf7b26b8b76c"]]},{"id":"152ccf7b26b8b76c","type":"debug","z":"8673e30f.fb9b4","name":"notify","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1102,"y":480,"wires":[]}]

Thank you Kermit - I can’t believe all this time I missed the “Add” button at the bottom :man_facepalming:

Appreciate the assistance!