Weather station connection

Zigbee2mqtt in Gladys does not work with an external MQTT container, it’s Gladys that must launch the container…

I don’t think you can use the Zigbee2mqtt integration on this version of Ubuntu until we develop compatibility. It will work on Ubuntu LTS.

ok,
so I see to switch to the Ubuntu LTS without breaking my install which I like otherwise

1 Like

Hello everyone,
Following my wanderings.
I downgraded my server from Ubuntu 21.10 to Ubuntu 20.04LTS.
Long reinstallation…
I reinstalled Gladys following the procedure already mentioned.
Openweather, Agenda, Telegram OK first time!
But Mqtt still wasn’t working with the same message in the integration menu, and especially in the log and therefore the same for zigbee2mqtt, and there, by rereading the error message, an idea came to me and I reread the installation guide!
And then, oh light! a small sibylline phrase passed through in the reading of this doc: « You must now add your user to the "docker" group so that your user can execute Docker commands. »
I think this sentence deserved to be highlighted, or even illustrated with a screenshot of the command!
By looking at the docker folder in var/lib via an ls-l and by looking at the members of the docker group, the light came to me, a small chmod and a small usermod -a -G, a restart and the matter was settled!
Via my browser gladys/integration now I have mqtt accessible!
I should have doubted it when I saw that I had to launch all my docker commands via a sudo!

Now I just have to design the nodered script to retrieve the data from my weather station and interface it with mqtt to gladys…

In parallel, I just ordered a sonoff zigbee dongle for the next step on other equipment (plugs, switches…)
So in the end my downgrade may not be necessary but it’s done so we won’t break it now… it will come soon enough!

1 Like

Yes yes, it was, you just had 2 problems (cgroup and then the permissions)

It’s in the Docker documentation too.

I had read Gladys’s documentation but not Docker’s…

Now I will have to discover Node-RED to create a script for my weather station. I watched Pierre Gilles’ stream on the principle, it seems feasible, but to put it into practice is another story, especially do I have all the necessary elements in my possession…

thanks, I will hurry to look at this…

Hello,
progress status.
connection gladys with nodered via mqtt in and out ok after many parameter struggles.
I recovered and installed the nodered palettes for connection to weather underground.
beginning of a scenario with the pws observation palette and an mqtt out: I connect to gladys but for the moment I do not retrieve any wunderground data for my local station (despite the parameter setting with my station id and adequate api code), still some tests, modifications… to do

1 Like

hello,
about 1 week!

certainly some points could be related to another ticket but I remain on the continuity of my weather station to connect to gladys and therefore for simplicity…

so:

  • change of os of my server from ubuntu 21.10 to 20.04 lts, done and it seems to work, although I have frequent crashes that I did not have in 21.10
  • reinstallation of gladys with docker: ok with mqtt taken into account (on this point I will come back to it later)
  • installation of node red on docker: ok
  • test of the examples given by pierre gilles on YT: ok the communication passes via mqtt between the 2 tools
  • installation on nodered of a specific lib (or palette) for reading the weatherundergroud api
  • creation of the nodered script (chaining and parameterization of palette): ok the script works I recover the json data from my station via the api) and process them up to my debug palette but impossible to send them via mqtt to gladys…
  • test of nodered dashboard: I recover the data well on the tdb created via nodered
    so where is the problem? data format in the flow? device settings in gladys? typically I took 2 « objects » temperature and humidity to recover those from my station and created 2 unknowns to recover rainfall and wind direction.
    and since this morning another problem, certainly after a server update (system, docker, gladys?) : the rights on the dockers directory had been modified (corrected since), but on the other hand since gladys seems to see mqtt but cannot maintain the link…
    and by doing a docker ps I notice that the eclipse-mosquitto container is permanently in restarting(13) mode, or rather seems to loop on this state…
    any idea?
    so meanwhile, situation: great progress but…
    Sylvain

PS: in parallel on pc w11 I created a dedicated gladys dev environment (wsl2, ubuntu, docker, vsc, …) to be able to contribute to dev in the future (for the moment I dev 4 apps in pascal/delphi): small question vsc in the wsl environment will it not risk to conflict with the vsc on the w11 part…

