edterbak / NodeRed_Heishamon_control

a Node Red flow to interact with Heishamon (a panasonic heatpump through an ESP board)
37 stars 7 forks source link

[ENHANCEMENT]:After "Force DHW" returns to "Heating only" (using Node Red automation) #116

Closed omenukas closed 1 year ago

omenukas commented 1 year ago

I wanted to make an automation in node-red so that towards the evening, while the sun is still shining and the solar power plant is still producing electricity, the heat pump will heat the water. The script activates "Force DHW" in the heat pump, but returns to "Heating only" when finished (now in summer the pump is always set to "DHW only"). The solar power plant works independently, it is not connected to the heat pump and only the script controls the pump according to the sensor of the solar power plant. Maybe this place can be fixed to return to the previous mode after Force DHW?

My NR automation: image

image image

[ { "id": "4f9de715706534c6", "type": "group", "z": "d87358901475fd9b", "name": "Vandens šilymas, esant saulės gamybai", "style": { "stroke": "#000000", "fill": "#ffefbf", "label": true, "color": "#3f3f3f" }, "nodes": [ "eea2e7ec184bd195", "907b5af903183046", "ea157cc9754bdf0e" ], "x": 54, "y": 1439, "w": 652, "h": 82 }, { "id": "eea2e7ec184bd195", "type": "api-call-service", "z": "d87358901475fd9b", "g": "4f9de715706534c6", "name": "Vandens šildymas", "server": "2a918914.4c7ed6", "version": 5, "debugenabled": false, "domain": "switch", "service": "turn_on", "areaId": [], "deviceId": [], "entityId": [ "switch.panasonic_heat_pump_main_force_dhw_state" ], "data": "", "dataType": "jsonata", "mergeContext": "", "mustacheAltTags": false, "outputProperties": [], "queue": "none", "x": 590, "y": 1480, "wires": [ [] ] }, { "id": "907b5af903183046", "type": "time-range-switch", "z": "d87358901475fd9b", "g": "4f9de715706534c6", "name": "", "lat": "", "lon": "", "startTime": "17:00", "endTime": "17:20", "startOffset": 0, "endOffset": 0, "x": 370, "y": 1480, "wires": [ [ "eea2e7ec184bd195" ], [] ] }, { "id": "ea157cc9754bdf0e", "type": "server-state-changed", "z": "d87358901475fd9b", "g": "4f9de715706534c6", "name": "Solis Power", "server": "2a918914.4c7ed6", "version": 4, "exposeToHomeAssistant": false, "haConfig": [ { "property": "name", "value": "" }, { "property": "icon", "value": "" } ], "entityidfilter": "sensor.solis_ac_output_total_power", "entityidfiltertype": "exact", "outputinitially": false, "state_type": "str", "haltifstate": "4000", "halt_if_type": "num", "halt_if_compare": "gt", "outputs": 2, "output_only_on_state_change": true, "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": 150, "y": 1480, "wires": [ [ "907b5af903183046" ], [] ] }, { "id": "2a918914.4c7ed6", "type": "server", "name": "Home Assistant", "addon": true } ]

edterbak commented 1 year ago

Hi, thanks. Now I see more what you are doing, and this indeed will not work.

Can you try this instead:

