Firstly, thank you SO much for going through this. Everything you’re providing (custom) is amazing. It will probably take me… idk weeks or months to fully internalize it all haha. Nonetheless, it will be a valuable reference for me, thanks (and hopefully for anyone else who comes here later) and I feel Time is our most valuable commodity, so I thank you for yours.
I tweaked the current_state nodes with State Type to number and output properties etc like your example and removed the .value in his function and got it “working” now so it passes through to the next area of the flow. I’m getting the dewpoint through the Function which was the original ask in this thread so thanks. My main challenges now appear to be putting Home Assistant entity state and action nodes in place of his Hubitat nodes that check the state of and modify his HVAC thermostat
I am in the UK hence Celsius
Celsius? ew, gross (JK, understood. i think at least one of my sensors reports in C so i’ll need to maybe tackle something with that eventually as well)
I don’t have the time and patience to hand type your function node from a picture
BTW, Here’s the whole flow I’m working with that includes mostly his flow. He has some comment nodes, so maybe seeing it would help give some insight to why he designed it this way
[{"id":"6f7419f5ff19fe94","type":"tab","label":"Flow 2","disabled":false,"info":""},{"id":"d08b7c923494f3f9","type":"function","z":"6f7419f5ff19fe94","name":"Dew-point calculator","func":"function f2c(F) {\nvar C = 5 * ((F-32)/9);\nreturn C;\n}\nfunction dpC(T,RH) {\nvar Td = 243.04 * (Math.log(RH/100)+((17.625*T)/(243.04+T)))/(17.625-Math.log(RH/100)-((17.625*T)/(243.04+T)));\nreturn Td;\n}\nfunction c2f(C) {\nvar F = parseFloat((32 + (9*(C/5))).toFixed(2));\nreturn F;\n}\nvar tempf = msg.payload.temperature;\nvar rel_hum = msg.payload.humidity;\nvar tempc = f2c(tempf);\nvar dewpointc = dpC(tempc,rel_hum);\nmsg.payload = c2f(dewpointc);\nmsg.topic = \"dewpoint\";\nreturn msg;","outputs":1,"timeout":"","noerr":0,"initialize":"","finalize":"","libs":[],"x":1020,"y":400,"wires":[["ec3316c8e6a0bb27"]]},{"id":"ec3316c8e6a0bb27","type":"rbe","z":"6f7419f5ff19fe94","name":"","func":"rbe","gap":"","start":"","inout":"out","property":"payload","x":1165,"y":400,"wires":[["9cb9482b5b22bc69","d5f1d5bc6ff1753a","aa608f7d118740a0"]],"l":false},{"id":"9cb9482b5b22bc69","type":"mqtt out","z":"6f7419f5ff19fe94","name":"Indoor Dewpoint","topic":"dewpoint","qos":"2","retain":"true","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"40144fb8.a1c1e","x":1320,"y":400,"wires":[]},{"id":"3280f38a9bc33e04","type":"comment","z":"6f7419f5ff19fe94","name":"Using cron, calculate the current dew-point (flow.dewpoint) every minute","info":"","x":310,"y":320,"wires":[]},{"id":"d0d209f747b61e3d","type":"mqtt in","z":"6f7419f5ff19fe94","name":"Indoor Dewpoint","topic":"dewpoint","qos":"2","datatype":"auto","broker":"40144fb8.a1c1e","inputs":0,"x":120,"y":620,"wires":[["f183971c76265fd8","099a2079d8cb7081"]]},{"id":"fb4fd47f7ba4f84e","type":"switch","z":"6f7419f5ff19fe94","name":"cool only","property":"thermostat_mode","propertyType":"flow","rules":[{"t":"eq","v":"cool","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":480,"y":620,"wires":[["78a33abb18560a07"]]},{"id":"78a33abb18560a07","type":"switch","z":"6f7419f5ff19fe94","name":"dewpoint > Td","property":"dewpoint","propertyType":"flow","rules":[{"t":"gt","v":"Td","vt":"flow"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":660,"y":620,"wires":[["a8a48b96f5caac2b"],["fe7df28085cc524d"]]},{"id":"a8a48b96f5caac2b","type":"delay","z":"6f7419f5ff19fe94","name":"","pauseType":"delay","timeout":"1","timeoutUnits":"minutes","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"outputs":1,"x":835,"y":620,"wires":[["ca420f3621f55396"]],"l":false},{"id":"fe7df28085cc524d","type":"change","z":"6f7419f5ff19fe94","name":"reset","rules":[{"t":"set","p":"reset","pt":"msg","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":790,"y":680,"wires":[["a8a48b96f5caac2b"]]},{"id":"ca420f3621f55396","type":"switch","z":"6f7419f5ff19fe94","name":"thermostatOperatingState = idle","property":"thermostatOperatingState","propertyType":"flow","rules":[{"t":"eq","v":"idle","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":1030,"y":620,"wires":[["222d5f659d7aa019"]]},{"id":"222d5f659d7aa019","type":"delay","z":"6f7419f5ff19fe94","name":"","pauseType":"delay","timeout":"20","timeoutUnits":"seconds","rate":"1","nbRateUnits":"5","rateUnits":"minute","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":true,"outputs":1,"x":1215,"y":620,"wires":[["d0ca51800eb00a93"]],"l":false},{"id":"d0ca51800eb00a93","type":"change","z":"6f7419f5ff19fe94","name":"command = setCoolingSetpoint; msg.arguments = flow.thermostatTemp - 3","rules":[{"t":"set","p":"command","pt":"msg","to":"setCoolingSetpoint","tot":"str"},{"t":"set","p":"arguments","pt":"msg","to":"$flowContext(\"thermostatTemp\") - 3","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":1550,"y":620,"wires":[["8a7488e0749bb8b1"]]},{"id":"8a7488e0749bb8b1","type":"delay","z":"6f7419f5ff19fe94","name":"","pauseType":"delay","timeout":"2","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"outputs":1,"x":1875,"y":620,"wires":[["c44b1fe86429eb63"]],"l":false},{"id":"94af3707402283e7","type":"comment","z":"6f7419f5ff19fe94","name":"In cool mode, if the dewpoint is > flow.Td, and the thermostat operating state is idle, then setCoolingSetpoint to be 3 degrees less than the current thermostat temperature","info":"","x":610,"y":500,"wires":[]},{"id":"dbfb6df5b3850d2c","type":"comment","z":"6f7419f5ff19fe94","name":"On purpose, there is a 1 minute resetable delay between dewpoint > flow.td and proceeding with the sequence","info":"","x":420,"y":560,"wires":[]},{"id":"f183971c76265fd8","type":"change","z":"6f7419f5ff19fe94","name":"toNumber","rules":[{"t":"set","p":"payload","pt":"msg","to":"$number(payload)","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":310,"y":620,"wires":[["fb4fd47f7ba4f84e"]]},{"id":"a9fa4a5d2256af69","type":"switch","z":"6f7419f5ff19fe94","name":"cooling","property":"payload.value","propertyType":"msg","rules":[{"t":"eq","v":"cooling","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":320,"y":920,"wires":[["f41ecc8567d19bcf"]]},{"id":"261f3b2f1734164c","type":"switch","z":"6f7419f5ff19fe94","name":"msg.payload <= flow.Td","property":"payload","propertyType":"msg","rules":[{"t":"lte","v":"Td","vt":"flow"}],"checkall":"true","repair":false,"outputs":1,"x":990,"y":920,"wires":[["6fb9492389614d29"]]},{"id":"f41ecc8567d19bcf","type":"change","z":"6f7419f5ff19fe94","name":"payload = flow.dewpoint; payload = payload + 2.5","rules":[{"t":"set","p":"payload","pt":"msg","to":"dewpoint","tot":"flow"},{"t":"set","p":"payload","pt":"msg","to":"$number(payload) + 2.5","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":630,"y":920,"wires":[["d5b348cd23f79c1c","261f3b2f1734164c"]]},{"id":"d5b348cd23f79c1c","type":"delay","z":"6f7419f5ff19fe94","name":"1 min","pauseType":"delay","timeout":"1","timeoutUnits":"minutes","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"outputs":1,"x":450,"y":840,"wires":[["8f8ff053e1487800"]]},{"id":"8f8ff053e1487800","type":"switch","z":"6f7419f5ff19fe94","name":"thermostatOperatingState = cooling","property":"thermostatOperatingState","propertyType":"global","rules":[{"t":"eq","v":"cooling","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":690,"y":840,"wires":[["f41ecc8567d19bcf"]]},{"id":"d5f1d5bc6ff1753a","type":"change","z":"6f7419f5ff19fe94","name":"flow.dewpoint","rules":[{"t":"set","p":"dewpoint","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1320,"y":460,"wires":[["aa608f7d118740a0"]]},{"id":"6fb9492389614d29","type":"change","z":"6f7419f5ff19fe94","name":"command = setCoolingSetpoint; msg.arguments = flow.thermostatTemp + 3","rules":[{"t":"set","p":"command","pt":"msg","to":"setCoolingSetpoint","tot":"str"},{"t":"set","p":"arguments","pt":"msg","to":"$flowContext(\"thermostatTemp\") + 3","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":1410,"y":920,"wires":[["a56ba10e11fb111b"]]},{"id":"a56ba10e11fb111b","type":"delay","z":"6f7419f5ff19fe94","name":"","pauseType":"delay","timeout":"2","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"outputs":1,"x":1735,"y":920,"wires":[["d5659f38c2a90522"]],"l":false},{"id":"e594516cc2d95641","type":"comment","z":"6f7419f5ff19fe94","name":"Keep cooling until \"flow.dewpoint + 2.5\" <= flow.Td, then raise the thermostat temperature by 3 degrees to turn off cooling","info":"","x":460,"y":760,"wires":[]},{"id":"a3fcf96654c2b8fe","type":"change","z":"6f7419f5ff19fe94","name":"flow.Td=56.0 (Sleep)","rules":[{"t":"set","p":"Td","pt":"flow","to":"56","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":760,"y":120,"wires":[["fea3312c8047c6e0"]]},{"id":"6f258c2811e969bb","type":"change","z":"6f7419f5ff19fe94","name":"flow.Td=57.5 (Home)","rules":[{"t":"set","p":"Td","pt":"flow","to":"57.5","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":760,"y":180,"wires":[["fea3312c8047c6e0"]]},{"id":"8309f88bb4b738a8","type":"change","z":"6f7419f5ff19fe94","name":"flow.Td=61.0 (Away)","rules":[{"t":"set","p":"Td","pt":"flow","to":"61","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":760,"y":240,"wires":[["fea3312c8047c6e0"]]},{"id":"cdd8bd495864dc1d","type":"switch","z":"6f7419f5ff19fe94","name":"Sleep/Home/Away","property":"payload.value","propertyType":"msg","rules":[{"t":"eq","v":"sleep","vt":"str"},{"t":"eq","v":"home","vt":"str"},{"t":"eq","v":"away","vt":"str"}],"checkall":"true","repair":false,"outputs":3,"x":510,"y":200,"wires":[["a3fcf96654c2b8fe"],["6f258c2811e969bb"],["8309f88bb4b738a8"]]},{"id":"0b41f3fb9772a40d","type":"comment","z":"6f7419f5ff19fe94","name":"Set the desired dewpoint (flow.Td) based on Mode","info":"","x":250,"y":100,"wires":[]},{"id":"e8324d8f0f2ba42a","type":"hubitat device","z":"6f7419f5ff19fe94","name":"Honeywell T6 Pro","server":"662851c4.3ccad","deviceId":"3493","attribute":"thermostatOperatingState","sendEvent":true,"x":130,"y":920,"wires":[["a9fa4a5d2256af69"]]},{"id":"c44b1fe86429eb63","type":"hubitat command","z":"6f7419f5ff19fe94","deviceLabel":"Honeywell T6 Pro","name":"","server":"662851c4.3ccad","deviceId":"3493","command":"","commandArgs":"","x":2030,"y":620,"wires":[[]]},{"id":"d5659f38c2a90522","type":"api-call-service","z":"6f7419f5ff19fe94","name":"","server":"db91e348.88bee","version":7,"debugenabled":false,"action":"climate.set_hvac_mode","floorId":[],"areaId":[],"deviceId":[],"entityId":["climate.home"],"labelId":[],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","blockInputOverrides":true,"domain":"climate","service":"set_hvac_mode","x":1950,"y":920,"wires":[[]]},{"id":"inject","type":"inject","z":"6f7419f5ff19fe94","name":"Trigger","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":"","topic":"","payload":"74","payloadType":"num","x":230,"y":1140,"wires":[["03bbd9bc0c8fc05c"]]},{"id":"03bbd9bc0c8fc05c","type":"api-call-service","z":"6f7419f5ff19fe94","name":"","server":"db91e348.88bee","version":7,"debugenabled":false,"action":"climate.set_temperature","floorId":[],"areaId":[],"deviceId":[],"entityId":["climate.home"],"labelId":[],"data":"{\t \"target_temp_high\":76,\t \"target_temp_low\": 74\t}\t","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","blockInputOverrides":true,"domain":"climate","service":"set_temperature","x":510,"y":1140,"wires":[[]]},{"id":"53b8bc17ddb72516","type":"server-state-changed","z":"6f7419f5ff19fe94","name":"","server":"db91e348.88bee","version":6,"outputs":1,"exposeAsEntityConfig":"","entities":{"entity":["select.home_current_mode"],"substring":[],"regex":[]},"outputInitially":false,"stateType":"str","ifState":"","ifStateType":"str","ifStateOperator":"is","outputOnlyOnStateChange":false,"for":"0","forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":200,"y":240,"wires":[["cdd8bd495864dc1d","e66a9538690a282f"]]},{"id":"fea3312c8047c6e0","type":"debug","z":"6f7419f5ff19fe94","name":"debug 11","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1020,"y":160,"wires":[]},{"id":"9ed57a06e468a6c0","type":"api-current-state","z":"6f7419f5ff19fe94","name":"","server":"db91e348.88bee","version":3,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","entity_id":"sensor.sonoff_humidistat_temperature","state_type":"num","blockInputOverrides":true,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"topic","propertyType":"msg","value":"temperature","valueType":"str"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":460,"y":400,"wires":[["783151285da3a70a"]]},{"id":"9a30405301a428ad","type":"api-current-state","z":"6f7419f5ff19fe94","name":"","server":"db91e348.88bee","version":3,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","entity_id":"sensor.sonoff_humidistat_humidity","state_type":"num","blockInputOverrides":true,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"topic","propertyType":"msg","value":"humidity","valueType":"str"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":450,"y":440,"wires":[["83416fa2c1f2d3e8"]]},{"id":"83416fa2c1f2d3e8","type":"delay","z":"6f7419f5ff19fe94","name":"25ms","pauseType":"delay","timeout":"25","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"outputs":1,"x":695,"y":460,"wires":[["783151285da3a70a"]],"l":false},{"id":"2eaba0a5a127c8ad","type":"inject","z":"6f7419f5ff19fe94","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":120,"y":440,"wires":[["9ed57a06e468a6c0","9a30405301a428ad"]]},{"id":"099a2079d8cb7081","type":"debug","z":"6f7419f5ff19fe94","name":"debug 7","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":320,"y":700,"wires":[]},{"id":"66d1177a20fe4112","type":"cronplus","z":"6f7419f5ff19fe94","name":"","outputField":"payload","timeZone":"America/New_York","storeName":"","commandResponseMsgOutput":"output1","defaultLocation":"37.061977477860395 -76.49204134941101","defaultLocationType":"fixed","outputs":1,"options":[{"name":"schedule1","topic":"schedule1","payloadType":"bool","payload":"true","expressionType":"cron","expression":"0 * * * * *","location":"","offset":"0","solarType":"selected","solarEvents":"nauticalDusk"}],"x":100,"y":360,"wires":[["9ed57a06e468a6c0","9a30405301a428ad"]]},{"id":"93d36ca368db3d74","type":"join","z":"6f7419f5ff19fe94","name":"","mode":"custom","build":"object","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","useparts":false,"accumulate":false,"timeout":"","count":"2","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":670,"y":1780,"wires":[["9175f0e15d169c73"]]},{"id":"1e24d5e768f0d39d","type":"api-current-state","z":"6f7419f5ff19fe94","name":"Read Humidity","server":"db91e348.88bee","version":3,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","entity_id":"sensor.sonoff_humidistat_humidity","state_type":"num","blockInputOverrides":true,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"topic","propertyType":"msg","value":"humidity","valueType":"str"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":460,"y":1820,"wires":[["93d36ca368db3d74"]]},{"id":"60a07948b37e282d","type":"api-current-state","z":"6f7419f5ff19fe94","name":"Read Temperature","server":"db91e348.88bee","version":3,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","entity_id":"sensor.sonoff_humidistat_temperature","state_type":"num","blockInputOverrides":true,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"topic","propertyType":"msg","value":"temperature","valueType":"str"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":450,"y":1760,"wires":[["93d36ca368db3d74"]]},{"id":"0e462da6ad93ba6a","type":"debug","z":"6f7419f5ff19fe94","name":"debug 12","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1040,"y":1780,"wires":[]},{"id":"20f8e844d833efa9","type":"inject","z":"6f7419f5ff19fe94","name":"","props":[],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":250,"y":1800,"wires":[["60a07948b37e282d","1e24d5e768f0d39d"]]},{"id":"9175f0e15d169c73","type":"function","z":"6f7419f5ff19fe94","name":"function 2","func":"const temp = msg.payload.temperature;\nconst humy = msg.payload.humidity;\n\nconst dewp = 243.04 * (Math.log(humy / 100) + ((17.625 * temp) / (243.04 + temp))) / (17.625 - Math.log(humy / 100) - ((17.625 * temp) / (243.04 + temp)));\n\nmsg.payload.dewpoint = Math.round(dewp*10)/10;\n\nreturn msg;","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":860,"y":1780,"wires":[["0e462da6ad93ba6a"]]},{"id":"8ca55e572063a253","type":"change","z":"6f7419f5ff19fe94","name":"F2C","rules":[{"t":"set","p":"payload","pt":"msg","to":"(payload-32)/1.8","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":430,"y":1940,"wires":[["026dbbb0dee3629e","d0c871adba0f1f1d"]]},{"id":"d0c871adba0f1f1d","type":"change","z":"6f7419f5ff19fe94","name":"C2F","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload*1.8 + 32","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":730,"y":1940,"wires":[["de91414ef0d10570"]]},{"id":"825a11037274b942","type":"inject","z":"6f7419f5ff19fe94","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"72","payloadType":"num","x":250,"y":1940,"wires":[["8ca55e572063a253"]]},{"id":"026dbbb0dee3629e","type":"debug","z":"6f7419f5ff19fe94","name":"debug 13","active":true,"tosidebar":false,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":580,"y":1900,"wires":[]},{"id":"de91414ef0d10570","type":"debug","z":"6f7419f5ff19fe94","name":"debug 14","active":true,"tosidebar":false,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":900,"y":1900,"wires":[]},{"id":"422b33fc38d72d8c","type":"server-state-changed","z":"6f7419f5ff19fe94","name":"A change in T or H","server":"db91e348.88bee","version":6,"outputs":1,"exposeAsEntityConfig":"","entities":{"entity":["sensor.sonoff_humidistat_temperature","sensor.sonoff_humidistat_humidity"],"substring":[],"regex":[]},"outputInitially":true,"stateType":"num","ifState":"","ifStateType":"str","ifStateOperator":"is","outputOnlyOnStateChange":true,"for":"0","forType":"num","forUnits":"minutes","ignorePrevStateNull":true,"ignorePrevStateUnknown":true,"ignorePrevStateUnavailable":true,"ignoreCurrentStateUnknown":true,"ignoreCurrentStateUnavailable":true,"outputProperties":[{"property":"payload","propertyType":"msg","value":"(\t $this_entity:=$entity().entity_id~>$substringAfter(\"sensor_\");\t $this_state:=$entity().state~>$number();\t\t $other:= $this_entity=\"humidity\" ?\t $entities('sensor.temperature_and_humidity_sensor_temperature') :\t $entities('sensor.temperature_and_humidity_sensor_humidity');\t\t $other_entity:=$other.entity_id~>$substringAfter(\"sensor_\");\t $other_state:=$other.state~>$number();\t\t {$this_entity: $this_state, $other_entity: $other_state};\t\t)","valueType":"jsonata"}],"x":330,"y":2080,"wires":[["5625b94126a21314"]]},{"id":"7ebcf7384172b664","type":"debug","z":"6f7419f5ff19fe94","name":"Dew-Point","active":true,"tosidebar":false,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload.dewpoint","statusType":"msg","x":750,"y":2040,"wires":[]},{"id":"5625b94126a21314","type":"function","z":"6f7419f5ff19fe94","name":"function 3","func":"const temp = msg.payload.temperature;\nconst humy = msg.payload.humidity;\n\nconst dewp = 243.04 * (Math.log(humy / 100) + ((17.625 * temp) / (243.04 + temp))) / (17.625 - Math.log(humy / 100) - ((17.625 * temp) / (243.04 + temp)));\n\nmsg.payload.dewpoint = Math.round(dewp*10)/10;\n\nreturn msg;","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":560,"y":2080,"wires":[["7ebcf7384172b664"]]},{"id":"577a14aa57e178a2","type":"comment","z":"6f7419f5ff19fe94","name":"Everything below this is flows I've imported to fiddle around with and learn from and possibly move up into the original","info":"","x":430,"y":1060,"wires":[]},{"id":"783151285da3a70a","type":"join","z":"6f7419f5ff19fe94","name":"","mode":"custom","build":"object","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","useparts":false,"accumulate":false,"timeout":"","count":"2","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":830,"y":400,"wires":[["d08b7c923494f3f9"]]},{"id":"a4481fb014182de7","type":"api-call-service","z":"6f7419f5ff19fe94","name":"","server":"db91e348.88bee","version":7,"debugenabled":false,"action":"climate.set_temperature","floorId":[],"areaId":[],"deviceId":[],"entityId":["climate.home"],"labelId":[],"data":"{\t \"target_temp_high\":76,\t \"target_temp_low\": 74\t}\t","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","blockInputOverrides":true,"domain":"climate","service":"set_temperature","x":2050,"y":700,"wires":[[]]},{"id":"e3109eb05f64b920","type":"comment","z":"6f7419f5ff19fe94","name":"*Can't see what his Honeywell Hubitat node is doing here","info":"","x":2150,"y":580,"wires":[]},{"id":"cea2fe12e3fa0594","type":"comment","z":"6f7419f5ff19fe94","name":"*i need to swap in a Home Assistant version for my hvac","info":"","x":2140,"y":660,"wires":[]},{"id":"3d4e7b0a19894d5c","type":"comment","z":"6f7419f5ff19fe94","name":"*I'm open to the changed state node, but for now will keep his cron method","info":"","x":480,"y":360,"wires":[]},{"id":"380f9485deb5e7b7","type":"hubitat mode","z":"6f7419f5ff19fe94","name":"Mode","server":"5931aca0a5725c31","sendEvent":true,"x":250,"y":140,"wires":[[]]},{"id":"e66a9538690a282f","type":"debug","z":"6f7419f5ff19fe94","name":"debug 10","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":460,"y":140,"wires":[]},{"id":"f8d2f6e956c6ed38","type":"comment","z":"6f7419f5ff19fe94","name":"*Need to replace his \"Mode\" hubitat node","info":"","x":200,"y":200,"wires":[]},{"id":"aa608f7d118740a0","type":"debug","z":"6f7419f5ff19fe94","name":"debug 15","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1500,"y":460,"wires":[]},{"id":"5cbe81062e10711c","type":"comment","z":"6f7419f5ff19fe94","name":"*Need to replace his \"Honeywell\" hubitat node","info":"","x":190,"y":960,"wires":[]},{"id":"d8489b6c61fb83ce","type":"comment","z":"6f7419f5ff19fe94","name":"*Need to replace his \"Honeywell\" hubitat node","info":"","x":1990,"y":880,"wires":[]},{"id":"d628e941517bdb82","type":"hubitat command","z":"6f7419f5ff19fe94","deviceLabel":"Honeywell T6 Pro","name":"","server":"08dea297ac72227c","deviceId":"3493","command":"","commandArgs":"","x":1950,"y":840,"wires":[[]]},{"id":"361ee7d0f638c63e","type":"api-current-state","z":"6f7419f5ff19fe94","name":"","server":"db91e348.88bee","version":3,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","entity_id":"sensor.sonoff_humidistat_humidity","state_type":"num","blockInputOverrides":true,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"topic","propertyType":"msg","value":"humidity","valueType":"str"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":190,"y":1000,"wires":[[]]},{"id":"40144fb8.a1c1e","type":"mqtt-broker","name":"General","broker":"192.168.107.66","port":"1883","tls":"","clientid":"","autoConnect":true,"usetls":false,"compatmode":false,"protocolVersion":4,"keepalive":"15","cleansession":true,"autoUnsubscribe":true,"birthTopic":"","birthQos":"0","birthRetain":"false","birthPayload":"","birthMsg":{},"closeTopic":"","closeRetain":"false","closePayload":"","closeMsg":{},"willTopic":"","willQos":"0","willRetain":"false","willPayload":"","willMsg":{},"userProps":"","sessionExpiry":""},{"id":"db91e348.88bee","type":"server","name":"Home Assistant1","addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"","connectionDelay":false,"cacheJson":false,"heartbeat":false,"heartbeatInterval":"","statusSeparator":"","enableGlobalContextStore":false},{"id":"5931aca0a5725c31","type":"hubitat config","name":"HubitatM","usetls":false,"host":"192.168.1.46","port":"80","appId":"1522","nodeRedServer":"http://192.168.1.4:1880","webhookPath":"/hubitat/webhook","autoRefresh":true,"useWebsocket":false,"colorEnabled":true,"color":"#5dd049"},{"id":"08dea297ac72227c","type":"hubitat config","name":"HubitatS","usetls":false,"host":"192.168.1.36","port":"80","appId":"4489","nodeRedServer":"http://192.168.1.4:1880","webhookPath":"/hubitat/webhook2","autoRefresh":true,"useWebsocket":false,"colorEnabled":true,"color":"#51b8f0"}]
I imported your code to test quickly before going to work
(after swapping in my entities) it mostly worked, except the last debug also shows NaN
Do I really want to trigger this every minutes?
No - only when either the temp or the humidity changes. So I use an Events: state node, with both sensors, and then this will fire when either changes value.
yeah, idk that it really needs to be done every minute, probably a state_changed node would be fine, but maybe the Hubitat nodes don’t have something like the Event:state Home Assistant changed Node, as if you look in the flow i just sent, he had a filter after the Function that says “block unless value changes” so maybe that’s how he has to monitor a state change with Hubitat and NR…
But I was already poking around at using a state changed node elsewhere;
in the flow i was attempting to swap in a state changed node for his Hubitat node which tries to Set a “flow.Td” (Node-red variable?) depending on the Home/Sleep/Away “mode” of the HVAC, but I’ve had issues with that as well, as I need to access these HA Entity attributes somehow (from my Ecobee Thermostat entity), I can see the attributes in the Developer Tools, but they aren’t found as an Entity in Node-Red, so i’ll need to figure out how to get that attribute in the Events:state node
I did find out I can’t modify the Home/Away/Sleep mode on an Ecobee Thermostat (github thread) but i would think I could read the states from the attributes at least.
I know that the test i did in the flow down near the bottom that uses JSONata (i stumbled on that somewhere):
worked for modifying my thermostat target temperate range but i’m not sure how to read in the “hvac_modes” attribute from the current state node. Would that be done with JSONata also?