Hello @Einstein8854
Can you share a copy of your flow please

When you talk about my flow, are you referring to the Node-RED script?
Isn’t this about the current MQTT issue that loops on restarting?

Yes, but you must imperatively paste it with </> which puts it in Preformatted text, otherwise there is a problem with the quotes and double quotes

[
    {
        "id": "016eb2c081373f51",
        "type": "tab",
        "label": "Flow 3",
        "disabled": false,
        "info": "",
        "env": []
    },
    {
        "id": "c39ad4c34007e8b9",
        "type": "inject",
        "z": "016eb2c081373f51",
        "name": "meteo courante",
        "props": [
            {
                "p": "payload"
            }
        ],
        "repeat": "180",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "true",
        "payloadType": "bool",
        "x": 90,
        "y": 20,
        "wires": [
            [
                "4c448ed4c64a6ce3"
            ]
        ]
    },
    {
        "id": "4c448ed4c64a6ce3",
        "type": "pws-observations",
        "z": "016eb2c081373f51",
        "name": "Weather",
        "stationid": "IPUCEU1",
        "units": "m",
        "apikey": "0c25d0e62f427f92",
        "x": 260,
        "y": 20,
        "wires": [
            [
                "46abe7e7e0802ce4",
                "5494310f7054c656"
            ]
        ]
    },
    {
        "id": "f26d974a891612a6",
        "type": "mqtt out",
        "z": "016eb2c081373f51",
        "name": "mqtt:station",
        "topic": "gladys/device/mqtt:station/feature/mqtt:meteo/state",
        "qos": "2",
        "retain": "",
        "respTopic": "",
        "contentType": "",
        "userProps": "",
        "correl": "",
        "expiry": "",
        "broker": "b19483b9a24a3874",
        "x": 370,
        "y": 120,
        "wires": []
    },
    {
        "id": "46abe7e7e0802ce4",
        "type": "debug",
        "z": "016eb2c081373f51",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "auto",
        "x": 430,
        "y": 80,
        "wires": []
    },
    {
        "id": "7b61bd6495dc3004",
        "type": "ui_text",
        "z": "016eb2c081373f51",
        "group": "58b1939d3a5a9ac4",
        "order": 3,
        "width": 0,
        "height": 0,
        "name": "",
        "label": "Temp :",
        "format": "{{value}}",
        "layout": "row-spread",
        "className": "",
        "x": 370,
        "y": 160,
        "wires": []
    },
    {
        "id": "62bc4033a584587b",
        "type": "function",
        "z": "016eb2c081373f51",
        "name": "temperature",
        "func": "msg.payload=msg.payload.observations[0].metric.temp;\n//msg.payload=temper;\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 90,
        "y": 160,
        "wires": [
            [
                "93fdf8c678765f85",
                "7b61bd6495dc3004",
                "c43475ebeae26f8e"
            ]
        ]
    },
    {
        "id": "5494310f7054c656",
        "type": "json",
        "z": "016eb2c081373f51",
        "name": "",
        "property": "payload",
        "action": "obj",
        "pretty": false,
        "x": 90,
        "y": 80,
        "wires": [
            [
                "f26d974a891612a6",
                "94df99c94ec5445a",
                "7056f74a4fb4702c",
                "1bf4900ef12e645c",
                "941aa23b97daf6d2",
                "62bc4033a584587b",
                "e856a8e2a90a7355"
            ]
        ]
    },
    {
        "id": "94df99c94ec5445a",
        "type": "function",
        "z": "016eb2c081373f51",
        "name": "humidite",
        "func": "var humid=msg.payload.observations[0].humidity;\nmsg.payload=humid;\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 80,
        "y": 260,
        "wires": [
            [
                "4644a48691675823"
            ]
        ]
    },
    {
        "id": "4644a48691675823",
        "type": "ui_gauge",
        "z": "016eb2c081373f51",
        "name": "",
        "group": "58b1939d3a5a9ac4",
        "order": 7,
        "width": 0,
        "height": 0,
        "gtype": "gage",
        "title": "Humidité",
        "label": "%",
        "format": "{{value}}",
        "min": 0,
        "max": "100",
        "colors": [
            "#00b500",
            "#e6e600",
            "#ca3838"
        ],
        "seg1": "",
        "seg2": "",
        "className": "",
        "x": 380,
        "y": 260,
        "wires": []
    },
    {
        "id": "93fdf8c678765f85",
        "type": "ui_gauge",
        "z": "016eb2c081373f51",
        "name": "",
        "group": "58b1939d3a5a9ac4",
        "order": 2,
        "width": 0,
        "height": 0,
        "gtype": "gage",
        "title": "Temperature",
        "label": "°C",
        "format": "{{value}}",
        "min": "-20",
        "max": "50",
        "colors": [
            "#00b500",
            "#e6e600",
            "#ca3838"
        ],
        "seg1": "",
        "seg2": "",
        "className": "",
        "x": 390,
        "y": 200,
        "wires": []
    },
    {
        "id": "7056f74a4fb4702c",
        "type": "function",
        "z": "016eb2c081373f51",
        "name": "pluie",
        "func": "var pluie=msg.payload.observations[0].metric.precipRate;\nmsg.payload=pluie;\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 70,
        "y": 320,
        "wires": [
            [
                "0ca257b3fe7bb104"
            ]
        ]
    },
    {
        "id": "0ca257b3fe7bb104",
        "type": "ui_gauge",
        "z": "016eb2c081373f51",
        "name": "",
        "group": "58b1939d3a5a9ac4",
        "order": 4,
        "width": 0,
        "height": 0,
        "gtype": "gage",
        "title": "Précipitation",
        "label": "mm",
        "format": "{{value}}",
        "min": 0,
        "max": "500",
        "colors": [
            "#00b500",
            "#e6e600",
            "#ca3838"
        ],
        "seg1": "",
        "seg2": "",
        "className": "",
        "x": 390,
        "y": 320,
        "wires": []
    },
    {
        "id": "1bf4900ef12e645c",
        "type": "function",
        "z": "016eb2c081373f51",
        "name": "vent",
        "func": "\nvar wind=msg.payload.observations[0].winddir;\nmsg.payload=wind;\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 70,
        "y": 380,
        "wires": [
            [
                "1233944667394c99"
            ]
        ]
    },
    {
        "id": "1233944667394c99",
        "type": "ui_gauge",
        "z": "016eb2c081373f51",
        "name": "",
        "group": "58b1939d3a5a9ac4",
        "order": 6,
        "width": 0,
        "height": 0,
        "gtype": "compass",
        "title": "vent",
        "label": "°",
        "format": "{{value}}",
        "min": 0,
        "max": "360",
        "colors": [
            "#00b500",
            "#e6e600",
            "#ca3838"
        ],
        "seg1": "",
        "seg2": "",
        "className": "",
        "x": 370,
        "y": 380,
        "wires": []
    },
    {
        "id": "941aa23b97daf6d2",
        "type": "function",
        "z": "016eb2c081373f51",
        "name": "date",
        "func": "var periode=msg.payload.observations[0].obsTimeLocal;\nvar date=periode.split(\" \")[0];\nvar heure=periode.split(\" \")[1];\nvar msg1={};\nvar msg2={};\n//var out ={\"Date\" : date, \"Heure\": heure};\nmsg.payload=\"Le \" + date + \" à \"+ heure;\n//msg1.payload=out;\n\n\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 70,
        "y": 440,
        "wires": [
            [
                "4f581218cd160db3"
            ]
        ]
    },
    {
        "id": "4f581218cd160db3",
        "type": "ui_text",
        "z": "016eb2c081373f51",
        "group": "58b1939d3a5a9ac4",
        "order": 1,
        "width": 0,
        "height": 0,
        "name": "",
        "label": "",
        "format": "{{value}}",
        "layout": "row-spread",
        "className": "",
        "x": 370,
        "y": 440,
        "wires": []
    },
    {
        "id": "e856a8e2a90a7355",
        "type": "function",
        "z": "016eb2c081373f51",
        "name": "pression",
        "func": "var press=msg.payload.observations[0].metric.pressure;\nmsg.payload=press;\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 80,
        "y": 500,
        "wires": [
            [
                "542efb7e296e6737"
            ]
        ]
    },
    {
        "id": "542efb7e296e6737",
        "type": "ui_gauge",
        "z": "016eb2c081373f51",
        "name": "",
        "group": "58b1939d3a5a9ac4",
        "order": 5,
        "width": 0,
        "height": 0,
        "gtype": "compass",
        "title": "Pression",
        "label": "mBar",
        "format": "{{value}}",
        "min": 0,
        "max": "2000",
        "colors": [
            "#00b500",
            "#e6e600",
            "#ca3838"
        ],
        "seg1": "",
        "seg2": "",
        "className": "",
        "x": 380,
        "y": 500,
        "wires": []
    },
    {
        "id": "c43475ebeae26f8e",
        "type": "mqtt out",
        "z": "016eb2c081373f51",
        "name": "mqtt:station",
        "topic": "gladys/device/mqtt:station/feature/mqtt:temp/state",
        "qos": "2",
        "retain": "",
        "respTopic": "",
        "contentType": "",
        "userProps": "",
        "correl": "",
        "expiry": "",
        "broker": "b19483b9a24a3874",
        "x": 230,
        "y": 220,
        "wires": []
    },
    {
        "id": "0c25d0e62f427f92",
        "type": "pwsapikey",
        "name": ""
    },
    {
        "id": "b19483b9a24a3874",
        "type": "mqtt-broker",
        "name": "",
        "broker": "mqtt://localhost",
        "port": "1883",
        "clientid": "mqtt:station",
        "autoConnect": true,
        "usetls": false,
        "protocolVersion": "4",
        "keepalive": "90",
        "cleansession": false,
        "birthTopic": "",
        "birthQos": "2",
        "birthPayload": "",
        "birthMsg": {},
        "closeTopic": "",
        "closeQos": "0",
        "closePayload": "",
        "closeMsg": {},
        "willTopic": "",
        "willQos": "2",
        "willPayload": "",
        "willMsg": {},
        "sessionExpiry": ""
    },
    {
        "id": "58b1939d3a5a9ac4",
        "type": "ui_group",
        "name": "Meteo",
        "tab": "8cf38833f27eea20",
        "order": 1,
        "disp": true,
        "width": "6",
        "collapse": false,
        "className": ""
    },
    {
        "id": "8cf38833f27eea20",
        "type": "ui_tab",
        "name": "Station",
        "icon": "dashboard",
        "disabled": false,
        "hidden": false
    }
]