[
    {
        "id": "4f9de715706534c6",
        "type": "group",
        "z": "e5a14bb48ca6d5e3",
        "name": "Vandens šilymas, esant saulės gamybai",
        "style": {
            "stroke": "#000000",
            "fill": "#ffefbf",
            "label": true,
            "color": "#3f3f3f"
        },
        "nodes": [
            "907b5af903183046",
            "ea157cc9754bdf0e",
            "ccb826efbacb5f24",
            "71d42304a3bcc09a"
        ],
        "x": 254,
        "y": 179,
        "w": 662,
        "h": 82
    },
    {
        "id": "907b5af903183046",
        "type": "time-range-switch",
        "z": "e5a14bb48ca6d5e3",
        "g": "4f9de715706534c6",
        "name": "",
        "lat": "",
        "lon": "",
        "startTime": "17:00",
        "endTime": "17:20",
        "startOffset": 0,
        "endOffset": 0,
        "x": 570,
        "y": 220,
        "wires": [
            [
                "ccb826efbacb5f24"
            ],
            []
        ]
    },
    {
        "id": "ea157cc9754bdf0e",
        "type": "server-state-changed",
        "z": "e5a14bb48ca6d5e3",
        "g": "4f9de715706534c6",
        "name": "Solis Power",
        "server": "2a918914.4c7ed6",
        "version": 4,
        "exposeToHomeAssistant": false,
        "haConfig": [
            {
                "property": "name",
                "value": ""
            },
            {
                "property": "icon",
                "value": ""
            }
        ],
        "entityidfilter": "sensor.solis_ac_output_total_power",
        "entityidfiltertype": "exact",
        "outputinitially": false,
        "state_type": "str",
        "haltifstate": "4000",
        "halt_if_type": "num",
        "halt_if_compare": "gt",
        "outputs": 2,
        "output_only_on_state_change": true,
        "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": 350,
        "y": 220,
        "wires": [
            [
                "907b5af903183046"
            ],
            []
        ]
    },
    {
        "id": "ccb826efbacb5f24",
        "type": "function",
        "z": "e5a14bb48ca6d5e3",
        "g": "4f9de715706534c6",
        "name": "function 29",
        "func": "let msg1={};\nmsg1.payload = 1;\nmsg1.topic = \"DHW\";\nmsg1.force = 1;\n\n\nreturn msg1;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 750,
        "y": 220,
        "wires": [
            [
                "71d42304a3bcc09a"
            ]
        ]
    },
    {
        "id": "71d42304a3bcc09a",
        "type": "link out",
        "z": "e5a14bb48ca6d5e3",
        "g": "4f9de715706534c6",
        "name": "link out 61",
        "mode": "link",
        "links": [
            "8c9808071334d371"
        ],
        "x": 875,
        "y": 220,
        "wires": []
    },
    {
        "id": "2a918914.4c7ed6",
        "type": "server",
        "name": "Home Assistant",
        "addon": true
    }
]
edterbak commented 1 year ago

Also, be aware that you are still usging Home Assistant to control your heatpump. This will be conflicting with NodeRed. You can expect issues.

My advice is to disable all automations inside home assistant for the heishamon

omenukas commented 1 year ago

Thanks for the script. Cloudy today, it didn't meet the conditions and didn't start the water heating. I will try tomorrow. I haven't done any automation related to Heishamon and the heat pump in Home Assistant..

edterbak commented 1 year ago

Thanks for the script. Cloudy today, it didn't meet the conditions and didn't start the water heating. I will try tomorrow. I haven't done any automation related to Heishamon and the heat pump in Home Assistant..

You don't need to create an automation yourself. If you download the package for heishamon into the folder.. you have the automation. Example this. https://github.com/Egyras/HeishaMon/tree/master/Integrations/Home%20Assistant

Go and check the automations tab in HA, and disable all automations. If they are active, you will have conflicts and irratic behaviour.

omenukas commented 1 year ago

Thanks for the script. Cloudy today, it didn't meet the conditions and didn't start the water heating. I will try tomorrow. I haven't done any automation related to Heishamon and the heat pump in Home Assistant..

You don't need to create an automation yourself. If you download the package for heishamon into the folder.. you have the automation. Example this. https://github.com/Egyras/HeishaMon/tree/master/Integrations/Home%20Assistant

Go and check the automations tab in HA, and disable all automations. If they are active, you will have conflicts and irratic behaviour.

I don't even have a /config/packages folder created.

edterbak commented 1 year ago

I think you are ok then. I have seen too many issues which were a result of this home assistant trying to controle the pump too. Beter save them sorry to check extra :)

omenukas commented 1 year ago

I've tried your improved script, but it doesn't start DHW preparation at all. I turned on the debug for each step of the script and you can see that the function 31 in the node is broadcasting "DHW 1", but the heat pump does not start heating the water.

