Connection refused Topic is solved

Moderator: leecollings

edwin1234
Posts: 252
Joined: Sunday 09 October 2016 20:20
Target OS: Raspberry Pi / ODroid
Domoticz version: 2021.1
Location: Nederland
Contact:

Connection refused

Post by edwin1234 »

I have a connection refused problem from node red to domoticz.
I filled in the ipadress in domoticz setup and local networks allowed.

This is the error in syslog:

May 28 00:00:53 edwin Node-RED[424]: 28 May 00:00:53 - [info] [debug:msg.url] http://127.0.0.1:9091/json.htm?type=com ... 16867.3065
May 28 00:00:53 edwin Node-RED[424]: 28 May 00:00:53 - [error] [http request:Domoticz] RequestError: connect ECONNREFUSED 127.0.0.1:9091

Its strange because sometimes it does work with the same setup, and after a while i get “econnrefused”
User avatar
FireWizard
Posts: 1770
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

Re: Connection refused

Post by FireWizard »

Hello Edwin (edwin1234),

Can you explain, what you try to achieve?

A search in the Wiki, does not give any hits regarding did, dunit, dtype and dsubtype.
What are these commands supposed to do in combination with the command "udevice"?

And your Domoticz is running on port 9091 for http? (instead of the default 8080)

Regards
edwin1234
Posts: 252
Joined: Sunday 09 October 2016 20:20
Target OS: Raspberry Pi / ODroid
Domoticz version: 2021.1
Location: Nederland
Contact:

Re: Connection refused

Post by edwin1234 »

Plugwise2py sends this with node red to domoticz , for power monitoring and yes my domoticz port is 9091
User avatar
waltervl
Posts: 5396
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: Connection refused

Post by waltervl »

Do you use the node red flow as mentioned here: viewtopic.php?t=7420&start=100
Seems to be an issue for others too.
Perhaps remove all the not normal parameters like did, dunit, dtype etc. Seems API commands to create an new device instead of updating. Idx, nvalue and svalue should be enough to update.
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
User avatar
FireWizard
Posts: 1770
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

Re: Connection refused

Post by FireWizard »

Hello edwin1234,

You said:
Plugwise2py sends this with node red to domoticz
Okay, the only information you gave is that you use "Plugwise2py".
Google told me that this is a Python application for monitoring and controlling plugwise devices.

I assume, you use https://github.com/SevenW/Plugwise-2-py.
Or any other of its 23 forks?

You intend to use Node Red, but Node Red in generally does not send the same data to the output as it receives on the input.
As you might know this is a programming environment, like many others, and it does, what you tell it to do.

If you read the README file you will find a chapter with Domoticz, pointing you to a link.
The same link as @waltervl pointed you to. You should know this thread, as you posted in 2016/2017 in this thread.

So if you can inform us with the following information, we might be able to support you:

- What sensor device do you have configured (Your IDX 110)?
- What information do you receive from your MQTT input node?
Connect a "Debug" node to the output of the MQTT input node. This node is indicated as "Plugwise" in Pepijn's post, July 28, 2015

If you have a NR flow, can you post this?

Regards
edwin1234
Posts: 252
Joined: Sunday 09 October 2016 20:20
Target OS: Raspberry Pi / ODroid
Domoticz version: 2021.1
Location: Nederland
Contact:

Re: Connection refused

Post by edwin1234 »

Thanks for your help,

I used the original Plugwise2py, now i use the Plugwise2py container gruijter/Plugwise2py

What sensor device do you have configured (Your IDX 110)? Idx110 is VerbruikDroger
- What information do you receive from your MQTT input node?
Cant get info in node red at the moment, but this is the ouput in mqtt analyzer:

plugwise2py/state/circle/000D6F00003FF1DD

{"power8s": 0.0, "powerts": 0, "name": "droger", "schedule": "?", "requid": "unset", "power1s": 0.0, "switchreq": "?", "readonly": false, "interval": 60, "switch": "on", "mac": "000D6F00003FF1DD", "production": false, "monitor": true, "lastseen": 1649963532, "power1h": 0.0, "online": true, "savelog": true, "type": 2, "reverse_pol": true, "schedname": "__PW2PY__test-alternate", "location": "zolder"}

And this is in node red:

