[90] MQTT Support

Use this forum to discuss possible implementation of a new feature before opening a ticket.
A developer shall edit the topic title with "[xxx]" where xxx is the id of the accompanying tracker id.
Duplicate posts about the same id. +1 posts are not allowed.

Moderators: leecollings, remb0

MeAlbert
Posts: 65
Joined: Friday 06 December 2019 14:23
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.1
Contact:

Re: [90] MQTT Support

Post by MeAlbert »

I have a now and then problem left. I get the following message:
27-10-2020 12:04:32node: dc3574e1.4bac9msg : string[41]
"Unexpected token W in JSON at position 16"
27-10-2020 12:04:32node: 5627d816.529848
domoticz/out : msg.payload : Object
{ command: "udevice", idx: 86, svalue: "232W" }
The svalue is 232W and that's not correct and I get an error message.

The strange thing is that suddenly the W error disappears and I get a C error in a temperature device. The input from MQTT is:
domoticz/out : msg.payload : Object
object
Battery: 255
EnergyMeterMode: "0"
RSSI: 12
description: ""
dtype: "General"
hwid: "11"
id: "000B0004"
idx: 86
name: "PV Vermogen Garage"
nvalue: 0
stype: "kWh"
svalue1: "200W"
svalue2: "1300400.0"
unit: 4
It looks that the mistake already starts when domoticz is making the mqtt/out message. Any idea what I can do about it?
dbrb2
Posts: 13
Joined: Saturday 07 March 2020 14:32
Target OS: -
Domoticz version:
Contact:

Re: [90] MQTT Support

Post by dbrb2 »

Evening,
I have a strange MQTT problem:

I have a wifi dimmer running Tasmota
It is autoDiscovered by Domoticz fine, appearing as a switch with a dimmer slider.

From the domoticz UI, I can set the brightness level, and the dimmer responds. In response, the Domoticz UI updates to match reality.
However, if I toggle the switch from the Domoticz UI, though the light responds, turning OFF / ON as requested, the Domoticz UI does not update

I can only assume that some MQTT response that is expected has not been seen:

Switching the dimmer on using the Domoticz UI icon does indeed turn the light on - but the UI does not change - it still thinks it is off.

Taken from the device logs:

Code: Select all

00:17:49.466 MQT: tele/bedroom_light/SENSOR = {"Time":"2021-11-30T00:17:49","COUNTER":{"C1":0}}
00:17:50.452 SRC: MQTT
00:17:50.454 CMD: Grp 0, Cmnd 'POWER', Idx 1, Len 2, Data 'ON'
00:17:50.468 MQT: tele/bedroom_light/STATE = {"Time":"2021-11-30T00:17:50","Uptime":"0T01:10:10","UptimeSec":4210,"Heap":23,"SleepMode":"Dynamic","Sleep":10,"LoadAvg":19,"MqttCount":1,"POWER":"ON","Dimmer":44,"Fade":"OFF","Speed":1,"LedTable":"ON","Wifi":{"AP":1,"SSId":"barkernet","BSSId":"78:65:59:7C:9E:47","Channel":6,"Mode":"11n","RSSI":100,"Signal":-50,"LinkCount":1,"Downtime":"0T00:00:03"}}
00:17:50.474 MQT: stat/bedroom_light/RESULT = {"POWER":"ON"}
00:17:50.476 MQT: stat/bedroom_light/POWER = ON
00:17:50.488 MQT: tele/bedroom_light/HASS_STATE = {"Version":"10.0.0(tasmota)","BuildDateTime":"2021-11-29T22:05:54","Module or Template":"WiFi-Dimmer","RestartReason":"Software/System restart","Uptime":"0T01:10:10","Hostname":"bedroom-light-6487","IPAddress":"192.168.1.23","RSSI":"100","Signal (dBm)":"-50","WiFi LinkCount":1,"WiFi Downtime":"0T00:00:03","MqttCount":1,"LoadAvg":19}
00:17:50.558 CFG: Saved to flash at FB, Count 1444, Bytes 4096
The Domoticz logs for the same event show:

Code: Select all

2021-11-29 23:16:28.635 MQTT: onMQTTPublish: tele/bedroom_light/STATE:b'{"Time":"2021-11-30T00:16:28","Uptime":"0T01:08:48","UptimeSec":4128,"Heap":23,"SleepMode":"Dynamic","Sleep":10,"LoadAvg":32,"MqttCount":1,"POWER":"ON","Dimmer":45,"Fade":"OFF","Speed":1,"LedTable":"ON","Wifi":{"AP":1,"SSId":"barkernet","BSSId":"78:65:59:7C:9E:47","Channel":6,"Mode":"11n","RSSI":100,"Signal":-50,"LinkCount":1,"Downtime":"0T00:00:03"}}'
2021-11-29 23:16:28.635 MQTT: getDevices key: '' configkey: '' hasconfigkey: '' value: '' config: '' topic: 'tele/bedroom_light/STATE'
2021-11-29 23:16:28.636 MQTT: getDevices found 1 devices
2021-11-29 23:16:28.636 MQTT: Got state_topic
2021-11-29 23:16:28.636 MQTT: No value_template
2021-11-29 23:16:28.636 MQTT: nValue: '0'
2021-11-29 23:16:28.636 MQTT: Got brightness_state_topic
2021-11-29 23:16:28.637 MQTT: brightness_value_template: 'Dimmer'
2021-11-29 23:16:28.637 MQTT: message[brightness_value_template]: '45'
2021-11-29 23:16:28.506 Status: User: Admin (IP: 192.168.1.154) initiated a switch command (2659/MQTT - Bedroom light/On)
Could the issue be related to the "no value_template" line...?