image

edterbak commented 1 year ago

Can you see the functio node is still connected to the link-in pin on the Scheduler tab? image

It should be this one image

omenukas commented 1 year ago

Yes, connected: image image

omenukas commented 1 year ago

Maybe it help you: image

edterbak commented 1 year ago

crazy part is that it work for me. When I add all the debug nodes behind the function schedule, I see this. image

Which is as I expected myself.

Here is the code of the nodes I used above.

[
    {
        "id": "4f9de715706534c6",
        "type": "group",
        "z": "35d210f042827344",
        "name": "Vandens šilymas, esant saulės gamybai",
        "style": {
            "stroke": "#000000",
            "fill": "#ffefbf",
            "label": true,
            "color": "#3f3f3f"
        },
        "nodes": [
            "907b5af903183046",
            "ea157cc9754bdf0e",
            "ccb826efbacb5f24",
            "71d42304a3bcc09a"
        ],
        "x": 614,
        "y": 2059,
        "w": 662,
        "h": 82
    },
    {
        "id": "907b5af903183046",
        "type": "time-range-switch",
        "z": "35d210f042827344",
        "g": "4f9de715706534c6",
        "name": "",
        "lat": "",
        "lon": "",
        "startTime": "17:00",
        "endTime": "17:20",
        "startOffset": 0,
        "endOffset": 0,
        "x": 930,
        "y": 2100,
        "wires": [
            [
                "ccb826efbacb5f24"
            ],
            []
        ]
    },
    {
        "id": "ea157cc9754bdf0e",
        "type": "server-state-changed",
        "z": "35d210f042827344",
        "g": "4f9de715706534c6",
        "name": "Solis Power",
        "server": "2a918914.4c7ed6",
        "version": 4,
        "exposeToHomeAssistant": false,
        "haConfig": [
            {
                "property": "name",
                "value": ""
            },
            {
                "property": "icon",
                "value": ""
            }
        ],
        "entityidfilter": "sensor.solis_ac_output_total_power",
        "entityidfiltertype": "exact",
        "outputinitially": false,
        "state_type": "str",
        "haltifstate": "4000",
        "halt_if_type": "num",
        "halt_if_compare": "gt",
        "outputs": 2,
        "output_only_on_state_change": true,
        "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": 710,
        "y": 2100,
        "wires": [
            [
                "907b5af903183046"
            ],
            []
        ]
    },
    {
        "id": "ccb826efbacb5f24",
        "type": "function",
        "z": "35d210f042827344",
        "g": "4f9de715706534c6",
        "name": "function 29",
        "func": "let msg1={};\nmsg1.payload = 1;\nmsg1.topic = \"DHW\";\nmsg1.force = 1;\n\n\nreturn msg1;\n",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 1110,
        "y": 2100,
        "wires": [
            [
                "71d42304a3bcc09a"
            ]
        ]
    },
    {
        "id": "71d42304a3bcc09a",
        "type": "link out",
        "z": "35d210f042827344",
        "g": "4f9de715706534c6",
        "name": "link out 61",
        "mode": "link",
        "links": [
            "8c9808071334d371"
        ],
        "x": 1235,
        "y": 2100,
        "wires": []
    },
    {
        "id": "2a918914.4c7ed6",
        "type": "server",
        "name": "Home Assistant",
        "addon": true
    }
]
omenukas commented 1 year ago

I have the same code, but for some reason it doesn't work. Maybe some additional settings are needed in the Heishamon dashboard?

edterbak commented 1 year ago

Nah, it should not be because of something in the heisamon. It is flow related.

Can you see if there is a value in the variable [F_stored_next_operating_mode] ? its in global store If so, can you remove it and try again?

second question. What version of the flow are you using. I just published v23.03, which improves the cool-functionalty part.

omenukas commented 1 year ago

Yes!!! The code works. After updating to the latest version, everything started working. Thank you very much!!

edterbak commented 1 year ago

Good to hear. Enjoy the heat pump :)