[{"id":"d04e4f6f0c28aa37","type":"tab","label":"Flow 1","disabled":false,"info":"","env":[]},{"id":"31bf457ce7770cb4","type":"api-current-state","z":"d04e4f6f0c28aa37","name":"Garage temp1","server":"ab3e2c53.e3491","version":3,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","entity_id":"sensor.temperature_garage","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":380,"y":375,"wires":[[]]},{"id":"8f8ec292d5cb1e35","type":"api-current-state","z":"d04e4f6f0c28aa37","name":"Garage temp2","server":"ab3e2c53.e3491","version":3,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","entity_id":"sensor.temperature_garage_2","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":380,"y":435,"wires":[[]]},{"id":"f04687f13ea21b69","type":"inject","z":"d04e4f6f0c28aa37","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":195,"y":405,"wires":[["31bf457ce7770cb4","8f8ec292d5cb1e35"]]},{"id":"9974e0f5cdd0f7d0","type":"comment","z":"d04e4f6f0c28aa37","name":"I would like temp1 and temp2 to be compared, if they are more than 3 degrees different, alert me","info":"","x":465,"y":315,"wires":[]},{"id":"04ee3b3afb1cb6af","type":"api-call-service","z":"d04e4f6f0c28aa37","name":"Alert Jim.","server":"ab3e2c53.e3491","version":5,"debugenabled":false,"domain":"notify","service":"notify_jim","areaId":[],"deviceId":[],"entityId":[],"data":"{\"title\":\"Garage temp sensors do not agree\",\"message\":\"Garage temp sensors do not agree. Please check them.\",\"data\":{\"color\":\"red\",\"clickAction\":\"/lovelace/1\"}}","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":750,"y":405,"wires":[[]]},{"id":"d020b6e81c9c520f","type":"function","z":"d04e4f6f0c28aa37","name":"????","func":"\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":565,"y":405,"wires":[[]]},{"id":"f4359f7afee77083","type":"api-current-state","z":"d04e4f6f0c28aa37","name":"Garage temp1","server":"ab3e2c53.e3491","version":3,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","entity_id":"sensor.temperature_garage","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":370,"y":630,"wires":[[]]},{"id":"027b80529928f841","type":"api-current-state","z":"d04e4f6f0c28aa37","name":"Garage temp2","server":"ab3e2c53.e3491","version":3,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","entity_id":"sensor.temperature_garage_2","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":370,"y":690,"wires":[[]]},{"id":"68440bc92aeee2f9","type":"inject","z":"d04e4f6f0c28aa37","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":185,"y":660,"wires":[["f4359f7afee77083","027b80529928f841"]]},{"id":"47944d98fa6accaa","type":"comment","z":"d04e4f6f0c28aa37","name":"I would like temp1 and temp2 to be averaged and written to a global variable","info":"","x":395,"y":570,"wires":[]},{"id":"bd998ba21c3bc416","type":"function","z":"d04e4f6f0c28aa37","name":"????","func":"\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":555,"y":660,"wires":[[]]},{"id":"b887ee91d3659ffd","type":"change","z":"d04e4f6f0c28aa37","name":"Set msg.payload to global average_temp","rules":[{"t":"set","p":"payload","pt":"msg","to":"average_temp","tot":"global"}],"action":"","property":"","from":"","to":"","reg":false,"x":850,"y":660,"wires":[[]]},{"id":"ab3e2c53.e3491","type":"server","name":"AvilaSmartHome","version":5,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true,"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}]
I have 2 temp sensors in garage. I would like them compared and if they differ more than 3 deg, to get an alert. I know I need a function node, just dont know what the heck to put in it.
Also with those same 2 sensors, I would like to average them out and write it to a variable.