Cheers!
smitex
Posts: 2
Joined: Thursday 31 December 2020 18:09
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: [90] MQTT Support

Post by smitex »

Hello,
can someone help me to import data from Mqtt to Domoticz.
I want to import data to a specific IDX.
I made a screenshot of MQTT Explorer, but can't figure out how to import these values.

so:
Input to an IDX
Output to an IDX
Flow to an IDX
Watt to an IDX
I want to do it with a Node-RED sequence (flow)
any help would be appreciate
Thanks, Peter
Attachments
Screenshot MQTT Explorer
Screenshot MQTT Explorer
import data.jpg (193.76 KiB) Viewed 2286 times
User avatar
waltervl
Posts: 5148
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: [90] MQTT Support

Post by waltervl »

smitex wrote: Friday 18 February 2022 16:16 Hello,
can someone help me to import data from Mqtt to Domoticz.

I want to do it with a Node-RED sequence (flow)
any help would be appreciate
Thanks, Peter
You better create a new topic in the Node-red sub topic to get better help viewforum.php?f=81
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: 1745
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

Re: [90] MQTT Support

Post by FireWizard »

Hello @smitex,

I do not understand, why you raise this issue again at this forum this afternoon.
It has been answered yesterday.Do not post the same issue at multiple forums.

See: https://discourse.nodered.org/t/mqtt-da ... -idx/58476

Regards
smitex
Posts: 2
Joined: Thursday 31 December 2020 18:09
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: [90] MQTT Support

Post by smitex »

Oh, sorry FireWizard,

I did not jet see you post, thank you very much for you repley,
I will test you nodered flow👍👌
mjchrist
Posts: 2
Joined: Monday 12 November 2018 12:05
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: [90] MQTT Support

Post by mjchrist »

In response to the Domoticz WIKI "MQTT - Arduino, Needed! Please Help." I use the sketch (Arduino) which you can find in the forum at:

viewtopic.php?t=38155

The advantage of the sketch is that you only need Mosquitto as a broker and that NodeRED does not have to be installed.
Paulus
Posts: 1
Joined: Sunday 24 June 2018 11:35
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: [90] MQTT Support

Post by Paulus »

Hi,

I'm not sure if this question already is answered (I couldn't find it at least).
Is it possible to update multiple sensors in one message (MQTT > Domoticz)?

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

Re: [90] MQTT Support

Post by FireWizard »

Hello @Paulus,

To answer your question.

No this is not possible.

In one MQTT message you can only address one idx number and so you can update only one sensor.

See the Wiki: https://www.domoticz.com/wiki/MQTT and specific the chapter MQTT to Domoticz.

Regards
niki_lauda
Posts: 115
Joined: Saturday 31 August 2013 14:48
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Eindhoven (NL)
Contact:

Re: [90] MQTT Support

Post by niki_lauda »

dbrb2 wrote: Monday 29 November 2021 21:40 Evening,
I have a strange MQTT problem:

I have a wifi dimmer running Tasmota
It is autoDiscovered by Domoticz fine, appearing as a switch with a dimmer slider.

From the domoticz UI, I can set the brightness level, and the dimmer responds. In response, the Domoticz UI updates to match reality.
However, if I toggle the switch from the Domoticz UI, though the light responds, turning OFF / ON as requested, the Domoticz UI does not update

I can only assume that some MQTT response that is expected has not been seen:

Switching the dimmer on using the Domoticz UI icon does indeed turn the light on - but the UI does not change - it still thinks it is off.


Cheers!
However, if I toggle the switch from the Domoticz UI, though the light responds, turning OFF / ON as requested, the Domoticz UI does not update
Did you resolve this issue?
I am experincing the same, lights are switching on. In the log the switch is on but in the ui it stays off. Restart of domoticz an the ui is updated.
I am on 2023.2.
FlyingDomotic
Posts: 303
Joined: Saturday 27 February 2016 0:30
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.2
Contact:

Re: [90] MQTT Support

Post by FlyingDomotic »

Paulus wrote: Monday 03 July 2023 22:13 Hi,

I'm not sure if this question already is answered (I couldn't find it at least).
Is it possible to update multiple sensors in one message (MQTT > Domoticz)?

Kr, Paul
You may try https://github.com/FlyingDomotic/domoti ... per-plugin. You may use multiple topics on the same device and/or multiple devices on the same topic, and ... more!

And if some functions are missing, don't hesitate to ask for ;-)
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest