
I did (I think) exactly what was described in topic "Re: Get sensor values with MQTT into Domoticz"
Is there anyone who has an idea maybe?
Goal:
To get MQTT values from my second Raspberry Pi to my first RBPi Dummy Device via/with domoticz ánd mosquito ánd node-red.
Situation:
I have installed and running:
domoticz ánd mosquito ánd node-red on my Raspberry Pi 3B.
With "mosquitto_sub -v -t '#' " I do see all messages coming by via putty (see bottom)
Problem:
All goes fine exépt for the data to be updated in the domoticz-Device (idx).
Situation/what I have:
MQTT Hardware set in domotics with these settings:
Data Timeout: Disabled
Remote Address: localhost
Port 1883
Publish Topic: Index
A Dummy device created with name: GAS, type: gas, Idx: 289
Node-Red:
MQTT object, with the following settings:
Topic: p1monitor/smartmeter/consumption_gas_m3
Output: a parsed JSON object
Server: localhost : 1883
Client ID: p1monitor
JSON node:
Action: Convert between JSON string & object
Function:
switch (msg.topic) {
case "p1monitor/smartmeter/consumption_gas_m3":
msg.payload = {"command":"udevice","idx":289,"nvalue":0,"svalue": msg.payload};
}
return msg;
* Note: I also changed this to:
msg.payload = {"command":"udevice","idx":289,"nvalue":0,"svalue": 40 };
and
msg.payload = {"command":"udevice","idx":289,"nvalue":0,"svalue": "40"};
but that makes no differtence: the device won't update with the given value...
Debug output:
Code: Select all
[color=#404000]10/18/2021, 11:32:06 PMnode: 2a8a6f12fe8314fc
p1monitor/smartmeter/consumption_gas_m3 : msg.payload : Object
object
command: "udevice"
idx: 289
nvalue: 0
svalue: "40"[/color]
... repeatingly...
pi@raspberrypi:~ $ mosquitto_sub -v -t '#'
p1monitor/smartmeter/timestamp_local 2021-10-18 23:34:13
p1monitor/smartmeter/timestamp_utc 1634592853
p1monitor/smartmeter/consumption_gas_m3 1389.693
p1monitor/smartmeter/consumption_kwh_high 1656.412
p1monitor/smartmeter/consumption_kwh_low 1597.443
p1monitor/smartmeter/consumption_kw 0.555
p1monitor/smartmeter/production_kwh_high 1583.278
p1monitor/smartmeter/production_kwh_low 657.426
p1monitor/smartmeter/production_kw 0.0
p1monitor/smartmeter/tarifcode D
p1monitor/smartmeter/record_is_processed 0
p1monitor/phase/timestamp_local 2021-10-18 23:34:13
p1monitor/phase/timestamp_utc 1634592853
p1monitor/phase/consumption_l1_w 0.547
p1monitor/phase/consumption_l2_w 0.0
p1monitor/phase/consumption_l3_w 0.0
p1monitor/phase/production_l1_w 0.0
p1monitor/phase/production_l2_w 0.0
p1monitor/phase/production_l3_w 0.0
p1monitor/phase/l1_v 235.2
p1monitor/phase/l2_v 0.0
p1monitor/phase/l3_v 0.0
p1monitor/phase/l1_a 2.0
p1monitor/phase/l2_a 0.0
p1monitor/phase/l3_a 0.0
It is almost as if node-red misses some kind of package responsible for communicating with domoticz itself...
Any suggestion someone maybe?