Code: Select all

 [
    {
        "id": "82652e5a2a4c0381",
        "type": "tab",
        "label": "WasMachine",
        "disabled": false,
        "info": ""
    },
    {
        "id": "4809f7337329137c",
        "type": "function",
        "z": "82652e5a2a4c0381",
        "name": "Plugwise2 Energy to Domoticz",
        "func": "//\n// Relay Plugwise MQTT energy message to Domoticz HTTP\n//\nnode.log (\"Relay Plugwise MQTT energy message to Domoticz HTTP\");\nvar sensor_url = context.flow.plugwiseCfg.sensor_base_url;\nvar pwJSON = JSON.parse(msg.payload);\nvar state = context.flow.plugwiseState[pwJSON.mac];\nvar pvalue = pwJSON.power;\nvar evalue = pwJSON.cum_energy;\npvalue = pvalue\nevalue = evalue\n//if (state)\n//    if (state.state.production) {\n//        pvalue = pvalue;\n//        evalue = evalue;\n//    }\n\n///json.htm?type=command&param=udevice&hid=$HID&did=$DID&dunit=$DUNIT&dtype=$DTYPE&dsubtype=$DSUBTYPE&nvalue=$NVALUE&svalue=$SVALUE\"\nmsg.url = sensor_url + \"did=E\"+pwJSON.mac.substr(9,7)+\"&dunit=1&dtype=243&dsubtype=29&nvalue=&svalue=\"+pvalue+\";\"+evalue;\nreturn msg;",
        "outputs": "1",
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 590,
        "y": 160,
        "wires": [
            [
                "8ac8a87748f3ab6a",
                "28684f2a4d4c9a9e"
            ]
        ]
    },
    {
        "id": "d8cdc15371ef0cd2",
        "type": "function",
        "z": "82652e5a2a4c0381",
        "name": "Plugwise2 Power to Domoticz",
        "func": "//\n// Relay Plugwise MQTT power message to Domoticz HTTP\n//\nnode.log (\"Relay Plugwise MQTT power message to Domoticz HTTP\");\nvar sensor_url = context.flow.plugwiseCfg.sensor_base_url;\nvar pwJSON = JSON.parse(msg.payload);\n\nvar state = context.flow.plugwiseState[pwJSON.mac];\nvar value = pwJSON.power;\nvalue = value;\n//if (state)\n//    if (state.state.production)\n//        value = value;\n\n///json.htm?type=command&param=udevice&hid=$HID&did=$DID&dunit=$DUNIT&dtype=$DTYPE&dsubtype=$DSUBTYPE&nvalue=$NVALUE&svalue=$SVALUE\"\nmsg.url = sensor_url + \"did=F\"+pwJSON.mac.substr(9,7)+\"&dunit=1&dtype=248&dsubtype=1&nvalue=&svalue=\"+value+\";0\";\n\nreturn msg;",
        "outputs": "1",
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 590,
        "y": 220,
        "wires": [
            [
                "8ac8a87748f3ab6a",
                "7b4650360b558276"
            ]
        ]
    },
    {
        "id": "153d9f697dfbfb42",
        "type": "function",
        "z": "82652e5a2a4c0381",
        "name": "Plugwise2 State to Domoticz",
        "func": "//\n// Relay Plugwise MQTT state/circle message to Domoticz HTTP\n//\nnode.log (\"Relay Plugwise MQTT state/circle message to Domoticz HTTP\");\nvar switch_url = context.flow.plugwiseCfg.switch_base_url;\nvar sensor_url = context.flow.plugwiseCfg.sensor_base_url;\nvar pwJSON = JSON.parse(msg.payload);\nvar pwSwitch = 0;\nif (pwJSON.switch.toLowerCase() == \"on\")\n    pwSwitch = 1;\nvar pwSchedule = 0;\nif (pwJSON.schedule.toLowerCase() == \"on\")\n    pwSchedule = 1;\nvar info = \"\";\nif (pwJSON.schedname.length > 0)\n    info += \"schedule: \" + pwJSON.schedname;\nif (!pwJSON.online) {\n    if (info.length > 0)\n        info += \", \";\n    info += \"offline\";\n}\n\n///json.htm?type=command&param=udevice&hid=$HID&did=$DID&dunit=$DUNIT&dtype=$DTYPE&dsubtype=$DSUBTYPE&nvalue=$NVALUE&svalue=$SVALUE\"\nvar switch_msg = {};\nvar schedule_msg = {};\nvar status_msg = {};\nswitch_msg.url = switch_url + \"did=B\"+pwJSON.mac.substr(9,7)+\"&dunit=1&dtype=17&dsubtype=0&nvalue=\" + pwSwitch + \"&svalue=15\";\nschedule_msg.url = switch_url + \"did=C\"+pwJSON.mac.substr(9,7)+\"&dunit=1&dtype=17&dsubtype=0&nvalue=\" + pwSchedule + \"&svalue=15\";\nstatus_msg.url = sensor_url + \"did=A\"+pwJSON.mac.substr(9,7)+\"&dunit=1&dtype=243&dsubtype=19&nvalue=&svalue=\"+info;\n\n//discard state messages as reply to a domoticz switch command\nif (pwJSON.requid == context.flow.plugwiseReqUID + 0)  {\n    context.flow.plugwiseState[pwJSON.mac] = { ts: Date.now(), state: pwJSON, update: \"schedule\" };\n    return [null, schedule_msg, status_msg];\n}\nelse if (pwJSON.requid == context.flow.plugwiseReqUID + 1) {\n    context.flow.plugwiseState[pwJSON.mac] = { ts: Date.now(), state: pwJSON, update: \"switch\" };\n    return [switch_msg, null, status_msg];\n}\ncontext.flow.plugwiseState[pwJSON.mac] = { ts: Date.now(), state: pwJSON, update: \"both\" };\n\n//return [msg, context.global.plugwiseState[pwJSON.mac]];\nreturn [switch_msg, schedule_msg, status_msg];\n\n\n\n",
        "outputs": "3",
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 585,
        "y": 291,
        "wires": [
            [
                "8ac8a87748f3ab6a",
                "f4156d8f7e3c0f8a"
            ],
            [
                "8ac8a87748f3ab6a",
                "eaa3eb9f61fa974b"
            ],
            [
                "8ac8a87748f3ab6a",
                "1da7c7c6b1e34cbc"
            ]
        ]
    },
    {
        "id": "7b4650360b558276",
        "type": "debug",
        "z": "82652e5a2a4c0381",
        "name": "msg.url",
        "active": true,
        "tosidebar": true,
        "console": true,
        "tostatus": false,
        "complete": "url",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "auto",
        "x": 980,
        "y": 200,
        "wires": []
    },
    {
        "id": "8ac8a87748f3ab6a",
        "type": "http request",
        "z": "82652e5a2a4c0381",
        "name": "Domoticz",
        "method": "use",
        "ret": "txt",
        "paytoqs": "ignore",
        "url": "",
        "tls": "",
        "persist": false,
        "proxy": "",
        "authType": "",
        "x": 820,
        "y": 220,
        "wires": [
            []
        ]
    },
    {
        "id": "6ad7415bc25b5496",
        "type": "inject",
        "z": "82652e5a2a4c0381",
        "name": "run at startup",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": true,
        "onceDelay": "",
        "topic": "",
        "payloadType": "str",
        "x": 197,
        "y": 94,
        "wires": [
            [
                "454361baa2f7cba1"
            ]
        ]
    },
    {
        "id": "454361baa2f7cba1",
        "type": "function",
        "z": "82652e5a2a4c0381",
        "name": "Initialise global context",
        "func": "//edit the following variables to match your configuration:\ndomoticz_ip = \"127.0.0.1\";\ndomoticz_port = \"9091\";\nvirtual_hardware_id = 80;\nvirtual_switch_id = 80;\n//end config section\n\n//initialize plugwise-domoticz bridge global variables\nif (!context.flow.plugwiseCfg) {\n  context.flow.plugwiseCfg = {};\n}\nif (!context.flow.plugwiseState) {\n  context.flow.plugwiseState = [];\n}\nif (!context.flow.plugwiseReqUID) {\n  context.flow.plugwiseReqUID = Date.now().toString();\n}\n\ncontext.flow.plugwiseCfg.sensor_base_url = \"http://\" + domoticz_ip + \":\" + domoticz_port + \"/json.htm?type=command&param=udevice&idx=\" + virtual_hardware_id +\"&\";\ncontext.flow.plugwiseCfg.switch_base_url = \"http://\" + domoticz_ip + \":\" + domoticz_port + \"/json.htm?type=command&param=udevice&idx=\" + virtual_switch_id +\"&\";\n\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 423,
        "y": 94,
        "wires": [
            []
        ]
    },
    {
        "id": "dae90e375208e84c",
        "type": "switch",
        "z": "82652e5a2a4c0381",
        "name": "",
        "property": "topic",
        "propertyType": "msg",
        "rules": [
            {
                "t": "cont",
                "v": "energy",
                "vt": "str"
            },
            {
                "t": "cont",
                "v": "power",
                "vt": "str"
            },
            {
                "t": "cont",
                "v": "circle",
                "vt": "str"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 3,
        "x": 361,
        "y": 226,
        "wires": [
            [
                "4809f7337329137c"
            ],
            [
                "d8cdc15371ef0cd2"
            ],
            [
                "153d9f697dfbfb42"
            ]
        ]
    },
    {
        "id": "5ae572159845d151",
        "type": "mqtt in",
        "z": "82652e5a2a4c0381",
        "name": "",
        "topic": "plugwise2py/state/#",
        "qos": "2",
        "datatype": "auto",
        "broker": "541cd84c.f2963",
        "nl": false,
        "rap": false,
        "x": 150,
        "y": 300,
        "wires": [
            [
                "5bdb33b04011242b"
            ]
        ]
    },
    {
        "id": "1da7c7c6b1e34cbc",
        "type": "debug",
        "z": "82652e5a2a4c0381",
        "name": "msg.url",
        "active": false,
        "tosidebar": true,
        "console": true,
        "complete": "url",
        "x": 978,
        "y": 313,
        "wires": []
    },
    {
        "id": "eaa3eb9f61fa974b",
        "type": "debug",
        "z": "82652e5a2a4c0381",
        "name": "msg.url",
        "active": false,
        "console": "true",
        "complete": "url",
        "x": 977,
        "y": 274,
        "wires": []
    },
    {
        "id": "f4156d8f7e3c0f8a",
        "type": "debug",
        "z": "82652e5a2a4c0381",
        "name": "msg.url",
        "active": false,
        "console": "true",
        "complete": "url",
        "x": 976,
        "y": 235,
        "wires": []
    },
    {
        "id": "28684f2a4d4c9a9e",
        "type": "debug",
        "z": "82652e5a2a4c0381",
        "name": "msg.url",
        "active": true,
        "tosidebar": true,
        "console": true,
        "tostatus": true,
        "complete": "url",
        "targetType": "msg",
        "statusVal": "url",
        "statusType": "auto",
        "x": 978,
        "y": 158,
        "wires": []
    },
    {
        "id": "6c54e77f193801cb",
        "type": "debug",
        "z": "82652e5a2a4c0381",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": true,
        "tostatus": true,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "payload",
        "statusType": "auto",
        "x": 440,
        "y": 440,
        "wires": []
    },
    {
        "id": "5bdb33b04011242b",
        "type": "switch",
        "z": "82652e5a2a4c0381",
        "name": "",
        "property": "payload",
        "propertyType": "msg",
        "rules": [
            {
                "t": "cont",
                "v": "FD2F9",
                "vt": "str"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 1,
        "x": 250,
        "y": 440,
        "wires": [
            [
                "dae90e375208e84c",
                "6c54e77f193801cb"
            ]
        ]
    },
    {
        "id": "541cd84c.f2963",
        "type": "mqtt-broker",
        "name": "",
        "broker": "127.0.0.1",
        "port": "1883",
        "clientid": "",
        "usetls": false,
        "protocolVersion": "4",
        "keepalive": "15",
        "cleansession": true,
        "birthTopic": "",
        "birthQos": "0",
        "birthRetain": "false",
        "birthPayload": "",
        "birthMsg": {},
        "closeTopic": "",
        "closeRetain": "false",
        "closePayload": "",
        "closeMsg": {},
        "willTopic": "",
        "willQos": "0",
        "willRetain": "false",
        "willPayload": "",
        "willMsg": {},
        "sessionExpiry": ""
    }
]
User avatar
FireWizard
Posts: 1770
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

Re: Connection refused

Post by FireWizard »

Hello edwin1234,

You wrote:
I used the original Plugwise2py, now i use the Plugwise2py container gruijter/Plugwise2py
So your Plugwise2.py application and your MQTT broker are running in a docker container. Good to know,
What sensor device do you have configured (Your IDX 110)? Idx110 is VerbruikDroger
Sorry, I'm not really interested in the name of the sensor, but I need to know the type of the sensor. As you write "Verbruik", I assume that it is "Electricity (instant and counter)". Can you confirm?
- What information do you receive from your MQTT input node?
Cant get info in node red at the moment, but this is the ouput in mqtt analyzer:
If you cannot get data into Node RED, there will be no output as well.
What "mqtt analyzer"? Do you mean MQTT Explorer?
plugwise2py/state/circle/000D6F00003FF1DD

{"power8s": 0.0, "powerts": 0, "name": "droger", "schedule": "?", "requid": "unset", "power1s": 0.0, "switchreq": "?", "readonly": false, "interval": 60, "switch": "on", "mac": "000D6F00003FF1DD", "production": false, "monitor": true, "lastseen": 1649963532, "power1h": 0.0, "online": true, "savelog": true, "type": 2, "reverse_pol": true, "schedname": "__PW2PY__test-alternate", "location": "zolder"}
This is only a part of the possible output, as the topic configured in the MQTT input node is:

Code: Select all

plugwise2py/state/#
and the topic of the data you supplied is:

Code: Select all

plugwise2py/state/circle/000D6F00003FF1DD
I copied this part of the data into an Inject node in Node RED.
See below:

Screenshot_Plugwise_flow1.png
Screenshot_Plugwise_flow1.png (67.61 KiB) Viewed 5332 times

First of all, I think it is an unnecessary difficult flow to understand.
Is there any particular reason that you read the data from plugwise2.py with a MQTT input node and that you transmit the data to Domoticz with a HTTP node and not using MQTT output node on the same broker?
Another remark is that you filter the received payload on a value of FD2F9

Screenshot_Plugwise_flow3.png
Screenshot_Plugwise_flow3.png (14.08 KiB) Viewed 5332 times

However the provided data (as shown below) does not contain this FD2F9 and so the message is blocked.
See:

Screenshot_Plugwise_flow2.png
Screenshot_Plugwise_flow2.png (33.56 KiB) Viewed 5332 times

Can you indicate which values you want to have displayed in Domoticz, because the properties, like "power8s","powerts", "powerls" and "power1h" does not mean much to me. Perhaps there is more info in the other topics (plugwise2py/state/power and plugwise2py/state/energy)

If you can provide the necessary information we can give you better support.

Regards
edwin1234
Posts: 252
Joined: Sunday 09 October 2016 20:20
Target OS: Raspberry Pi / ODroid
Domoticz version: 2021.1
Location: Nederland
Contact:

Re: Connection refused

Post by edwin1234 »

Sorry firewizzard didnt gave you enough information
Plugwise2py is in a docker container but Mqtt broker is not

Device is Electricity instant and counter
Want to see current power and Energy
Each plugwise plug has a macadres thats the number like 000D6F00003FD2F9
You say: Another remark is that you filter the received payload on a value of FD2F9
i made for each device a seperate flow , thats why the filtering is, FD2F9 its the end part of the macadres for in this example the wasmachine

The program i use is called MQTTAnalyzer, its on an ipad

Each plugwise plug gives: state,energie, and power

Like this:
plugwise2py/state/circle/000D6F00003FD2F9
{"power8s": 0.0, "powerts": 0, "name": "wasmachine", "schedule": "off", "requid": "unset", "power1s": 0.0, "switchreq": "?", "readonly": false, "interval": 60, "switch": "on", "mac": "000D6F00003FD2F9", "production": false, "monitor": true, "lastseen": 1649963534, "power1h": 0.0, "online": true, "savelog": true, "type": 2, "reverse_pol": true, "schedname": "", "location": "zolder"}

plugwise2py/state/energy/000D6F00003FD2F9
{"typ":"pwenergy","ts":1649818800,"mac":"000D6F00003FD2F9","power":0.3887,"energy":0.3887,"cum_energy":344803.6622,"interval":60}

plugwise2py/state/power/000D6F00003FD2F9
{"typ":"pwpower","ts":1649963701,"mac":"000D6F00003FD2F9","power":0.57}
User avatar
FireWizard
Posts: 1770
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

Re: Connection refused

Post by FireWizard »

Good evening @edwin1234,

Thanks for the extra info.
Plugwise2py is in a docker container but Mqtt broker is not
Just to verify. The fact that plugwise2py is running inside a Docker container and the MQTT broker is running outside that Docker container does not cause any communications issues? If that is running fine, we can exclude this as a possible source of problems.
Device is Electricity instant and counter
Want to see current power and Energy
That is okay. How many Plugwise units do you have?

You have 3 possible topics:
1. plugwise2py/state/circle/000D6F00003FD2F9
2. plugwise2py/state/energy/000D6F00003FD2F9
3. plugwise2py/state/power/000D6F00003FD2F9
If I look to the published payloads, I do not see anything in topic 1, you might be interested in. So we can skip that topic. Agree?
In the second topic, I see the "power' and "cum_energy", which are the values, you need. Correct?
In the third, I only see the "power", which should be equal to the "power" in topic 2. If measured at the same time. Can you confirm?

If this is all correct, we can convert only the 2 values in topic 2 and send these to Domoticz by MQTT.

Let me know.

Regards
edwin1234
Posts: 252
Joined: Sunday 09 October 2016 20:20
Target OS: Raspberry Pi / ODroid
Domoticz version: 2021.1
Location: Nederland
Contact:

Re: Connection refused

Post by edwin1234 »

Thanks for helping me,
I have 14 plugwise circles each with there own mac adress.
There are no communication issues to mqtt

You say:
If I look to the published payloads, I do not see anything in topic 1, you might be interested in. So we can skip that topic. Agree? - yes

In the second topic, I see the "power' and "cum_energy", which are the values, you need. Correct? -yes
In the third, I only see the "power", which should be equal to the "power" in topic 2. If measured at the same time. Can you confirm? -yes
User avatar
FireWizard
Posts: 1770
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

Re: Connection refused

Post by FireWizard »

Hello Edwin (@edwin1234)

I created a very simple flow, which you have to copy 14 times, as you mentioned you have 14 Plugwise units.

Screenshot_Plugwise_flow4.png
Screenshot_Plugwise_flow4.png (12.37 KiB) Viewed 5257 times
- Do not copy the two "Debug" nodes as, they are only there, to show you the result.
- Change the topic in the MQTT input node (Plugwise IN) to match the MAC addresses of your Plugwise module.
- Change the configuration of the MQTT server to your IP address and maybe username/password.
- Change the idx number in the "Function" node of the created virtual sensors, in order to match your sensors (currently 16).

The debug nodes will show you something like:

Screenshot_Plugwise_flow5.png
Screenshot_Plugwise_flow5.png (32.21 KiB) Viewed 5257 times
This will result in:

Screenshot_Plugwise_flow6.png
Screenshot_Plugwise_flow6.png (41.98 KiB) Viewed 5257 times
Let me know, if this is what you want.

Regards
Last edited by FireWizard on Thursday 02 June 2022 21:11, edited 1 time in total.
edwin1234
Posts: 252
Joined: Sunday 09 October 2016 20:20
Target OS: Raspberry Pi / ODroid
Domoticz version: 2021.1
Location: Nederland
Contact:

Re: Connection refused

Post by edwin1234 »

Hi Firewizard,
That is indeed what i want. :D
As soon as you show the exported flow i will try it out.
Thank u very much
User avatar
FireWizard
Posts: 1770
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

Re: Connection refused

Post by FireWizard »

Hereby the flow. I forgot it.

Code: Select all

[
    {
        "id": "e79887382d5fd11e",
        "type": "mqtt in",
        "z": "82652e5a2a4c0381",
        "name": "Plugwise IN",
        "topic": "plugwise2py/state/energy/000D6F00003FD2F9",
        "qos": "2",
        "datatype": "json",
        "broker": "541cd84c.f2963",
        "nl": false,
        "rap": true,
        "rh": 0,
        "inputs": 0,
        "x": 150,
        "y": 760,
        "wires": [
            [
                "24bc0ab44f50b392",
                "670f27e46aad99b8"
            ]
        ]
    },
    {
        "id": "24bc0ab44f50b392",
        "type": "debug",
        "z": "82652e5a2a4c0381",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 350,
        "y": 820,
        "wires": []
    },
    {
        "id": "670f27e46aad99b8",
        "type": "function",
        "z": "82652e5a2a4c0381",
        "name": "",
        "func": "msg.payload = {\"command\":\"udevice\", \"idx\":16, \"svalue\":msg.payload.power.toString() + \";\" + msg.payload.cum_energy.toString()}\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 340,
        "y": 760,
        "wires": [
            [
                "d45891eef07452a9",
                "1ec41215c08a6cb9"
            ]
        ]
    },
    {
        "id": "d45891eef07452a9",
        "type": "debug",
        "z": "82652e5a2a4c0381",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 530,
        "y": 820,
        "wires": []
    },
    {
        "id": "1ec41215c08a6cb9",
        "type": "mqtt out",
        "z": "82652e5a2a4c0381",
        "name": "To Domoticz",
        "topic": "domoticz/in",
        "qos": "0",
        "retain": "false",
        "respTopic": "",
        "contentType": "",
        "userProps": "",
        "correl": "",
        "expiry": "",
        "broker": "541cd84c.f2963",
        "x": 530,
        "y": 760,
        "wires": []
    },
    {
        "id": "541cd84c.f2963",
        "type": "mqtt-broker",
        "name": "",
        "broker": "127.0.0.1",
        "port": "1883",
        "clientid": "",
        "autoConnect": true,
        "usetls": false,
        "protocolVersion": "4",
        "keepalive": "15",
        "cleansession": true,
        "birthTopic": "",
        "birthQos": "0",
        "birthRetain": "false",
        "birthPayload": "",
        "birthMsg": {},
        "closeTopic": "",
        "closeRetain": "false",
        "closePayload": "",
        "closeMsg": {},
        "willTopic": "",
        "willQos": "0",
        "willRetain": "false",
        "willPayload": "",
        "willMsg": {},
        "sessionExpiry": ""
    }
]
Regards
edwin1234
Posts: 252
Joined: Sunday 09 October 2016 20:20
Target OS: Raspberry Pi / ODroid
Domoticz version: 2021.1
Location: Nederland
Contact:

Re: Connection refused

Post by edwin1234 »

It looks like its working,
I will test it a few days and let you know.

Thank u
edwin1234
Posts: 252
Joined: Sunday 09 October 2016 20:20
Target OS: Raspberry Pi / ODroid
Domoticz version: 2021.1
Location: Nederland
Contact:

Re: Connection refused

Post by edwin1234 »

It worked once,
In node red i can see in the debug that the mqtt flow only comes once and after that no new messages.
With MQTTAnalyzer is multiple messages apear.
What can i do?
User avatar
FireWizard
Posts: 1770
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

Re: Connection refused

Post by FireWizard »

Hello @Edwin1234.

Hmm, strange, I will take a look and come back to you.

What is the topic you look at, with your MQTTAnalyzer?

Do you only see one message in the Debug node, connected to the MQTT node?
Or only the Debug node, connected to the Function node?

Regards
User avatar
FireWizard
Posts: 1770
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

Re: Connection refused

Post by FireWizard »

Hello @edwin1234.

I checked the flow and injected multiple payloads, with the topic "plugwise2py/state/energy/000D6F00003FD2F9".
It just does what it should do, every time.

Did you do some other things, additions or changes to the flow, etc?

Regards
edwin1234
Posts: 252
Joined: Sunday 09 October 2016 20:20
Target OS: Raspberry Pi / ODroid
Domoticz version: 2021.1
Location: Nederland
Contact:

Re: Connection refused

Post by edwin1234 »

No I didn’t,
It was working in the beginning but now my devices in domoticz are red.
And the node red flow to domoticz says connected.
Its strange.
User avatar
FireWizard
Posts: 1770
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

Re: Connection refused

Post by FireWizard »

Hi, @edwin1234,

Can you answer my previous questions?
What is the topic you look at, with your MQTTAnalyzer?
and
Do you only see one message in the Debug node, connected to the MQTT node?
Or only the Debug node, connected to the Function node?
Regards
edwin1234
Posts: 252
Joined: Sunday 09 October 2016 20:20
Target OS: Raspberry Pi / ODroid
Domoticz version: 2021.1
Location: Nederland
Contact:

Re: Connection refused

Post by edwin1234 »

Hi Firewizard
Sorry didnt saw your message
I have add some pictures hope that makes it clear.
[img][
2F7B1294-195B-4629-A82D-38403C9EB3D1.png
2F7B1294-195B-4629-A82D-38403C9EB3D1.png (123.61 KiB) Viewed 5197 times
/img]
2F7B1294-195B-4629-A82D-38403C9EB3D1.png
2F7B1294-195B-4629-A82D-38403C9EB3D1.png (123.61 KiB) Viewed 5197 times
22AFA70B-9473-4F17-B674-431A0CCFC3EA.png
22AFA70B-9473-4F17-B674-431A0CCFC3EA.png (112.06 KiB) Viewed 5197 times
MQTTAnalyzer shows 2 messages and node red one
Thanks for your help
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest