Hi! I’m sorry but the Node-RED flow has been quite neglected as I’ve moved the automations to the native HA interface, but for what it’s worth, here’s the JSON:
[{"id":"e1ad9d5c1595a613","type":"tab","label":"Heatpump Optimization","disabled":true,"info":"","env":[]},{"id":"d1ee5130eec5e32f","type":"debug","z":"e1ad9d5c1595a613","name":"dump msg object","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":830,"y":60,"wires":[]},{"id":"d4713e5bbb8e29ab","type":"api-current-state","z":"e1ad9d5c1595a613","name":"Nordpool API","server":"580d2bfb.cc52e4","version":3,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","entity_id":"sensor.nordpool_api","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":320,"y":60,"wires":[["74d424d0bccd401c","52c58f018a11461b"]]},{"id":"2b52c423c1fb6d17","type":"inject","z":"e1ad9d5c1595a613","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":100,"y":60,"wires":[["d4713e5bbb8e29ab"]]},{"id":"74d424d0bccd401c","type":"debug","z":"e1ad9d5c1595a613","name":"dump attributes.ee","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"data.attributes.ee","targetType":"msg","statusVal":"","statusType":"auto","x":570,"y":120,"wires":[]},{"id":"52c58f018a11461b","type":"function","z":"e1ad9d5c1595a613","name":"Set \"prices\" Flow object","func":"function convert_price_to_kwh(e) {\n return {\n timestamp: e.timestamp,\n price: e.price * 0.0012 // Convert MW to kW and add 20% VAT\n }\n}\n\nif(msg && msg.data && msg.data.attributes){\n const prices = msg.data.attributes.ee.map(convert_price_to_kwh);\n if (prices) {\n flow.set(\"prices\", prices);\n return prices;\n }\n}","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":590,"y":60,"wires":[["d1ee5130eec5e32f"]]},{"id":"bc9a19ddd23be41d","type":"api-call-service","z":"e1ad9d5c1595a613","name":"Heat Max","server":"580d2bfb.cc52e4","version":5,"debugenabled":false,"domain":"script","service":"heat_max","areaId":[],"deviceId":[],"entityId":[],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"Max Heat","valueType":"str"}],"queue":"none","x":480,"y":480,"wires":[["df2a1d4430402cd4"]]},{"id":"e4cf305cf274b4ba","type":"api-call-service","z":"e1ad9d5c1595a613","name":"Heat Min","server":"580d2bfb.cc52e4","version":5,"debugenabled":false,"domain":"script","service":"heat_min","areaId":[],"deviceId":[],"entityId":[],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":460,"y":820,"wires":[[]]},{"id":"e61544252173eefe","type":"api-call-service","z":"e1ad9d5c1595a613","name":"Heatpump off","server":"580d2bfb.cc52e4","version":5,"debugenabled":false,"domain":"input_select","service":"select_option","areaId":[],"deviceId":[],"entityId":["input_select.thermiq_mqtt_main_mode"],"data":"{\"option\": \"Off\"}","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"Off","valueType":"str"}],"queue":"none","x":500,"y":360,"wires":[["df2a1d4430402cd4"]]},{"id":"f90bc8f26cf7b3b1","type":"api-call-service","z":"e1ad9d5c1595a613","name":"Heatpump restore","server":"580d2bfb.cc52e4","version":5,"debugenabled":false,"domain":"input_select","service":"select_option","areaId":[],"deviceId":[],"entityId":["input_select.thermiq_mqtt_main_mode"],"data":"{\t \"option\": $flowContext('previous_thermiq_mqtt_main_mode')\t}","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"Restored","valueType":"str"}],"queue":"none","x":830,"y":520,"wires":[["9a95e35e920699b8","df2a1d4430402cd4"]]},{"id":"567f332e42b5a52c","type":"function","z":"e1ad9d5c1595a613","name":"Store previous ThermIQ Mode","func":"const mode = global.get(\"homeassistant.homeAssistant.states['input_select.thermiq_mqtt_main_mode'].state\");\nflow.set(\"previous_thermiq_mqtt_main_mode\", mode);\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":550,"y":420,"wires":[[]]},{"id":"eb5cec720daf93c2","type":"switch","z":"e1ad9d5c1595a613","name":"Previous ThermIQ Mode not empty","property":"previous_thermiq_mqtt_main_mode","propertyType":"flow","rules":[{"t":"nempty"},{"t":"eq","v":"Off","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":560,"y":540,"wires":[["f90bc8f26cf7b3b1"],["1db83c7bec7ba15b"]]},{"id":"9a95e35e920699b8","type":"function","z":"e1ad9d5c1595a613","name":"Clear previous ThermIQ Mode","func":"flow.set(\"previous_thermiq_mqtt_main_mode\");\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1110,"y":520,"wires":[[]]},{"id":"1db83c7bec7ba15b","type":"api-call-service","z":"e1ad9d5c1595a613","name":"Heatpump Auto","server":"580d2bfb.cc52e4","version":5,"debugenabled":false,"domain":"input_select","service":"select_option","areaId":[],"deviceId":[],"entityId":["input_select.thermiq_mqtt_main_mode"],"data":"{\"option\": \"Auto\"}","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"Auto","valueType":"str"}],"queue":"none","x":820,"y":580,"wires":[["df2a1d4430402cd4"]]},{"id":"df2a1d4430402cd4","type":"api-call-service","z":"e1ad9d5c1595a613","name":"Notify","server":"580d2bfb.cc52e4","version":5,"debugenabled":false,"domain":"notify","service":"mobile_app_galaxy_s10","areaId":[],"deviceId":[],"entityId":[],"data":"{\t \"title\": \"Heatpump optimization\",\t \"message\": \"Heating \" & payload & \". Nordpool €{{ states('sensor.nordpool_price') }}/kWh -> {{ states('input_select.thermiq_mqtt_main_mode') }} {{ states('input_number.thermiq_mqtt_indoor_requested_t') }}°C\",\t \"data\": {\t \"actions\": [\t {\t \"title\": \"Undo\",\t \"action\": \"HEATING_RESTORE\"\t },\t {\t \"title\": \"Heat settings\",\t \"action\": \"URI\",\t \"uri\": \"/lovelace/thermiq\"\t },\t {\t \"title\": \"View prices\",\t \"action\": \"URI\",\t \"uri\": \"entityId:sensor.nordpool_price\"\t }\t ]\t }\t}","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1050,"y":360,"wires":[[]]},{"id":"c2ac332fb3e71018","type":"server-state-changed","z":"e1ad9d5c1595a613","name":"price >= high_threshold","server":"580d2bfb.cc52e4","version":4,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"sensor.nordpool_price","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"$number($globalContext(\"homeassistant.homeAssistant.states['input_number.heating_electricity_high_price'].state\"))","halt_if_type":"jsonata","halt_if_compare":"gte","outputs":2,"output_only_on_state_change":true,"for":"0","forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":true,"ignoreCurrentStateUnavailable":true,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":140,"y":820,"wires":[[],[]]},{"id":"4710f3a3454a6d75","type":"server-state-changed","z":"e1ad9d5c1595a613","name":"price <= low_threshold","server":"580d2bfb.cc52e4","version":4,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"sensor.nordpool_price","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"$number($globalContext(\"homeassistant.homeAssistant.states['input_number.heating_electricity_low_price'].state\"))","halt_if_type":"jsonata","halt_if_compare":"lte","outputs":2,"output_only_on_state_change":true,"for":"0","forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":true,"ignoreCurrentStateUnavailable":true,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":140,"y":880,"wires":[[],[]]},{"id":"ed4f0d0d32594458","type":"trigger-state","z":"e1ad9d5c1595a613","name":"","server":"580d2bfb.cc52e4","version":2,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityid":"sensor.nordpool_price","entityidfiltertype":"exact","debugenabled":false,"constraints":[],"inputs":1,"outputs":6,"customoutputs":[{"messageType":"default","messageValue":"","messageValueType":"json","comparatorPropertyType":"current_state","comparatorPropertyValue":"new_state.state","comparatorType":">=","comparatorValue":"$number($globalContext(\"homeassistant.homeAssistant.states['input_number.heating_electricity_high_price'].state\"))","comparatorValueDataType":"jsonata"},{"messageType":"default","messageValue":"","messageValueType":"json","comparatorPropertyType":"current_state","comparatorPropertyValue":"new_state.state","comparatorType":"<","comparatorValue":"$number($globalContext(\"homeassistant.homeAssistant.states['input_number.heating_electricity_high_price'].state\"))","comparatorValueDataType":"str"},{"messageType":"default","messageValue":"","messageValueType":"json","comparatorPropertyType":"current_state","comparatorPropertyValue":"new_state.state","comparatorType":"<=","comparatorValue":"$number($globalContext(\"homeassistant.homeAssistant.states['input_number.heating_electricity_low_price'].state\"))","comparatorValueDataType":"jsonata"},{"messageType":"default","messageValue":"","messageValueType":"json","comparatorPropertyType":"current_state","comparatorPropertyValue":"new_state.state","comparatorType":">","comparatorValue":"$number($globalContext(\"homeassistant.homeAssistant.states['input_number.heating_electricity_low_price'].state\"))","comparatorValueDataType":"str"}],"outputinitially":true,"state_type":"num","enableInput":true,"x":180,"y":420,"wires":[[],[],["e61544252173eefe","567f332e42b5a52c"],[],["bc9a19ddd23be41d","567f332e42b5a52c"],[]]},{"id":"580d2bfb.cc52e4","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"}]