Thermostat subflow for mqtt based zwave

I have MQTT managed zwave. Specifically zwave2mqtt. And I love the structure.
Home assistant doesn't have a lot of features on scheduling. App demon and Schedy are ok but not user friendly

I wanted a reusable/repeatable flow in order to feed with info and change my TRV.

What I wanted to solve:

  1. Update TRV only when needed (set temp change)
  2. Get Feedback from TRV on room temp
  3. Weekly Schedule
  4. Automatically initiate countdown timer when user changes the valve

What is not working:

  1. keep all valves in sync when changing value through valve's interface (buttons)
[
    {
        "id": "6c5980ce.3bf92",
        "type": "subflow",
        "name": "Thermostat Flow",
        "info": "",
        "category": "",
        "in": [
            {
                "x": 40,
                "y": 180,
                "wires": [
                    {
                        "id": "c28153cd.23c79"
                    }
                ]
            }
        ],
        "out": [
            {
                "x": 1060,
                "y": 100,
                "wires": [
                    {
                        "id": "2889bfd9.acfaf",
                        "port": 0
                    }
                ]
            }
        ],
        "env": [],
        "color": "#DDAA99"
    },
    {
        "id": "3ec16cb2.ad6184",
        "type": "ui_heater_controller",
        "z": "6c5980ce.3bf92",
        "name": "Heater Hallway",
        "group": "fbed6f0b.6a621",
        "unit": "C",
        "order": 1,
        "width": 0,
        "height": 0,
        "topic": "",
        "title": "$(TRV_UI_TITLE)",
        "logLengthType": "days",
        "logLength": "0",
        "sliderMinValue": 12,
        "sliderMaxValue": 28,
        "sliderStep": 0.5,
        "thresholdRising": 0.5,
        "thresholdFalling": 0.5,
        "calendar": "$(SCHEDULE)",
        "x": 560,
        "y": 60,
        "wires": [
            [
                "6eab0d6c.49cab4",
                "85e8397c.17a368"
            ]
        ]
    },
    {
        "id": "6e78c0f.62b564",
        "type": "change",
        "z": "6c5980ce.3bf92",
        "name": "",
        "rules": [
            {
                "t": "set",
                "p": "topic",
                "pt": "msg",
                "to": "currentTemp",
                "tot": "str"
            },
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "#:(disk)::roomTemp",
                "tot": "flow"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 260,
        "y": 60,
        "wires": [
            [
                "3ec16cb2.ad6184"
            ]
        ]
    },
    {
        "id": "85e8397c.17a368",
        "type": "switch",
        "z": "6c5980ce.3bf92",
        "name": "",
        "property": "payload.targetValue",
        "propertyType": "msg",
        "rules": [
            {
                "t": "neq",
                "v": "currentSetTemp",
                "vt": "flow"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 1,
        "x": 730,
        "y": 20,
        "wires": [
            [
                "2889bfd9.acfaf"
            ]
        ]
    },
    {
        "id": "c7dc4c89.df946",
        "type": "change",
        "z": "6c5980ce.3bf92",
        "name": "",
        "rules": [
            {
                "t": "set",
                "p": "#:(disk)::currentSetTemp",
                "pt": "flow",
                "to": "payload.value",
                "tot": "msg"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 490,
        "y": 300,
        "wires": [
            []
        ]
    },
    {
        "id": "6eab0d6c.49cab4",
        "type": "change",
        "z": "6c5980ce.3bf92",
        "name": "",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "payload.targetValue",
                "tot": "msg"
            },
            {
                "t": "set",
                "p": "#:(disk)::changeTimestamp",
                "pt": "flow",
                "to": "",
                "tot": "date"
            },
            {
                "t": "set",
                "p": "#:(disk)::isUserCustom",
                "pt": "global",
                "to": "payload.isUserCustom",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 760,
        "y": 100,
        "wires": [
            []
        ]
    },
    {
        "id": "262b48a9.30a978",
        "type": "inject",
        "z": "6c5980ce.3bf92",
        "name": "",
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "repeat": "300",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "x": 190,
        "y": 360,
        "wires": [
            [
                "21a8456.e9a97ba"
            ]
        ]
    },
    {
        "id": "ec43a8d.79f1c58",
        "type": "switch",
        "z": "6c5980ce.3bf92",
        "name": "",
        "property": "($flowContext(\"changeTimestamp\", \"disk\") + ($globalContext(\"heatingDelay\", \"disk\")*(60*60*1000) )) < payload",
        "propertyType": "jsonata",
        "rules": [
            {
                "t": "true"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 1,
        "x": 490,
        "y": 360,
        "wires": [
            [
                "44183c92.48f004"
            ]
        ]
    },
    {
        "id": "21a8456.e9a97ba",
        "type": "switch",
        "z": "6c5980ce.3bf92",
        "name": "",
        "property": "#:(disk)::isUserCustom",
        "propertyType": "flow",
        "rules": [
            {
                "t": "true"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 1,
        "x": 350,
        "y": 360,
        "wires": [
            [
                "ec43a8d.79f1c58"
            ]
        ]
    },
    {
        "id": "44183c92.48f004",
        "type": "change",
        "z": "6c5980ce.3bf92",
        "name": "",
        "rules": [
            {
                "t": "set",
                "p": "topic",
                "pt": "msg",
                "to": "userConfig",
                "tot": "str"
            },
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "{ \"isUserCustom\": false }",
                "tot": "json"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 720,
        "y": 360,
        "wires": [
            [
                "f1a84f6f.64012"
            ]
        ]
    },
    {
        "id": "f1a84f6f.64012",
        "type": "link out",
        "z": "6c5980ce.3bf92",
        "name": "",
        "links": [
            "d4f7b6c2.ba47f8"
        ],
        "x": 835,
        "y": 280,
        "wires": []
    },
    {
        "id": "d4f7b6c2.ba47f8",
        "type": "link in",
        "z": "6c5980ce.3bf92",
        "name": "",
        "links": [
            "f1a84f6f.64012"
        ],
        "x": 415,
        "y": 80,
        "wires": [
            [
                "3ec16cb2.ad6184"
            ]
        ]
    },
    {
        "id": "2c915785.2cebd8",
        "type": "delay",
        "z": "6c5980ce.3bf92",
        "name": "",
        "pauseType": "delay",
        "timeout": "1",
        "timeoutUnits": "seconds",
        "rate": "1",
        "nbRateUnits": "1",
        "rateUnits": "second",
        "randomFirst": "1",
        "randomLast": "5",
        "randomUnits": "seconds",
        "drop": false,
        "x": 380,
        "y": 220,
        "wires": [
            [
                "c2a3dbd1.221678"
            ]
        ]
    },
    {
        "id": "c2a3dbd1.221678",
        "type": "function",
        "z": "6c5980ce.3bf92",
        "name": "",
        "func": "msg.topic = \"userConfig\"\nmsg.payload = {\"Temp\": msg.payload};\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "x": 600,
        "y": 220,
        "wires": [
            []
        ]
    },
    {
        "id": "2889bfd9.acfaf",
        "type": "change",
        "z": "6c5980ce.3bf92",
        "name": "",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "payload.targetValue",
                "tot": "msg"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 880,
        "y": 20,
        "wires": [
            []
        ]
    },
    {
        "id": "c28153cd.23c79",
        "type": "switch",
        "z": "6c5980ce.3bf92",
        "name": "Payload Routing",
        "property": "payload.class_id",
        "propertyType": "msg",
        "rules": [
            {
                "t": "eq",
                "v": "49",
                "vt": "str"
            },
            {
                "t": "eq",
                "v": "67",
                "vt": "str"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 2,
        "x": 160,
        "y": 180,
        "wires": [
            [
                "6e78c0f.62b564",
                "258bcd3a.80a202"
            ],
            [
                "2c915785.2cebd8",
                "c7dc4c89.df946"
            ]
        ]
    },
    {
        "id": "258bcd3a.80a202",
        "type": "change",
        "z": "6c5980ce.3bf92",
        "name": "",
        "rules": [
            {
                "t": "set",
                "p": "#:(disk)::roomTemp",
                "pt": "flow",
                "to": "payload.value",
                "tot": "msg"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 410,
        "y": 140,
        "wires": [
            []
        ]
    },
    {
        "id": "9bedb55b.394308",
        "type": "inject",
        "z": "6c5980ce.3bf92",
        "name": "",
        "topic": "currentTemp",
        "payload": "#:(disk)::roomTemp",
        "payloadType": "flow",
        "repeat": "",
        "crontab": "",
        "once": true,
        "onceDelay": "1",
        "x": 340,
        "y": 20,
        "wires": [
            [
                "3ec16cb2.ad6184"
            ]
        ]
    },
    {
        "id": "fbed6f0b.6a621",
        "type": "ui_group",
        "z": "",
        "name": "Heating",
        "tab": "dee0def.c82102",
        "order": 1,
        "disp": true,
        "width": "8",
        "collapse": false
    },
    {
        "id": "dee0def.c82102",
        "type": "ui_tab",
        "z": "",
        "name": "Main",
        "icon": "dashboard",
        "order": 1,
        "disabled": false,
        "hidden": false
    }
]

This topic was automatically closed after 60 days. New replies are no longer allowed.