Weird Y Axis generated by MQTT

I have an issue with my dashboard. Using almost identical code, I end up with nonsense for the left axis on pool room while the outdoor stuff seems fine.

The data is input using MQTT and the gauge and graph have the exact same payloads, so why is the Y axis so weird?

image

Here is the underlying code:

[
    {
        "id": "ebbaaf1fbb49d248",
        "type": "mqtt in",
        "z": "1e6d0cc92960bc78",
        "name": "",
        "topic": "indoor_temp_topic",
        "qos": "0",
        "datatype": "auto-detect",
        "broker": "c6bf5d021264d8e1",
        "nl": false,
        "rap": true,
        "rh": 0,
        "inputs": 0,
        "x": 170,
        "y": 180,
        "wires": [
            [
                "a6eb72edd2662bb8",
                "f495317ab40f3852",
                "654176514a578ae5"
            ]
        ]
    },
    {
        "id": "82604fbed3287434",
        "type": "mqtt in",
        "z": "1e6d0cc92960bc78",
        "name": "",
        "topic": "indoor_humidity_topic",
        "qos": "0",
        "datatype": "auto-detect",
        "broker": "c6bf5d021264d8e1",
        "nl": false,
        "rap": true,
        "rh": 0,
        "inputs": 0,
        "x": 180,
        "y": 300,
        "wires": [
            [
                "0eec4248f657dcab",
                "3a58ae216556eea4",
                "fc0b23b51621a17c"
            ]
        ]
    },
    {
        "id": "654176514a578ae5",
        "type": "ui_gauge",
        "z": "1e6d0cc92960bc78",
        "name": "",
        "group": "570d12a99fb5ce3d",
        "order": 4,
        "width": 0,
        "height": 0,
        "gtype": "gage",
        "title": "Pool Room Temperature",
        "label": "°F",
        "format": "{{value}} °F",
        "min": 0,
        "max": "110",
        "colors": [
            "#00b500",
            "#e6e600",
            "#ca3838"
        ],
        "seg1": "",
        "seg2": "",
        "diff": false,
        "className": "",
        "x": 510,
        "y": 200,
        "wires": []
    },
    {
        "id": "0eec4248f657dcab",
        "type": "ui_gauge",
        "z": "1e6d0cc92960bc78",
        "name": "",
        "group": "570d12a99fb5ce3d",
        "order": 5,
        "width": 0,
        "height": 0,
        "gtype": "gage",
        "title": "Pool Room Humidity ",
        "label": "% RH",
        "format": "{{value}}% RH",
        "min": 0,
        "max": "100",
        "colors": [
            "#00b500",
            "#e6e600",
            "#ca3838"
        ],
        "seg1": "45",
        "seg2": "59",
        "diff": false,
        "className": "",
        "x": 500,
        "y": 300,
        "wires": []
    },
    {
        "id": "3a58ae216556eea4",
        "type": "ui_chart",
        "z": "1e6d0cc92960bc78",
        "name": "",
        "group": "570d12a99fb5ce3d",
        "order": 7,
        "width": 0,
        "height": 0,
        "label": "Pool Room Humidity",
        "chartType": "line",
        "legend": "false",
        "xformat": "HH:mm",
        "interpolate": "linear",
        "nodata": "",
        "dot": false,
        "ymin": "",
        "ymax": "",
        "removeOlder": "1",
        "removeOlderPoints": "",
        "removeOlderUnit": "3600",
        "cutout": 0,
        "useOneColor": false,
        "useUTC": false,
        "colors": [
            "#1f77b4",
            "#aec7e8",
            "#ff7f0e",
            "#2ca02c",
            "#98df8a",
            "#d62728",
            "#ff9896",
            "#9467bd",
            "#c5b0d5"
        ],
        "outputs": 1,
        "useDifferentColor": false,
        "className": "",
        "x": 500,
        "y": 340,
        "wires": [
            []
        ]
    },
    {
        "id": "f495317ab40f3852",
        "type": "ui_chart",
        "z": "1e6d0cc92960bc78",
        "name": "",
        "group": "570d12a99fb5ce3d",
        "order": 6,
        "width": "0",
        "height": "0",
        "label": "Pool Room Temperature",
        "chartType": "line",
        "legend": "false",
        "xformat": "HH:mm:ss",
        "interpolate": "linear",
        "nodata": "",
        "dot": false,
        "ymin": "",
        "ymax": "",
        "removeOlder": 1,
        "removeOlderPoints": "",
        "removeOlderUnit": "3600",
        "cutout": 0,
        "useOneColor": false,
        "useUTC": false,
        "colors": [
            "#1f77b4",
            "#aec7e8",
            "#ff7f0e",
            "#2ca02c",
            "#98df8a",
            "#d62728",
            "#ff9896",
            "#9467bd",
            "#c5b0d5"
        ],
        "outputs": 1,
        "useDifferentColor": false,
        "className": "",
        "x": 510,
        "y": 160,
        "wires": [
            []
        ]
    },
    {
        "id": "a6eb72edd2662bb8",
        "type": "function",
        "z": "1e6d0cc92960bc78",
        "name": "inTemp",
        "func": "flow.get(\"GV_Indoor_Temp\");\nglobal.set(\"GV_Indoor_Temp\", msg.payload);\nreturn msg;",
        "outputs": 1,
        "timeout": "",
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 360,
        "y": 120,
        "wires": [
            [
                "f40ea75a5aa47093"
            ]
        ]
    },
    {
        "id": "8937281cdaa1872f",
        "type": "comment",
        "z": "1e6d0cc92960bc78",
        "name": "",
        "info": "Used functions named GV to store in a \nGlobal Variable, indoor and outdoor \nTemp and humidity\nThis should make them available to \nuse in If Then statements to control\nthe Fans and Louver\nThe Variables are\n    GV_IndoorTemp\n    GV_IndoorHumidity\n    GV_OutdoorTemp\n    GV_OutdoorHumidity\n",
        "x": 120,
        "y": 120,
        "wires": []
    },
    {
        "id": "fc0b23b51621a17c",
        "type": "function",
        "z": "1e6d0cc92960bc78",
        "name": "InHumidy",
        "func": "flow.get(\"GV_Indoor_Humidity\");\nglobal.set(\"GV_Indoor_Humidity\", msg.payload);\nreturn msg;",
        "outputs": 1,
        "timeout": "",
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 360,
        "y": 260,
        "wires": [
            [
                "b41f051f986e2444"
            ]
        ]
    },
    {
        "id": "b41f051f986e2444",
        "type": "link out",
        "z": "1e6d0cc92960bc78",
        "name": "Indoor Humidity",
        "mode": "link",
        "links": [
            "be08956c157be950"
        ],
        "x": 625,
        "y": 260,
        "wires": []
    },
    {
        "id": "f40ea75a5aa47093",
        "type": "link out",
        "z": "1e6d0cc92960bc78",
        "name": "Indoor Temp",
        "mode": "link",
        "links": [
            "590d94db0ef1ab01",
            "f211bb67c0fddbd4"
        ],
        "x": 625,
        "y": 120,
        "wires": []
    },
    {
        "id": "c6bf5d021264d8e1",
        "type": "mqtt-broker",
        "name": "",
        "broker": "192.168.50.168",
        "port": "1883",
        "clientid": "",
        "autoConnect": true,
        "usetls": false,
        "protocolVersion": "4",
        "keepalive": "60",
        "cleansession": true,
        "autoUnsubscribe": true,
        "birthTopic": "",
        "birthQos": "1",
        "birthRetain": "true",
        "birthPayload": "",
        "birthMsg": {},
        "closeTopic": "",
        "closeQos": "0",
        "closeRetain": "false",
        "closePayload": "",
        "closeMsg": {},
        "willTopic": "",
        "willQos": "0",
        "willRetain": "false",
        "willPayload": "",
        "willMsg": {},
        "userProps": "",
        "sessionExpiry": ""
    },
    {
        "id": "570d12a99fb5ce3d",
        "type": "ui_group",
        "name": "",
        "tab": "08c882008efdc3a0",
        "order": 2,
        "disp": true,
        "width": "6",
        "collapse": false,
        "className": ""
    },
    {
        "id": "08c882008efdc3a0",
        "type": "ui_tab",
        "name": "Pool Room Humidity Control",
        "icon": "dashboard",
        "order": 1,
        "disabled": false,
        "hidden": false
    }
]

Add debug nodes to your flow and work out which node is not doing what you expect.

The gauge shows NOW, the graph shows historical. Those high values must have occurred at some point.

Add a switch node to filter out "unlikely" values.

While that doesnt fix the problem, the debug will help you understand what is going on.

PS: double check your topic is not being written to by other publishers.

PS2: to help improve maintainability and readability, I would suggest you give your topics better names. e.g. room/pool/temperature is way better than indoor_humidity_topic (using xxx/yyy/zzz topics lets you subscribe to many topics using various wildcards e.g. room/+/temperature or room/pool/#)

Thanks. We are on the same page. I had re-written the flow like your suggestion right after I posted. No joy - until I rebooted the Raspberry Pi. Then it worked.

I think the problem is that the initial payload for a very short period of time is the date, even though the MQTT payload is just temp or humidity. That long list of numbers then gets used to set the automatic Y axis. I also tried to fix the Y axis scales to typical temperature and humidity ranges. No joy, even if I rebooted the Pi. Not too sure what that doesn't work.

I will revise my topics. Your suggestion is great.

Thanks. This solved my problem (using a switch node to only permit reasonable numbers for temperature and humidity to pass)

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