Ghost Thermostat:Cant retain Target temp and state, reverts to defaulted values i cant seem to locate

update: mqqt bme280 in is working. but still have the stat reverting to a defaulted value. flow/code attached this time.

[
    {
        "id": "c69f4c874a69e46a",
        "type": "ui_ui_control",
        "z": "1fef5af48987e862",
        "name": "",
        "events": "all",
        "x": 3340,
        "y": 820,
        "wires": [
            [
                "441ee3605ebe21e9",
                "70892cf3a2425e65"
            ]
        ]
    },
    {
        "id": "0db49073c80b4848",
        "type": "function",
        "z": "1fef5af48987e862",
        "name": "target_temperature",
        "func": "msg.topic = 'target_temperature';\nvar data = {\n    'target_temperature':msg.payload   \n}\nmsg.payload = data;\nreturn msg;",
        "outputs": 1,
        "timeout": "",
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 2550,
        "y": 860,
        "wires": [
            [
                "b970206bd9e41276",
                "a03c9f54bdd84880"
            ]
        ]
    },
    {
        "id": "a0751344b25431c5",
        "type": "function",
        "z": "1fef5af48987e862",
        "name": "hvac_state",
        "func": "msg.topic = \"hvac_state\";\nglobal.set(\"hvac_state\",msg.payload);\nreturn msg;",
        "outputs": 1,
        "timeout": "",
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 2730,
        "y": 1180,
        "wires": [
            [
                "a03c9f54bdd84880",
                "8361cfb7b1422492"
            ]
        ]
    },
    {
        "id": "21089888fd1ad681",
        "type": "function",
        "z": "1fef5af48987e862",
        "name": "away",
        "func": "msg.topic = \"away\";\nglobal.set(\"away\", msg.payload);\nreturn msg;",
        "outputs": 1,
        "timeout": "",
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 2750,
        "y": 1220,
        "wires": [
            [
                "3679633df92d935f",
                "532c26de0efbdd5d",
                "789023cb7db45a79",
                "3a25b47ef744f5ed"
            ]
        ]
    },
    {
        "id": "a03c9f54bdd84880",
        "type": "function",
        "z": "1fef5af48987e862",
        "name": "Data",
        "func": "\nif (msg.topic == \"ambient_temperature\") {\n    global.set(\"ambient_temperature\", msg.payload.ambient_temperature);\n}\nmsg.topic = \"update\";\nvar data = {\n    'ambient_temperature': global.get(\"ambient_temperature\") || 72,\n    'target_temperature': global.get(\"target_temperature\") || 72,\n    'hvac_state': global.get(\"hvac_state\") || 'off',\n    'away': global.get(\"away\") || 'false'\n}\nmsg.payload = data;\nreturn msg;",
        "outputs": 1,
        "timeout": "",
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 2990,
        "y": 1060,
        "wires": [
            [
                "71daca0a0035395d",
                "441ee3605ebe21e9"
            ]
        ]
    },
    {
        "id": "8361cfb7b1422492",
        "type": "debug",
        "z": "1fef5af48987e862",
        "name": "debug 19",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 2720,
        "y": 1140,
        "wires": []
    },
    {
        "id": "b970206bd9e41276",
        "type": "debug",
        "z": "1fef5af48987e862",
        "d": true,
        "name": "debug 21",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 2560,
        "y": 820,
        "wires": []
    },
    {
        "id": "71daca0a0035395d",
        "type": "debug",
        "z": "1fef5af48987e862",
        "name": "debug 22",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 3040,
        "y": 960,
        "wires": []
    },
    {
        "id": "70892cf3a2425e65",
        "type": "debug",
        "z": "1fef5af48987e862",
        "name": "debug 24",
        "active": false,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 3340,
        "y": 780,
        "wires": []
    },
    {
        "id": "532c26de0efbdd5d",
        "type": "debug",
        "z": "1fef5af48987e862",
        "name": "debug 41",
        "active": false,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 3000,
        "y": 1220,
        "wires": []
    },
    {
        "id": "789023cb7db45a79",
        "type": "change",
        "z": "1fef5af48987e862",
        "name": "",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "true",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 2940,
        "y": 1180,
        "wires": [
            [
                "a03c9f54bdd84880"
            ]
        ]
    }
]

Good afternoon all, i have my flow operational and accepts all my data inputs and thermostat responds correctly turning on my pi relays. The issue im facing and can not seem to track down is that the stat reverts to 72* and "OFF" after about 30 seconds after changing via UI . debug changes to everything correctly until it reverts. i have debug nodes attached throughout. any help greatly appreciated. im still a new forum user so cant upload my flow.

I've updated your permission so you should be able to upload a flow.

BUT before you do, please create a small flow showing the issue and provide some more information

  • what version of NR an anode.js? (see NR startup log)
  • what device are you running NR on?

In order to make code readable and usable it is necessary to surround your code with three backticks (also known as a left quote or backquote ```)

``` 
   code goes here 
```

You can edit and correct your post by clicking the pencil :pencil2: icon.

See this post for more details - How to share code or flow json

It sounds like you are sending something to it every 30 seconds ?

Its a while since I set it up, but it may help if you send all values at once -

eg { 'ambient_temperature': xx , 'target_temperature':xx , 'mode': "OFF" , 'away': 'false' }

what im trying to achieve is keeping the target temp set from UI until changed again from UI, same for Mode. but after i change them from UI, They revert to off and either a defaulted value of 72 because nothing is found, or a 68 if i manually inject. my ambient temp payload is in the same format being sent to a data function before the stat, and it is correct and stays. so im lost as to why the mode and target temp revert.

You need to store the output from the stat, and then feed all values back in, even if you only what to change one of them, as the template doesn't remember the settings I don't think. So any missing values will likely switch to default.

i.e. As I showed in previous post, so put a function before the stat something like this -

var data = {
    'ambient_temperature': global.get("nest1_ambient_temperature") ,
    'target_temperature': global.get("nest1_target_temperature") ,
    'mode': global.get("heating_current_mode") || 'off',
    'away': global.get("nest1_away") || 'false'
}
msg.payload = data;

i almost had this exact function, i was missing the "nest1 (ghostThermostat) in my case, i do not need it for the ambient temperature however. its all up and working at the moment. thank you so much for the guidance.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.