Python Plugin: MqttMapper
Moderator: leecollings
-
- Posts: 156
- Joined: Friday 27 May 2016 20:15
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Location: nederland
- Contact:
Re: Python Plugin: MqttMapper
thank you....looks like it did the job.
now i have to bepatient and see if there is a change when the bypass changes.
now i have to bepatient and see if there is a change when the bypass changes.
-
- Posts: 322
- Joined: Saturday 27 February 2016 0:30
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2020.2
- Contact:
Re: Python Plugin: MqttMapper
Nothing protects against chance!
-
- Posts: 2
- Joined: Monday 15 July 2024 6:50
- Target OS: Linux
- Domoticz version:
- Contact:
Re: Python Plugin: MqttMapper
Hi everyone!
Is there a way to have the script refresh the incoming values from MQTT at the rate they come in and not every 60 seconds like now?
I have Domoticz paired with a BMS and this BMS sends MQTT data every 5 seconds to Domoticz, but the script updates the data every minute.
Is there a way to have the script refresh the incoming values from MQTT at the rate they come in and not every 60 seconds like now?
I have Domoticz paired with a BMS and this BMS sends MQTT data every 5 seconds to Domoticz, but the script updates the data every minute.
-
- Posts: 322
- Joined: Saturday 27 February 2016 0:30
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2020.2
- Contact:
Re: Python Plugin: MqttMapper
As of now, plugin is triggered as soon as MQTT sends data (so every 5 seconds in your case).
If you write a script to do something, you may use a "device change" trigger instead of a "timer trigger". This means that script will be activated each time device changes (in this case, specify device which receive MQTT change as trigger), instead of every minute.
Here's an example for LUA script:
... and one for dzVents script:
Change 'myDomoticzMqttDevice' by your Domoticz MQTT device name (those given in your MqttMapper.jspn file).
If you write a script to do something, you may use a "device change" trigger instead of a "timer trigger". This means that script will be activated each time device changes (in this case, specify device which receive MQTT change as trigger), instead of every minute.
Here's an example for LUA script:
Code: Select all
commandArray = {}
-- loop through all the changed devices
for deviceName,deviceValue in pairs(devicechanged) do
if (deviceName=='myDomoticzMqttDevice') then
<put here commands you want to be executed each time 'myDomoticzMqttDevice' is changed>
end
end
Code: Select all
return {
on = {devices = {'myDomoticzMqttDevice'}},
logging = {level = domoticz.LOG_DEBUG, marker = 'template'},
execute = function(domoticz, device)
<put here commands you want to be executed each time 'myDomoticzMqttDevice' is changed>
end
}
-
- Posts: 2
- Joined: Monday 15 July 2024 6:50
- Target OS: Linux
- Domoticz version:
- Contact:
Re: Python Plugin: MqttMapper
Thank you so much for your quick help - it works!FlyingDomotic wrote: ↑Monday 15 July 2024 11:11 As of now, plugin is triggered as soon as MQTT sends data (so every 5 seconds in your case).[...]