@cce66 Is this correct? I hope it’s the same version as the first one, because now I’m trying to modify it without being able to test (MQTT Mosquitto issue…).

Have you checked the container logs? That will give you an idea of the problem

hello @pierre-gilles,
I can see the log of the eclipse-mosquitto container right now and there I see a nice error: « error: unable to open pwfile /mosquitto/config/mosquitto.passwd »
Normally, it’s gladys that installs and starts the mqtt container, right?

Isn’t this a permission issue? You said your system had modified your permissions?

If you launched the MQTT container via Gladys, yes. After Gladys launches the container the first time, if in the meantime your system modifies the file permissions, Gladys can’t do anything special (Gladys just does a docker run once)

@pierre-gilles
complement,
while writing my response,
I was doing a little research on my ubuntu gladys server,
in the var/lib/gladysassistant directory I have a Mosquitto folder but inside I don’t have a config folder, I have directly the files mosquitto.conf and mosquitto.passwd with file rights 644 for user and group 1883

@pierre-gilles
the server, except via certain updates, does not change permissions on its own.
but here indeed I have the impression of a permission issue, but maybe also an arborescence issue (no config directory in the mosquitto directory of gladysassistant)

mqtt was indeed installed via gladys by following your procedure.
only nodered, still according to your explanation, was installed in docker outside of gladys.
I will not yet break everything and reinstall.
is it normal that root is the owner of the gladysassistant and docker directories