Hi all,
Trying to do something similar - the above has been really helpful and I’ve actually found two slightly different ways of doing it which I’m keeping in my back pocket
So I have the comparison working, but what I really would like to do is actually output the differential between the two values on the payload…
Ignoring the code in the custome message box (as it’s psuedo guff at the moment as a placeholder for what I want to do), I assume/hope/maybe think that since it’s already comparing it is possible to take the two values (entity.state and state of other sensor) to output on the message?
Can anyone advise how I might do this?
EDIT: Also, fwiw I do have a working version of this, but I was just trying to clean it up… here is the working version:
[{"id":"aeafd804e5662aa9","type":"debug","z":"df5b0eaf65475057","name":"debug 15","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":540,"y":660,"wires":[]},{"id":"ca2ed22e98ff14ee","type":"trigger-state","z":"df5b0eaf65475057","name":"Shower Room Humidity Changed and is > reference","server":"3aa13fed.bf745","version":2,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityid":"sensor.shower_room_sensor_humidity","entityidfiltertype":"exact","debugenabled":false,"constraints":[{"targetType":"entity_id","targetValue":"sensor.reference_landing_sensor_humidity","propertyType":"current_state","propertyValue":"new_state.state","comparatorType":"<","comparatorValueDatatype":"entity","comparatorValue":"state"}],"inputs":0,"outputs":2,"customoutputs":[],"outputinitially":false,"state_type":"num","enableInput":false,"x":230,"y":620,"wires":[["d61f40ad57792408","976301a2d4146ba9"],["aeafd804e5662aa9"]]},{"id":"d61f40ad57792408","type":"api-current-state","z":"df5b0eaf65475057","name":"Reference Humidity","server":"3aa13fed.bf745","version":3,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","entity_id":"sensor.reference_landing_sensor_humidity","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"},{"property":"topic","propertyType":"msg","value":"low","valueType":"str"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":550,"y":560,"wires":[["84e4b437d693d1ea"]]},{"id":"976301a2d4146ba9","type":"api-current-state","z":"df5b0eaf65475057","name":"Shower Room Humidity Value","server":"3aa13fed.bf745","version":3,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","entity_id":"sensor.shower_room_sensor_humidity","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"},{"property":"topic","propertyType":"msg","value":"high","valueType":"str"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":590,"y":600,"wires":[["84e4b437d693d1ea"]]},{"id":"95f4c30e81f9d06c","type":"function","z":"df5b0eaf65475057","name":"","func":"msg.topic = \"diff\";\nmsg.payload = msg.payload.high - msg.payload.low;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":880,"y":560,"wires":[["9ff78f5999eb3754"]]},{"id":"84e4b437d693d1ea","type":"join","z":"df5b0eaf65475057","name":"","mode":"custom","build":"object","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"","count":"2","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":750,"y":560,"wires":[["95f4c30e81f9d06c"]]},{"id":"9ff78f5999eb3754","type":"switch","z":"df5b0eaf65475057","name":">15","property":"payload","propertyType":"msg","rules":[{"t":"gt","v":"15","vt":"num"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":1010,"y":560,"wires":[["0a6943fbfc8ba808"],["fb7868f58d703110"]]},{"id":"fb7868f58d703110","type":"debug","z":"df5b0eaf65475057","name":"No need for Fan","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1180,"y":580,"wires":[]},{"id":"3aa13fed.bf745","type":"server","name":"Home Assistant","version":4,"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"}]