Thank you also for the amazing domoticz plugin!!!
-
- Posts: 322
- Joined: Saturday 27 February 2016 0:30
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2020.2
- Contact:
Re: Python Plugin: MqttMapper
As already told: Nothing protects against chance!
-
- Posts: 246
- Joined: Sunday 30 March 2014 15:24
- Target OS: Linux
- Domoticz version: Beta
- Location: Waterland
- Contact:
Re: Python Plugin: MqttMapper
I have started a topic in utility but it looks that mqttmapper can give me a better solution. My smartevse open source electric car
Loader can communicate via mqtt. But in I am missing the payload and therefore I can’t integrate with domoticz. Mqttmapper is already installed but how canI proceed from there. Is it possible?
https://www.domoticz.com/forum/viewtopi ... 68#p318968
Loader can communicate via mqtt. But in I am missing the payload and therefore I can’t integrate with domoticz. Mqttmapper is already installed but how canI proceed from there. Is it possible?
https://www.domoticz.com/forum/viewtopi ... 68#p318968
Rpi, RFXcom, klikaan klikuit switch,thermosmart, z-wave, espeasy, smartevse
-
- Posts: 322
- Joined: Saturday 27 February 2016 0:30
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2020.2
- Contact:
Re: Python Plugin: MqttMapper
I'll answer directly in https://www.domoticz.com/forum/viewtopi ... 68#p318968
-
- Posts: 59
- Joined: Sunday 15 March 2015 19:53
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2023.2
- Location: Hamburg
- Contact:
Re: Python Plugin: MqttMapper
It`s nice to see that the project MqttMapper is under development and it's a great tool to get Mqtt messages integrated to Domoticz. I am using this plugin since several months but I did a mistake. I was updating the plugin and now the devices in Domoticz are showing only "Zero" values. It was a very simple setup in the MqttMapper.json file.
"BME680_1 Iaq": {
"topic": "BME680_01/iaq",
"type": "249", "subtype":"1",
"mapping":{"item":""}
},
What I am doing wrong and where is the hint? Data are available in Mqtt Explorer. Any help is welcome
"BME680_1 Iaq": {
"topic": "BME680_01/iaq",
"type": "249", "subtype":"1",
"mapping":{"item":""}
},
What I am doing wrong and where is the hint? Data are available in Mqtt Explorer. Any help is welcome
-
- Posts: 322
- Joined: Saturday 27 February 2016 0:30
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2020.2
- Contact:
Re: Python Plugin: MqttMapper
Should be fixed in last version. Sorry about that!
-
- Posts: 59
- Joined: Sunday 15 March 2015 19:53
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2023.2
- Location: Hamburg
- Contact:
Re: Python Plugin: MqttMapper
How can the MqttMapper be updated after changing the MqttMapper.json e.g. after adding a new device. Updating the Idx under hardware is not possible. Until now I deleted the Idx and re-entered it again. But in this case I get every time new devices in the database. Also activating/deactivating is not reading the changed json file.
-
- Posts: 322
- Joined: Saturday 27 February 2016 0:30
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2020.2
- Contact:
Re: Python Plugin: MqttMapper
Just restart MqttMapper plug-in, either selecting it on "Hardware" tab and clicking on "Update", or restarting Domoticz.thaui wrote: ↑Wednesday 21 August 2024 17:28 How can the MqttMapper be updated after changing the MqttMapper.json e.g. after adding a new device. Updating the Idx under hardware is not possible. Until now I deleted the Idx and re-entered it again. But in this case I get every time new devices in the database. Also activating/deactivating is not reading the changed json file.
-
- Posts: 59
- Joined: Sunday 15 March 2015 19:53
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2023.2
- Location: Hamburg
- Contact:
Re: Python Plugin: MqttMapper
that's exactly what I ment. With restart Domoticz it works but selecting it on "Hardware" tab and clicking on "Update" nothing happend at all. I am on RPI3 with the latest stable release. By the way if you read this email. I am fighting to read P1meter values from a tasmota device.
I want to get "export_total_kwh","total_kwh" and "curr_w". No chance to get value to Domoticz-
- Posts: 322
- Joined: Saturday 27 February 2016 0:30
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2020.2
- Contact:
Re: Python Plugin: MqttMapper
They're 2 classical things that may cause issues:
1) published data is not marked as "retain". In this case, MqttMapper won't be updated until value changes. It's generally a good idea to flag topics "retain", as readers staring after last update could see last value.
2) you made changes into device type/subtype/switchtype/options not allowed by Domoticz. In this case, you have to delete device and restart plug-in in order for a new one to be crated with last settings.
1) published data is not marked as "retain". In this case, MqttMapper won't be updated until value changes. It's generally a good idea to flag topics "retain", as readers staring after last update could see last value.
2) you made changes into device type/subtype/switchtype/options not allowed by Domoticz. In this case, you have to delete device and restart plug-in in order for a new one to be crated with last settings.
-
- Posts: 184
- Joined: Friday 12 January 2018 8:26
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Python Plugin: MqttMapper
My MQTT mapper stopped working, the signals running and signal are failing. In MQTT explorer they are both true.
It used to work fine. The temperature readouts are fine. What changed?
{
"T_Outside": {
"topic": "ebusd/broadcast/outsidetemp",
"type": "80", "subtype": "5", "switchtype": "0",
"mapping": {"item": "", "multiplier": 1}
},
"T_Living": {
"topic": "ebusd/ctlv2/z1RoomTemp",
"type": "80", "subtype": "5", "switchtype": "0",
"mapping": {"item": "", "multiplier": 1}
},
"MQTTrunning": {
"topic": "ebusd/global/running",
"type": "244", "subtype": "73", "switchtype": "0",
"mapping": {"item": "", "default": "0", "values": {"True": "1"}}
},
"MQTTsignal": {
"topic": "ebusd/global/signal",
"type": "244", "subtype": "73", "switchtype": "0",
"mapping": {"item": "", "default": "0", "values": {"True": "1"}}
}
}
It used to work fine. The temperature readouts are fine. What changed?
{
"T_Outside": {
"topic": "ebusd/broadcast/outsidetemp",
"type": "80", "subtype": "5", "switchtype": "0",
"mapping": {"item": "", "multiplier": 1}
},
"T_Living": {
"topic": "ebusd/ctlv2/z1RoomTemp",
"type": "80", "subtype": "5", "switchtype": "0",
"mapping": {"item": "", "multiplier": 1}
},
"MQTTrunning": {
"topic": "ebusd/global/running",
"type": "244", "subtype": "73", "switchtype": "0",
"mapping": {"item": "", "default": "0", "values": {"True": "1"}}
},
"MQTTsignal": {
"topic": "ebusd/global/signal",
"type": "244", "subtype": "73", "switchtype": "0",
"mapping": {"item": "", "default": "0", "values": {"True": "1"}}
}
}
-
- Posts: 322
- Joined: Saturday 27 February 2016 0:30
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2020.2
- Contact:
Re: Python Plugin: MqttMapper
Would it be possible to get content concerned topics (probably ebusd/global/running)? the way this is coded, value is on if topic is "True", off else.
In addition when something stops working, try to figure out what changed recently (an update of code/firmware could easily be cause of this kind of problem). Did you changed something recently?
In addition when something stops working, try to figure out what changed recently (an update of code/firmware could easily be cause of this kind of problem). Did you changed something recently?
-
- Posts: 184
- Joined: Friday 12 January 2018 8:26
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Python Plugin: MqttMapper
Well I needed to reinstall the complete system due to a docker crash.
I simply don't know what is going wrong with this and have no clue, from your reaction you don't either .... I thought maby you changed something in the code of MQTT mapper
My MQTT mapper stopped working, the signals running and signal are failing, in MQTT explorer they are both true. It used to work fine. The temperature readouts are fine, but i needed to change the multiplier (from 0.1 to 1)

I simply don't know what is going wrong with this and have no clue, from your reaction you don't either .... I thought maby you changed something in the code of MQTT mapper
My MQTT mapper stopped working, the signals running and signal are failing, in MQTT explorer they are both true. It used to work fine. The temperature readouts are fine, but i needed to change the multiplier (from 0.1 to 1)
- Attachments
-
- Doc1.docx
- (204.11 KiB) Downloaded 25 times
Last edited by hjzwiers on Friday 23 August 2024 10:28, edited 1 time in total.
-
- Posts: 322
- Joined: Saturday 27 February 2016 0:30
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2020.2
- Contact:
Re: Python Plugin: MqttMapper
Running MqttMapper with debug and sending me Domoticz log in PM may help 
Meantime, would it be possible to get a copy of ebusd topics?

Meantime, would it be possible to get a copy of ebusd topics?
-
- Posts: 184
- Joined: Friday 12 January 2018 8:26
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Python Plugin: MqttMapper
I sent a screenshot of MQTT explorer, here is the relevant data:
During startup the logging is totally filled with MQTT auto discovery .........
2024-08-23 11:15:22.097 MQTT mapper: Sending 2 bytes of data
2024-08-23 11:15:22.097 MQTT mapper: c0 00 .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. ..
2024-08-23 11:15:22.147 MQTT mapper: Received 2 bytes of data
2024-08-23 11:15:22.147 MQTT mapper: d0 00 .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. Ю
2024-08-23 11:33:08.489 MQTT mapper: Received 33 bytes of data
2024-08-23 11:33:08.489 MQTT mapper: 30 1f 00 16 65 62 75 73 64 2f 63 74 6c 76 32 2f 7a 31 52 6f 0...ebusd/ctlv2/z1Ro
2024-08-23 11:33:08.489 MQTT mapper: 6f 6d 54 65 6d 70 32 33 2e 37 38 37 35 .. .. .. .. .. .. .. omTemp23.7875
2024-08-23 11:33:08.490 MQTT mapper: onMQTTPublish found ebusd/ctlv2/z1RoomTemp, Device 'MQTT mapper - T_Living', message '23.7875'
2024-08-23 11:33:08.490 MQTT mapper: Setting MQTT mapper - T_Living to 24/23.7875
2024-08-23 11:33:08.490 (MQTT mapper - T_Living) Updating device from 24:'23.725' to have values 24:'23.7875'.
(there is a small box with I think a question mark in the c0 00 but it is not displayed)
I removed the part behind "default": "0" and it is working! I don't know why though ...........
"MQTTrunning": {
"topic": "ebusd/global/running",
"type": "244", "subtype": "73", "switchtype": "0",
"mapping": {"item": "", "default": "0"}
During startup the logging is totally filled with MQTT auto discovery .........
2024-08-23 11:15:22.097 MQTT mapper: Sending 2 bytes of data
2024-08-23 11:15:22.097 MQTT mapper: c0 00 .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. ..
2024-08-23 11:15:22.147 MQTT mapper: Received 2 bytes of data
2024-08-23 11:15:22.147 MQTT mapper: d0 00 .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. Ю
2024-08-23 11:33:08.489 MQTT mapper: Received 33 bytes of data
2024-08-23 11:33:08.489 MQTT mapper: 30 1f 00 16 65 62 75 73 64 2f 63 74 6c 76 32 2f 7a 31 52 6f 0...ebusd/ctlv2/z1Ro
2024-08-23 11:33:08.489 MQTT mapper: 6f 6d 54 65 6d 70 32 33 2e 37 38 37 35 .. .. .. .. .. .. .. omTemp23.7875
2024-08-23 11:33:08.490 MQTT mapper: onMQTTPublish found ebusd/ctlv2/z1RoomTemp, Device 'MQTT mapper - T_Living', message '23.7875'
2024-08-23 11:33:08.490 MQTT mapper: Setting MQTT mapper - T_Living to 24/23.7875
2024-08-23 11:33:08.490 (MQTT mapper - T_Living) Updating device from 24:'23.725' to have values 24:'23.7875'.
(there is a small box with I think a question mark in the c0 00 but it is not displayed)
I removed the part behind "default": "0" and it is working! I don't know why though ...........
"MQTTrunning": {
"topic": "ebusd/global/running",
"type": "244", "subtype": "73", "switchtype": "0",
"mapping": {"item": "", "default": "0"}
-
- Posts: 322
- Joined: Saturday 27 February 2016 0:30
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2020.2
- Contact:
Re: Python Plugin: MqttMapper
Thanks for the log.
I'm greatly interested by MqttMapper initialization messages, as they'll contains (among others) current topics values.
In addition, I'll write a small tool which will dump on scree values of used topics, to help debugging. As soon written, I'll tell you.
Stay tuned!
I'm greatly interested by MqttMapper initialization messages, as they'll contains (among others) current topics values.
In addition, I'll write a small tool which will dump on scree values of used topics, to help debugging. As soon written, I'll tell you.
Stay tuned!
Who is online
Users browsing this forum: No registered users and 1 guest