# Need help with ghost thermostat

**URL:** <https://discourse.nodered.org/t/need-help-with-ghost-thermostat/61671>\
**Category:** General\
**Tags:** function-node\
**Created:** [23 April 2022 08:19 UTC](https://discourse.nodered.org/t/need-help-with-ghost-thermostat/61671 "2022-04-23T08:19:27Z")\
**Posts on this page:** 20\
**Page:** 3

<div class="post-metadata">

**Author:** ![ghostmaster75](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ghostmaster75/32/59018_2.png) [@ghostmaster75](https://discourse.nodered.org/u/ghostmaster75)\
**Post date:** [30 April 2022 00:49 UTC](https://discourse.nodered.org/t/need-help-with-ghost-thermostat/61671/41 "2022-04-30T00:49:31Z")

</div>

To do what you say is not better to put a switch with which to select the source of the data?

---

<div class="post-metadata">

**Author:** ![Sean-McG](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/sean-mcg/32/54677_2.png) [@Sean-McG](https://discourse.nodered.org/u/Sean-McG)\
**Post date:** [30 April 2022 00:54 UTC](https://discourse.nodered.org/t/need-help-with-ghost-thermostat/61671/42 "2022-04-30T00:54:45Z")

</div>

well the setpoint comes from the stat if changed, if left alone then it comes from schedule input. I use a separate switch at the moment with the nest stat, mainly to show the "mode" but also to toggle back to auto.

If I can select auto from the stat there there is no need for the switch, so it will look neater 😉

---

<div class="post-metadata">

**Author:** ![9toejack](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/9toejack/32/56868_2.png) [@9toejack](https://discourse.nodered.org/u/9toejack)\
**Post date:** [30 April 2022 01:04 UTC](https://discourse.nodered.org/t/need-help-with-ghost-thermostat/61671/43 "2022-04-30T01:04:16Z")

</div>

First and foremost, thanks @ghostmaster75 Pier for taking time to modify the node.  
is the newest version here?  
[https://flows.nodered.org/flow/9ca3a19e0e2ff606bd64f1e73a2191eb](https://flows.nodered.org/flow/9ca3a19e0e2ff606bd64f1e73a2191eb)  
or is updated on github?  
I want to make sure I get the correct one.  
Cheers,  
Billy

---

<div class="post-metadata">

**Author:** ![9toejack](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/9toejack/32/56868_2.png) [@9toejack](https://discourse.nodered.org/u/9toejack)\
**Post date:** [30 April 2022 03:24 UTC](https://discourse.nodered.org/t/need-help-with-ghost-thermostat/61671/44 "2022-04-30T03:24:03Z")

</div>

So I have them installed on 3 vessels an they work great except for when I set them on my laptop.  
and then I'm away from brewery and I open up dashboard on cell phone. they are not set properly.  
and I have reset them. Am I doing something wrong or is that just how these are supposed to work?  
@ghostmaster75 please let me know if i missed something. here is a copy of my flow for one.  
[ghostflow.json](https://discourse.nodered.org/uploads/short-url/gSb1azuqLBSPJuBK87bLvIPObX3.json) (34.3 KB)

---

<div class="post-metadata">

**Author:** ![Paul-Reed](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/paul-reed/32/66906_2.png) [@Paul-Reed](https://discourse.nodered.org/u/Paul-Reed)\
**Post date:** [30 April 2022 10:45 UTC](https://discourse.nodered.org/t/need-help-with-ghost-thermostat/61671/45 "2022-04-30T10:45:04Z")

</div>

> [@Sean-McG](#):
>
> If I can select auto from the stat there there is no need for the switch, so it will look neater

Yes I agree. It would be better to avoid using a separate switch if possible.

---

<div class="post-metadata">

**Author:** ![ghostmaster75](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ghostmaster75/32/59018_2.png) [@ghostmaster75](https://discourse.nodered.org/u/ghostmaster75)\
**Post date:** [30 April 2022 12:43 UTC](https://discourse.nodered.org/t/need-help-with-ghost-thermostat/61671/46 "2022-04-30T12:43:08Z")

</div>

@9toejack you need to store your values in the globals variables.  
keep in mind that tab data is ephemeral and is lost when you switch tabs, or open the same application from multiple devices. To keep them you have to save them in some global variables (there are also some flow variables).  
In the flow that I have attached you I have added 3 knots  
1 which saves the values ​​of the thermostat variables in global variables and 2 which restores the values ​​when you open the tab from any device so as not to lose the settings.  
To better manage your project you should use these to open and close the valves or check what you need

storing variable node  
 ![immagine](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/4/4/44941a2e4b54cfddcbb7a0bec61d0f5cc013f1f7.png)

get variables nodes

 ![immagine](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/c/3/c3ddc96ad3dcdc54418b7ae9f95d4bc879053e0d.png)

[flow.json](https://discourse.nodered.org/uploads/short-url/jUSkpUfGcrDIPdSvZuYswtnlR2Q.json) (42.5 KB)

---

<div class="post-metadata">

**Author:** ![ghostmaster75](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ghostmaster75/32/59018_2.png) [@ghostmaster75](https://discourse.nodered.org/u/ghostmaster75)\
**Post date:** [30 April 2022 12:47 UTC](https://discourse.nodered.org/t/need-help-with-ghost-thermostat/61671/47 "2022-04-30T12:47:46Z")

</div>

@Paul-Reed @Sean-McG  
adding a new "maual" mode would imply that I would have to ignore any input data regarding the target mode or temperature, but if I do so I would not be able to manage the thermostat so that it can be "synchronized" across multiple devices. In fact, as I explained in my previous answer, to keep the information usable it is necessary to save it in global (or flow) variables and then ignite it in the thermostat in order not to lose the information.

---

<div class="post-metadata">

**Author:** ![Sean-McG](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/sean-mcg/32/54677_2.png) [@Sean-McG](https://discourse.nodered.org/u/Sean-McG)\
**Post date:** [30 April 2022 13:44 UTC](https://discourse.nodered.org/t/need-help-with-ghost-thermostat/61671/48 "2022-04-30T13:44:16Z")

</div>

Not really I already handle the logic outside of the nest stat, and feed back what is needed, its just that it cannot display the auto / manual state.

I will have a play with your code and see if I can bend it to my will 😉

---

<div class="post-metadata">

**Author:** ![ghostmaster75](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ghostmaster75/32/59018_2.png) [@ghostmaster75](https://discourse.nodered.org/u/ghostmaster75)\
**Post date:** [30 April 2022 14:03 UTC](https://discourse.nodered.org/t/need-help-with-ghost-thermostat/61671/49 "2022-04-30T14:03:43Z")

</div>

here i've added a "auto" mode  
if you want add (or remove) modes just edit this variable:

 ![immagine](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/3/4/348dc61f1d039d2a10c6a36ebed80803ef3ab121.png)

and add (or remove) mode in the modeNames array.

you can change icons with fontawesome 4 icons (unicode code)

> **[Font Awesome Icons](https://fontawesome.com/v4/icons/)**
>
> Font Awesome, the iconic font and CSS framework

for example to use a gear icon use \uf013 code ( **\u** prefix with **f013** unicode code)

 ![immagine](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/0/1/01f9ae8a020e5ffd3ccf187a94619f6e19c9f0c6.jpeg)

[script.txt](https://discourse.nodered.org/uploads/short-url/gRxvGAMn6EkdRt2aRc0L3XHrwb1.txt) (25.4 KB)

---

<div class="post-metadata">

**Author:** ![Sean-McG](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/sean-mcg/32/54677_2.png) [@Sean-McG](https://discourse.nodered.org/u/Sean-McG)\
**Post date:** [30 April 2022 15:19 UTC](https://discourse.nodered.org/t/need-help-with-ghost-thermostat/61671/50 "2022-04-30T15:19:18Z")

</div>

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/3/5/35eb51c2073c18358c576746a173287096127030.png) ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/5/1/51c07e056244162f6b07c90a428fb506d7e44d64.png)

This should do the trick 😉

```auto
 var properties = {
            radius: options.diameter / 2,
            modes: [{
                    label: "heating",
                    icon: "\uf06d",
                    color: "orange"
                }, {
                    label: 'cooling',
                    icon: "\uf2dc",
                    color: "rgb(81,170,214)"
                }, {
                    label: 'auto',
                    icon: "\uf013",
                    color: "rgb(137,196,57)"
                }, {
                    label: 'user',
                    icon: "\uf007",
                    color: "rgb(236,236,26)"
                }, {
                    label: "off",
                    icon: "\uf011",
                    color: "rgb(230,0,0)"
                }
                /*, {
				label: 'away',
				icon: "\uf1ce",
				color: "gray"
			} */
            ],
            modeNames: ["heating", "cooling", "auto", "user","off"],
            swtitchStates: ["heating", "cooling", "off"]

```

```auto
function chkSwitchState() {
            console.log("chkSwitchState");
            var switchState = state.switch_state;
            switch (state.mode) {
                case 0:
                    switchState = state.ambient_temperature < state.target_temperature ? 'heating' : 'off';
                    break;
                case 1:
                    switchState = state.ambient_temperature > state.target_temperature ? 'cooling' : 'off';
                    break;
                case 2:
                    switchState = state.ambient_temperature < state.target_temperature ? 'heating' : 'off'; //auto
                    break;
                case 3:
                    switchState = state.ambient_temperature < state.target_temperature ? 'heating' : 'off'; //user
                    break;

                default:
                    switchState = 'off';
            };

            ledRingGradientColorIn.setAttribute('stop-color', options.ledColors[state.switch_state]);

```

---

<div class="post-metadata">

**Author:** ![9toejack](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/9toejack/32/56868_2.png) [@9toejack](https://discourse.nodered.org/u/9toejack)\
**Post date:** [30 April 2022 16:15 UTC](https://discourse.nodered.org/t/need-help-with-ghost-thermostat/61671/51 "2022-04-30T16:15:51Z")

</div>

@ghostmaster75  
Ok thanks for fast response Pier,  
However, I set that up and still have an issue.  
I can pull it up on computer and it works fine.  
Then when i walk away, and want to check status on cell phone.  
I get temp showing 200 and set is at 0 again and its set to Off.

I think i need to pause for a little bit , I really need to understand how its put together.  
Which means, I need to learn more about Ui template node and how things make it work.  
I did see this thread where @hotNipi nudged someone into learning making there own ui template. I think in order to not rely on others, I need to rely on myself more and learn it the right way.(step by step)  
here is the thread lots of good useful info here.

> [@Control Knob suitable for Volume control or similar](https://discourse.nodered.org/t/control-knob-suitable-for-volume-control-or-similar/52464/12):
>
> With small tweaks to the input-knobs JavaScript file, possible to use with ui\_template [image]

---

<div class="post-metadata">

**Author:** ![ghostmaster75](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ghostmaster75/32/59018_2.png) [@ghostmaster75](https://discourse.nodered.org/u/ghostmaster75)\
**Post date:** [30 April 2022 17:05 UTC](https://discourse.nodered.org/t/need-help-with-ghost-thermostat/61671/52 "2022-04-30T17:05:57Z")

</div>

Last try.... add an inject node to "Ghet data from Globals" in parallel at "ui contol" and enable "inject once ofter 0.1 seconds" in their properties  
 ![immagine](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/a/d/ad43f31e682a87787aa634f6f678257329d4ea80.png)

---

<div class="post-metadata">

**Author:** ![ghostmaster75](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ghostmaster75/32/59018_2.png) [@ghostmaster75](https://discourse.nodered.org/u/ghostmaster75)\
**Post date:** [30 April 2022 18:26 UTC](https://discourse.nodered.org/t/need-help-with-ghost-thermostat/61671/53 "2022-04-30T18:26:59Z")

</div>

@9toejack try this (re add display node)

[flow.json](https://discourse.nodered.org/uploads/short-url/yeAPA6QG1vQoGXgA21XzCZyfKZi.json) (42.8 KB)

---

<div class="post-metadata">

**Author:** ![9toejack](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/9toejack/32/56868_2.png) [@9toejack](https://discourse.nodered.org/u/9toejack)\
**Post date:** [30 April 2022 19:03 UTC](https://discourse.nodered.org/t/need-help-with-ghost-thermostat/61671/54 "2022-04-30T19:03:17Z")

</div>

I'm transit with wife, I'll be back in 2 hours, and I try this.

Right now I have flow disabled so I don't have an issue with fermenters.

Thanks again Pier!

---

<div class="post-metadata">

**Author:** ![Sean-McG](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/sean-mcg/32/54677_2.png) [@Sean-McG](https://discourse.nodered.org/u/Sean-McG)\
**Post date:** [1 May 2022 02:42 UTC](https://discourse.nodered.org/t/need-help-with-ghost-thermostat/61671/55 "2022-05-01T02:42:40Z")

</div>

I seem to have found a couple of undocumented features 😃

If I send a payload like this -

payload: object  
ambient\_temperature: 20.6  
target\_temperature: 12  
mode: "user"  
away: "false"

Nothing happens with the display until I send it again. If I send 2 different payloads the 2nd message causes the 1st msg to be displayed 😉

The input msg accepts numbers but if I change via gui the output is a string -

Can this be changed to a number ?

object  
topic: "changed\_state"  
payload: object  
ambient\_temperature: 20.7  
target\_temperature: **"19.5"**  
mode "user"  
switch\_state: "off"  
away: false

**EDIT**

I had to add a trigger node on the output to only send latest msg after 2 second delay to stop it spamming my flow, also had to delete msg.socketid so that updates go to stats on all browser sessions.

You might consider adding these functions in to the template ?

**There also seem to be some odd rounding errors eg**

target temp of 20.1 and 20.2 is shown as 20.1  
target temp of 20.3 and 20.4 is shown as 20.3  
target temp of 20.5 is shown as 20.5  
target temp of 20.6 and 20.7 is shown as 20.6  
target temp of 20.8 and 20.9 is shown as 20.8

**EDIT 2**

Really sorry but I found another issue (may be related to above?)

If I have the same stat visible on multiple browsers, and adjust the setpoint so that the LED ring lights up on the browser I’m using, the other stats do not light up.

The change of setpoint is updated on each browser(after I send 2x message, without socket.id) but it requires a 3rd message to get the other browsers to light the ring up.

So I now have 2 trigger nodes set to repeat an incoming message 3 times at 500ms intervals, in order to get the stats to be responsive to changes.

Happy to help with beta testing 😉

---

<div class="post-metadata">

**Author:** ![ghostmaster75](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ghostmaster75/32/59018_2.png) [@ghostmaster75](https://discourse.nodered.org/u/ghostmaster75)\
**Post date:** [1 May 2022 21:58 UTC](https://discourse.nodered.org/t/need-help-with-ghost-thermostat/61671/56 "2022-05-01T21:58:07Z")

</div>

@Sean-McG thankyou for your beta testing 🙂

i don't understand why you have so much problems with multdevices views.  
This is what's append to my flow (2 devices 2 kind of different browser)

> **[VID-20220501-232755-1.gif](https://wetransfer.com/downloads/c1ad0537035cccc93b50fd9e4dc286d920220501230516/3a1d30)**
>
> 1 file sent via WeTransfer, the simplest way to send your files around the world

and in attachment are my simple flow to manage it.  
[myflow.json](https://discourse.nodered.org/uploads/short-url/2dmGriiQ2RHzQJTyolu7ddFR7AY.json) (38.7 KB)

ill try to understand what are de causes of your problems

---

<div class="post-metadata">

**Author:** ![Sean-McG](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/sean-mcg/32/54677_2.png) [@Sean-McG](https://discourse.nodered.org/u/Sean-McG)\
**Post date:** [1 May 2022 22:54 UTC](https://discourse.nodered.org/t/need-help-with-ghost-thermostat/61671/57 "2022-05-01T22:54:00Z")

</div>

Looks like your videos didn't upload.

Let me know if you need more information to debug.

---

<div class="post-metadata">

**Author:** ![9toejack](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/9toejack/32/56868_2.png) [@9toejack](https://discourse.nodered.org/u/9toejack)\
**Post date:** [2 May 2022 06:18 UTC](https://discourse.nodered.org/t/need-help-with-ghost-thermostat/61671/58 "2022-05-02T06:18:25Z")

</div>

Wow , Ok so going over it and over it. I was still having problems.  
However, I walked away and came back to it. I missed the flow that you had attached to the ui-control node sample that you sent me. I had just changed my msg. to global instead of flow.  
It is now working great. It takes a few moments to catch up on other device but it works good now.  
I have another thought or question however.  
attached is my flow and obviously I have a few temp gauges here. one is just visual page that I can set on a monitor somewhere in brewery.  
My thought is, I have my dropdown UI to select specific temps.  
Can I also use that to change the set in your Ui node?  
Is it as simple as changing the topic on the dropdown menu?

---

<div class="post-metadata">

**Author:** ![9toejack](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/9toejack/32/56868_2.png) [@9toejack](https://discourse.nodered.org/u/9toejack)\
**Post date:** [2 May 2022 06:26 UTC](https://discourse.nodered.org/t/need-help-with-ghost-thermostat/61671/59 "2022-05-02T06:26:36Z")

</div>

> [@Sean-McG](#):
>
> I had to add a trigger node on the output to only send latest msg after 2 second delay to stop it spamming my flow, also had to delete msg.socketid so that updates go to stats on all browser sessions.

I did a search for this in the ui-template (ghostthermostat)node and didn't see this there. Am I supposed to remove that from a different node?

I do apologize, I am still very new, I'm learning but still wet behind the ears.

---

<div class="post-metadata">

**Author:** ![9toejack](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/9toejack/32/56868_2.png) [@9toejack](https://discourse.nodered.org/u/9toejack)\
**Post date:** [2 May 2022 07:07 UTC](https://discourse.nodered.org/t/need-help-with-ghost-thermostat/61671/60 "2022-05-02T07:07:24Z")

</div>

FYI , It is working good now.  
just need to find a quicker way of selecting temp target . here is a pick of my computer at home and I'm logged into Computer at brewery at same time

 ![workinggood.PNG](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/b/b/bbad2dcffb1c77dad7a135e8d3c1e3eb46c52ebb.jpeg)  
(using teamviewer)

[Previous page](https://discourse.nodered.org/t/need-help-with-ghost-thermostat/61671.md?page=2)

[Next page](https://discourse.nodered.org/t/need-help-with-ghost-thermostat/61671.md?page=4)
