# Gauge label doesn't work with {{msg.topic}}

**URL:** https://discourse.nodered.org/t/gauge-label-doesnt-work-with-msg-topic/1321
**Category:** Dashboard
**Created:** [4 July 2018 15:11 UTC](https://discourse.nodered.org/t/gauge-label-doesnt-work-with-msg-topic/1321 "2018-07-04T15:11:49Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![infosmick](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/infosmick/32/988_2.png) [@infosmick](https://discourse.nodered.org/u/infosmick)
#### Post date: [4 July 2018 15:11 UTC](https://discourse.nodered.org/t/gauge-label-doesnt-work-with-msg-topic/1321/1 "2018-07-04T15:11:49Z")

</div>

Setting Label with {{msg.topic}}

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/5a787aee463b44b22506c1e52e845db53a7eb977.png)  
The topic is setted by change node

This is the flow

```auto
[
    {
        "id": "ed4796d7.57501",
        "type": "ui_gauge",
        "z": "1e58ad1d.519583",
        "name": "",
        "group": "77924864.53a6a8",
        "order": 0,
        "width": 0,
        "height": 0,
        "gtype": "gage",
        "title": "{{msg.topic}}",
        "label": "°C ####",
        "format": "{{value}}",
        "min": "-10",
        "max": "60",
        "colors": [
            "#80ffff",
            "#ffff00",
            "#ca3838"
        ],
        "seg1": "12",
        "seg2": "30",
        "x": 630,
        "y": 200,
        "wires": []
    },
    {
        "id": "15e9bf7b.946241",
        "type": "json",
        "z": "1e58ad1d.519583",
        "name": "",
        "pretty": false,
        "x": 290,
        "y": 220,
        "wires": [
            [
                "cacd4506.dcd238"
            ]
        ]
    },
    {
        "id": "dba09ab9.842b48",
        "type": "mqtt in",
        "z": "1e58ad1d.519583",
        "name": "",
        "topic": "out/dht22",
        "qos": "0",
        "broker": "eed163.62e4bea",
        "x": 120,
        "y": 220,
        "wires": [
            [
                "15e9bf7b.946241"
            ]
        ]
    },
    {
        "id": "cacd4506.dcd238",
        "type": "change",
        "z": "1e58ad1d.519583",
        "name": "Temp",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "payload.Temp",
                "tot": "msg"
            },
            {
                "t": "move",
                "p": "topic",
                "pt": "msg",
                "to": "payload.pos",
                "tot": "msg"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 450,
        "y": 220,
        "wires": [
            [
                "12227ba3.8a5ff4",
                "ed4796d7.57501"
            ]
        ]
    },
    {
        "id": "12227ba3.8a5ff4",
        "type": "display",
        "z": "1e58ad1d.519583",
        "active": true,
        "x": 640,
        "y": 240,
        "wires": []
    },
    {
        "id": "15597b43.0da9a5",
        "type": "go",
        "z": "1e58ad1d.519583",
        "name": "Test msg",
        "x": 120,
        "y": 320,
        "wires": [
            [
                "9874aad3.f06688"
            ]
        ]
    },
    {
        "id": "9874aad3.f06688",
        "type": "set",
        "z": "1e58ad1d.519583",
        "property": "payload",
        "value": "{\"Sn\":\"3389852238\",\"name\":\"TempHum\",\"pos\":\"Room 1\",\"Temp\":25,\"Hum\":\"105.90\"}",
        "name": "",
        "x": 420,
        "y": 420,
        "wires": [
            [
                "15e9bf7b.946241"
            ]
        ]
    },
    {
        "id": "77924864.53a6a8",
        "type": "ui_group",
        "z": "",
        "name": "Temperature",
        "tab": "3dccec0c.f37104",
        "order": 1,
        "disp": true,
        "width": "6",
        "collapse": true
    },
    {
        "id": "eed163.62e4bea",
        "type": "mqtt-broker",
        "z": "",
        "broker": "localhost",
        "port": "1883",
        "clientid": "",
        "usetls": false,
        "compatmode": true,
        "keepalive": "60",
        "cleansession": true,
        "willTopic": "",
        "willQos": "0",
        "willPayload": "",
        "birthTopic": "",
        "birthQos": "0",
        "birthPayload": ""
    },
    {
        "id": "3dccec0c.f37104",
        "type": "ui_tab",
        "z": "",
        "name": "DHT22",
        "icon": "dashboard",
        "order": 7
    }
]

```

(edited to add backticks by dceejay)

---

<div class="post-metadata">

### Author: ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)
#### Post date: [4 July 2018 15:40 UTC](https://discourse.nodered.org/t/gauge-label-doesnt-work-with-msg-topic/1321/2 "2018-07-04T15:40:19Z")

</div>

You need to surround your flow with three backticks (before and after your flow) to remove the smart quotes or others will not be able to import it.

Also, can you shorten it to just an inject node and the gauge note to show the problem?

---

<div class="post-metadata">

### Author: ![Andrei](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/andrei/32/10446_2.png) [@Andrei](https://discourse.nodered.org/u/Andrei)
#### Post date: [4 July 2018 15:54 UTC](https://discourse.nodered.org/t/gauge-label-doesnt-work-with-msg-topic/1321/3 "2018-07-04T15:54:23Z")

</div>

If you do like @zenofmud said, in regards to the backticks surrounding the code, then it will be easier for people in the forum to help you.

I managed anyway to partially import your flow. You are using some nodes that are unknown for me but I suspect the issue is on your change node. Apparently it is configured like below:

 ![m-0001](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/ff656ec82b571b56e1c804f3350fab82246b1cb8.PNG)

If this is the case then you are moving, in the second rule, msg.topic **to** msg.payload.pos. Most likely you want to do the opposite. Swap that config for testing.

Additionally, this should be the first rule in the change node, not the second one. The reason is that you are modifying msg.payload (destroying the original one) , in the other rule, and the order matters. Summarizing, if the config is like below it should work.

![m-0002](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/02d3eece1d080e82743fd22e505773d24e89db70.PNG)
