Page 3 of 14
Re: Python Plugin: MqttMapper
Posted: Thursday 29 June 2023 20:19
by WBeulink
Attachment:
Re: Python Plugin: MqttMapper
Posted: Thursday 29 June 2023 20:46
by Kedi
Fill in the type and click on "Aanpassen"
Re: Python Plugin: MqttMapper
Posted: Thursday 29 June 2023 21:47
by Xenomes
Thanks for this great plugin!!
I used it to connect my Reolink doorbell with three switch/status to Domoticz with the uses of
Cam2MQTT
For the used code see:
- Spoiler: show
Code: Select all
{
"Visitor": {
"topic": "cam2mqtt/camera/reolink_cam_1/event/onvif/visitor",
"type": "244", "subtype": "73", "switchtype": "0",
"mapping": {"item": "", "default": "0", "values": {"off": "0", "on": "1"}}
},
"Motion": {
"topic": "cam2mqtt/camera/reolink_cam_1/event/onvif/motion",
"type": "244", "subtype": "73", "switchtype": "0",
"mapping": {"item": "", "default": "0", "values": {"off": "0", "on": "1"}}
},
"Status": {
"topic": "cam2mqtt/camera/reolink_cam_1/status",
"type": "244", "subtype": "73", "switchtype": "0",
"mapping": {"item": "", "default": "0", "values": {"offline": "0", "online": "1"}}
}
}
Re: Python Plugin: MqttMapper
Posted: Friday 30 June 2023 13:23
by WBeulink
Kedi wrote: ↑Thursday 29 June 2023 20:46
Fill in the type and click on "Aanpassen"
Thats what I did several times.
But the type and settings don't get saved.
So there is in hardware an item without hardware selection and without any settings.
Thats the problem.
Re: Python Plugin: MqttMapper
Posted: Friday 30 June 2023 19:02
by Kedi
Did you try to delete the hardware and create it again?
And is the file mqttmapper.json present and valid?
Re: Python Plugin: MqttMapper
Posted: Friday 30 June 2023 21:41
by Xenomes
WBeulink wrote: ↑Thursday 29 June 2023 20:19Attachment:
Sorry to break in, i saw you issue first i mind was a Bullseye or python 3.9.2 issue so i fire up my test system and updated to the latest version of Bullseye and Python and i was correct my test system shows the same problem a empty 'Type:'. I don't have a solution for you yet.
Re: Python Plugin: MqttMapper
Posted: Friday 30 June 2023 22:18
by Xenomes
I think you found a bug!
If you put a other plugin in the plugin folder that uses DomoticzEX framework the value of Type: of the Mapper plugin is visible.
So a dirty fix is:
Code: Select all
cd ~/domoticz/plugin
git clone https://github.com/stas-demydiuk/domoticz-zigbee2mqtt-plugin.git
sudo systemctl restart domoticz.service
You don't have to use the plugin as you see the plugin works.
Ps. the beta latest build 15372 has also the issue.
Re: Python Plugin: MqttMapper
Posted: Sunday 16 July 2023 11:37
by WBeulink
Thanks for your answer.
The "dirty trick" works!
But when I upgraded Bulseye afterwards the upgrade complete broke Domoticz.
Domoticz can't open port 8080 anymore. Other problem. Not this topic
So I decided to go back to Buster.
Fresh install and complete upgrade.
However i found that I still had to do the "dirty trick" to see hardware type and settings of the plugin.
So: maybe not Bulseye then. Domoticz stable without problems on Buster now.
See attachement:
Also as you see: adding extra folder wit second version of plugin (rename plugin key in plugin.py) adds the possibility to connect to second broker.
Nice!
Hope this will help ..
Willem
Re: Python Plugin: MqttMapper
Posted: Sunday 16 July 2023 11:49
by WBeulink
Question about a "thermostatic setpoint" in Domotic via this plugin.
I managed to create a thermostatic setpoint device in DZ via this plugin.
Correct device and correct reading and display of value of setpoint in DZ.
But I can't figure out how to change the setpoint from DZ.
I get in the logfile: Error: MQTT mapper: No mapping for MQTT mapper - Raam SetPoint heat
Value in DZ doesn't change and nothing send.
I have this in my .json file:
"Raam SetPoint cool": {
"topic": "homeassistant/Raam/67/0/setpoint/11",
"type": "242", "subtype": "1", "switchtype": "0",
"set": {"topic": "homeassistant/Raam/67/0/setpoint/11/set", "payload": {"value":"#"}},
"mapping": {"item": "value"}
}
I'am on plugin version: version="1.0.12"
Anyone with help on this??
Willem
Re: Python Plugin: MqttMapper
Posted: Sunday 16 July 2023 12:22
by FlyingDomotic
Amazing, as French user was integrating a setPoint device 2 days ago, and find a bug, which is fixed in last version.
Could you please upgrade MqttMqpper and try again?
Re: Python Plugin: MqttMapper
Posted: Sunday 16 July 2023 14:16
by WBeulink
Just now I found version 1.0.13
Updated friday to 1.0.12
Updated to 13 and it works!
Great.
Willem
Re: Python Plugin: MqttMapper
Posted: Wednesday 19 July 2023 21:48
by WBeulink
Still playing around with this plugin.
version 1.0.13 Got some created devices working in DZ. But:
Found a problem. Or maybe I'am doing things wrong.
It has to do with a payload in JSON format and using 2 values from that in one device ...
See part of JSON-file
Working:
"Minisensor-1H": {
"topic": "home/OpenMQTTGateway_ESP32_BLE/BTtoMQTT/A4C1384BF6E8",
"type": "81", "subtype": "1", "switchtype": "0",
"mapping": {"item": "hum"}
},
Working also:
"Minisensor-1T": {
"topic": "home/OpenMQTTGateway_ESP32_BLE/BTtoMQTT/A4C1384BF6E8",
"key": "Minisensor-1T",
"type": "80", "subtype": "5", "switchtype": "0",
"mapping": {"item": "tempc"}
},
Not working (device is created but never receives any data):
"topic": "home/OpenMQTTGateway_ESP32_BLE/BTtoMQTT/A4C1384BF6E8",
"key": "Minisensor-1TH",
"type": "82", "subtype": "1", "switchtype": "0",
"mapping": {"item": "tempc;hum"}
}
key's used because it's one topic for all three devices.
That works OK!
Any idea?
Willem
Re: Python Plugin: MqttMapper
Posted: Wednesday 19 July 2023 22:26
by WBeulink
I have to correct. The device icon doesn't show data. But the device log does!
- screenshot.5.jpg (102.3 KiB) Viewed 1271 times
- screenshot.6.jpg (99.06 KiB) Viewed 1271 times
Strange.
Willem
Re: Python Plugin: MqttMapper
Posted: Wednesday 19 July 2023 23:14
by WBeulink
What to do in mapping if the JSON read from the topic is hierachic?
Like this one:
{
"Time": "2023-07-19T22:10:16",
"AM2301": {
"Temperature": 24.5,
"Humidity": 77.1,
"DewPoint": 20.2
},
"TempUnit": "C"
}
Re: Python Plugin: MqttMapper
Posted: Wednesday 19 July 2023 23:32
by FlyingDomotic
Structure you're using is made for merging 2 different MQTT topics in the same Domoticz device.
In your case, all data needed to load Domoticz device is present in the same topic. Could you try:
Code: Select all
"Minisensor-1": {
"topic": "home/OpenMQTTGateway_ESP32_BLE/BTtoMQTT/A4C1384BF6E8",
"type": "82", "subtype": "1", "switchtype": "0",
"mapping": {"item": "Temperature;Humidity"}
}
Re: Python Plugin: MqttMapper
Posted: Thursday 20 July 2023 0:01
by WBeulink
But the JSON is not flat.
So I need something like:
"mapping": {"item": "AM2301/Temperature;AM2301/Humidity"}
to adress the values properly.
I have this in domoticz log as error:
2023-07-20 00:06:16.904 Error: MQTT mapper: Can't find >Temperature< in >{'Time': '2023-07-19T23:06:16', 'AM2301': {'Temperature': 24.4, 'Humidity': 77.6, 'DewPoint': 20.2}, 'TempUnit': 'C'}<
2023-07-20 00:05:16.953 Error: MQTT mapper: Can't find >Humidity< in >{'Time': '2023-07-19T23:05:16', 'AM2301': {'Temperature': 24.4, 'Humidity': 77.5, 'DewPoint': 20.2}, 'TempUnit': 'C'}<
Re: Python Plugin: MqttMapper
Posted: Friday 21 July 2023 11:02
by FlyingDomotic
You're right, I didn't saw the AM2301 in the message. Does
Code: Select all
"mapping": {"item": "AM2301/Temperature;AM2301/Humidity"}
work?
Re: Python Plugin: MqttMapper
Posted: Friday 21 July 2023 21:40
by WBeulink
No. Doesn't work. Alas.
Of cause it's possible to do things like this in Node Red.
But nice thing of this plugin is that maybe we can do things like this without Node Red.
I'am afraid it takes some programming effort to add this functionality.
But maybe .....
Willem
Re: Python Plugin: MqttMapper
Posted: Friday 21 July 2023 22:15
by FlyingDomotic
I made it work with:
Code: Select all
"Minisensor-1": {
"topic": "home/OpenMQTTGateway_ESP32_BLE/BTtoMQTT/A4C1384BF6E8",
"type": "82", "subtype": "1", "switchtype": "0",
"mapping": {"item": "AM2301/Temperature;AM2301/Humidity;~0"}
}
Problem was related to the missing ;~0 at end of data.
Re: Python Plugin: MqttMapper
Posted: Friday 21 July 2023 23:34
by WBeulink
Confirm. Works! Thanks.
So ~0 is third item of svalue in DZ?
As expected by this device in DZ?
In that case both of my problems are solved.
Confirmd.
See above .....
Willem