How to update a Netatmo rain sensor with node red?

Moderator: leecollings

Post Reply
sailmich
Posts: 232
Joined: Wednesday 17 February 2016 22:55
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Germany
Contact:

How to update a Netatmo rain sensor with node red?

Post by sailmich »

Hello,
I'm impact by an update from my Netatmo weatherstation. Domoticz native Netatmo hardware doesn't work anymore because the way of authorization changed from Netatmo side. I installed iobroker on a spare rpi with an Netatmo adapter. Within iobroker all my data from Netatmo can be sent via mqtt. I already have node red on my other rpi together with domoticz running. I created virtual devices for all sensors of my Netatmo devices and sending data from Netatmo sensors via node red mqtt to domoticz. That is working great expect of rain and barometer.
According to documentation api/json for rain
/json.htm?type=command&param=udevice&idx=IDX&nvalue=0&svalue=RAINRATE;RAINCOUNTER
I cant solve how to add ;RAINCOUNTER to my code witch working on the other sensors without this ;
In addittion Netatmo don't have a Raincounter. Same with barometer.
Any help appreciated!
This is the working code of function node for my other sensors.
Spoiler: show

Code: Select all

[
    {
        "id": "2e4934371f68acde",
        "type": "function",
        "z": "7ccd1793f1290075",
        "name": "idx723",
        "func": "msg.payload = { \"command\": \"udevice\", \"idx\": 723, \"nvalue\": 0, \"svalue\": msg.payload };\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 370,
        "y": 420,
        "wires": [
            [
                "9deece578cdeb782",
                "8e33a31c960be640"
            ]
        ]
    }
]
sailmich
Posts: 232
Joined: Wednesday 17 February 2016 22:55
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Germany
Contact:

Re: How to update a Netatmo rain sensor with node red?

Post by sailmich »

Answer to myself, maybe someone find it helpful. Change the nodes to your needs.
Spoiler: show

Code: Select all

[
    {
        "id": "611d8ce46acafef8",
        "type": "mqtt in",
        "z": "7ccd1793f1290075",
        "name": "Rain",
        "topic": "path/to/Netamo/Rain/SumRain1",
        "qos": "0",
        "datatype": "utf8",
        "broker": "f9f13036.e28b58",
        "nl": false,
        "rap": true,
        "rh": 0,
        "inputs": 0,
        "x": 90,
        "y": 540,
        "wires": [
            [
                "672210667ed7661d"
            ]
        ]
    },
    {
        "id": "c6a6304acd0f9b1f",
        "type": "change",
        "z": "7ccd1793f1290075",
        "name": "",
        "rules": [
            {
                "t": "set",
                "p": "post",
                "pt": "msg",
                "to": "payload",
                "tot": "msg"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 360,
        "y": 540,
        "wires": [
            [
                "41cf06b9a687f563"
            ]
        ]
    },
    {
        "id": "41cf06b9a687f563",
        "type": "http request",
        "z": "7ccd1793f1290075",
        "name": "",
        "method": "POST",
        "ret": "txt",
        "paytoqs": "ignore",
        "url": "http://178.xxx.xxx.xxx:xxxx/json.htm?type=command&param=udevice&idx=723&nvalue=0&svalue={{post}};RAINCOUNTER",
        "tls": "",
        "persist": false,
        "proxy": "",
        "insecureHTTPParser": false,
        "authType": "",
        "senderr": false,
        "headers": [],
        "x": 550,
        "y": 540,
        "wires": [
            []
        ]
    },
    {
        "id": "672210667ed7661d",
        "type": "function",
        "z": "7ccd1793f1290075",
        "name": "*100",
        "func": "msg.payload = msg.payload*100\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 210,
        "y": 540,
        "wires": [
            [
                "c6a6304acd0f9b1f"
            ]
        ]
    },
    {
        "id": "f9f13036.e28b58",
        "type": "mqtt-broker",
        "name": "Your_Settings",
        "broker": "YourURL",
        "port": "YourPort",
        "clientid": "",
        "autoConnect": true,
        "usetls": false,
        "protocolVersion": "4",
        "keepalive": "60",
        "cleansession": true,
        "birthTopic": "",
        "birthQos": "0",
        "birthRetain": "false",
        "birthPayload": "",
        "birthMsg": {},
        "closeTopic": "",
        "closeQos": "0",
        "closePayload": "",
        "closeMsg": {},
        "willTopic": "",
        "willQos": "0",
        "willPayload": "",
        "willMsg": {},
        "userProps": "",
        "sessionExpiry": ""
    }
]
Cheers
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest