Python Plugin: MqttMapper
Moderator: leecollings
-
hjzwiers
- Posts: 289
- Joined: Friday 12 January 2018 8:26
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Python Plugin: MqttMapper
Yes I had already upgraded the git file and I'm running from the newest domoticz.
But the trick was from FlyingDomotic, it worked.
I will watch my mqtt file it sometimes changes, for now its fixed! Thanks!
But the trick was from FlyingDomotic, it worked.
I will watch my mqtt file it sometimes changes, for now its fixed! Thanks!
-
FlyingDomotic
- Posts: 463
- Joined: Saturday 27 February 2016 0:30
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2020.2
- Contact:
Re: Python Plugin: MqttMapper
Using
means "load the full message into domoticz device". It's useful when :
Code: Select all
"item":""- message contains only one value, in raw format
- message is something complex, is written "as is" into a domoticz text device, and analyzed by some LUA/dzVents script
-
JeroenUnimog
- Posts: 1
- Joined: Wednesday 29 October 2025 23:15
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Python Plugin: MqttMapper
Very nice plugin!
Reading a MQTT topic with text into Domoticz works fine.
But I can´t get posting a text back into an MQTT topic to work.
MqttMapper.json:
The "set" part is not executing.
I also tried "commands" but without succes.
Any suggestions?
Regards, Jeroen
Reading a MQTT topic with text into Domoticz works fine.
But I can´t get posting a text back into an MQTT topic to work.
MqttMapper.json:
Code: Select all
{
"Kilometers_EX40": {
"topic": "house/kms-rijden",
"type": "243", "subtype":"19","switchtype":"0",
"mapping":{"item":"svalue"},
"set": {"topic": "house/kms-rijden/set", "payload": {"svalue":"#"}, "retain": true}
}
}I also tried "commands" but without succes.
Any suggestions?
Regards, Jeroen
Last edited by JeroenUnimog on Wednesday 29 October 2025 23:36, edited 1 time in total.
-
hjzwiers
- Posts: 289
- Joined: Friday 12 January 2018 8:26
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Python Plugin: MqttMapper
Sometimes MQTT Explorer shows the file this way, but sometimes is shows it without all the quotation marks, how can I sent this in Explorer of is there a setting in which I can influence the way MQTT file is written?FlyingDomotic wrote: Tuesday 28 October 2025 18:54 If received data isthen "item" should beCode: Select all
{"value":{"value": 30.0}}Code: Select all
"item": "value/value"
This causes my readout to fail
- waltervl
- Posts: 6678
- Joined: Monday 28 January 2019 18:48
- Target OS: Linux
- Domoticz version: 2025.1
- Location: NL
- Contact:
Re: Python Plugin: MqttMapper
The application that writes the MQTT message defines the way the value is sent to MQTT. So you have to check that application. What application is it?
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
-
hjzwiers
- Posts: 289
- Joined: Friday 12 January 2018 8:26
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Python Plugin: MqttMapper
The messages are from an ebusd application, I will check it out
-
hjzwiers
- Posts: 289
- Joined: Friday 12 January 2018 8:26
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Python Plugin: MqttMapper
I am running it from dockge with the following file:hjzwiers wrote: Friday 31 October 2025 20:41 The messages are from an ebusd application, I will check it out
Code: Select all
services:
ebusd:
image: john30/ebusd
container_name: ebusd
restart: unless-stopped
ports:
- 8888:8888
environment:
EBUSD_DEVICE: ens:192.168.2.99:9999
EBUSD_SCANCONFIG: Full
EBUSD_MQTTHOST: 192.168.2.71
EBUSD_MQTTPORT: "1883"
EBUSD_CONFIGLANG: en
EBUSD_MQTTINT: /etc/ebusd/mqtt-hassio.cfg
EBUSD_LOGFILE: /var/log/ebusd.log
networks: {}
Last edited by hjzwiers on Saturday 01 November 2025 0:00, edited 1 time in total.
- waltervl
- Posts: 6678
- Joined: Monday 28 January 2019 18:48
- Target OS: Linux
- Domoticz version: 2025.1
- Location: NL
- Contact:
Re: Python Plugin: MqttMapper
So if ebusd sometimes sends in the message
and sometimes
Then this seems some bug in ebusd. Do you see this behavior on more messages coming from ebusd?
Code: Select all
{"value":{"value": 30.0}}Code: Select all
{value:{value: 30.0}}Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
-
hjzwiers
- Posts: 289
- Joined: Friday 12 January 2018 8:26
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Python Plugin: MqttMapper
No, but I actually only readback from ebusd.
I don't see the exact message now, but if it happens i will write it here
I've also added EBUSD_MQTTJSON: "" to the settings, don't know if that will make it more consistent
I don't see the exact message now, but if it happens i will write it here
I've also added EBUSD_MQTTJSON: "" to the settings, don't know if that will make it more consistent
-
FlyingDomotic
- Posts: 463
- Joined: Saturday 27 February 2016 0:30
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2020.2
- Contact:
Re: Python Plugin: MqttMapper
A message like is definitely NOT a valid JSON message.
As said earlier in this thread, should you receive one like this, you should contact people that wrote code generating the message to ask for a valid content (probably easier to tell than to do).
If you can't fix the problem at source, you may always ask MqttMapper to write it "as is" in a Domoticz text device, and write your own LUA/dzVents script to manually decode all flavor of message.
Code: Select all
{value:{value: 30.0}}As said earlier in this thread, should you receive one like this, you should contact people that wrote code generating the message to ask for a valid content (probably easier to tell than to do).
If you can't fix the problem at source, you may always ask MqttMapper to write it "as is" in a Domoticz text device, and write your own LUA/dzVents script to manually decode all flavor of message.
-
hjzwiers
- Posts: 289
- Joined: Friday 12 January 2018 8:26
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Python Plugin: MqttMapper
I think i fixed it with " EBUSD_MQTTJSON: "" " in the settings.
Thanks
Thanks
-
roseen
- Posts: 12
- Joined: Monday 24 September 2018 16:18
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Location: Stockholm, Sweden
- Contact:
Re: Python Plugin: MqttMapper
I have a button (this one: https://www.tindie.com/products/plab/home-buttons/) that supports HA Autodiscover, but I haven't got it to work with the Autodiscover Gateway in Domoticz. So I decided to go bare bones and use MqttMapper instead.
However, the button sends the payload "PRESS" everytime it is pressed.
I would like to set up a switch that gets toggled everytime that message is received.
I have a config that can go from "0" to "1" when I press, but then it will be stuck in "1".
Is it even possible to configure MqttMapper to toggle the switch instead of setting a fixed value?
However, the button sends the payload "PRESS" everytime it is pressed.
I would like to set up a switch that gets toggled everytime that message is received.
I have a config that can go from "0" to "1" when I press, but then it will be stuck in "1".
Is it even possible to configure MqttMapper to toggle the switch instead of setting a fixed value?
-
FlyingDomotic
- Posts: 463
- Joined: Saturday 27 February 2016 0:30
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2020.2
- Contact:
Re: Python Plugin: MqttMapper
As of now, there's no toggle button on Domoticz...
However, what you can do is to create a push-on switch (which indeed is what you have) and write a small script to toggle a virtual switch.
You may eventually find help here if needed.
However, what you can do is to create a push-on switch (which indeed is what you have) and write a small script to toggle a virtual switch.
You may eventually find help here if needed.
-
roseen
- Posts: 12
- Joined: Monday 24 September 2018 16:18
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Location: Stockholm, Sweden
- Contact:
Re: Python Plugin: MqttMapper
Yes, I was thinking of how the web API has the option to send the value "toggle" to a switch, and was hoping that the same existed in the plugin API.FlyingDomotic wrote: Saturday 22 November 2025 1:14 However, what you can do is to create a push-on switch (which indeed is what you have) and write a small script to toggle a virtual switch.
https://wiki.domoticz.com/Domoticz_API/ ... tch_on/off
Can you think of a better way to do it than a curl call to the web API?
-
roseen
- Posts: 12
- Joined: Monday 24 September 2018 16:18
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Location: Stockholm, Sweden
- Contact:
Re: Python Plugin: MqttMapper
(If I'm spamming the topic, please say so, and I'll go ask elsewhere)
Is there a way to send a command on an incoming message?
Instead of only when the event is triggered from Domoticz?
I have something that works half way:
The command works nicely when I click "Home Button 1" in the Domoticz UI, toggling the switch. Now I would like it to be sent on an incoming mqtt message, basically translating from topic "homebuttons/knapp/button_1" to "domoticz/in"...
Is there a way to send a command on an incoming message?
Instead of only when the event is triggered from Domoticz?
I have something that works half way:
Code: Select all
{
"Home Button 1": {
"topic": "homebuttons/knapp/button_1",
"type": "244", "subtype": "73", "switchtype": "0",
"mapping": {"item": ""},
"commands": {
"<default>": {"topic": "domoticz/in", "payload": {"command": "switchlight", "idx": 28, "switchcmd": "Toggle" }, "retain": true}
}
}
}
-
FlyingDomotic
- Posts: 463
- Joined: Saturday 27 February 2016 0:30
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2020.2
- Contact:
Re: Python Plugin: MqttMapper
Giving a MqttMapper push on button named "PushOn" and a virtual device named "CommandedDevice", write this dzVents script:
Commanded device state will change each time push on button is pressed.
Code: Select all
return {
on = {devices = {'PushOn'}},
execute = function(domoticz, device)
commanded = domoticz.devices("CommandedDevice")
if commanded.active then
commanded.switchOff()
else
commanded.switchOn()
end
end
}
-
roseen
- Posts: 12
- Joined: Monday 24 September 2018 16:18
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Location: Stockholm, Sweden
- Contact:
Re: Python Plugin: MqttMapper
That one works perfectly, thanks!FlyingDomotic wrote: Saturday 22 November 2025 14:46 Giving a MqttMapper push on button named "PushOn" and a virtual device named "CommandedDevice", write this dzVents script:
...
-
FlyingDomotic
- Posts: 463
- Joined: Saturday 27 February 2016 0:30
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2020.2
- Contact:
Re: Python Plugin: MqttMapper
We're never protected against chance...
Re: Python Plugin: MqttMapper
Can anyone help me with the MQTT Mapper?
I've installed the plugin and it works fine. Now I want to import a value from the MQTT broker, which works fine to a certain extent. The correct meter is created.
But I don't get the value; it stays at zero.
In the MQTT Explorer, I see 38 under 'Value'. The value in the MQTT Explorer isn't in JSON format. It should display it with the code below.
In the logfile of Domoticz i get:
MqttClient::Subscribe to [{'Topic': 'p1monitor/watermeter/day/watermeter_consumption_liter', 'QoS': 0}]
Look at the end. this is not the value i looking for.. 'QoS': 0
I've installed the plugin and it works fine. Now I want to import a value from the MQTT broker, which works fine to a certain extent. The correct meter is created.
But I don't get the value; it stays at zero.
In the MQTT Explorer, I see 38 under 'Value'. The value in the MQTT Explorer isn't in JSON format. It should display it with the code below.
Code: Select all
{
"Waterverbruik": {
"topic": "p1monitor/watermeter/day/watermeter_consumption_liter",
"type": "243", "subtype": "33", "switchtype": "2",
"mapping": { "item": "" }
}
}
MqttClient::Subscribe to [{'Topic': 'p1monitor/watermeter/day/watermeter_consumption_liter', 'QoS': 0}]
Look at the end. this is not the value i looking for.. 'QoS': 0
-
janpep
- Posts: 288
- Joined: Thursday 14 March 2024 10:11
- Target OS: Linux
- Domoticz version: 2025.1
- Location: Netherlands
- Contact:
Re: Python Plugin: MqttMapper
I found this plugin. Using cam2mqtt in docker and this plugin in Domoticz, I managed to pass "AI person detection" from my camera to Domoticz.
Thanks so much!
Thanks so much!
Dz on Ubuntu VM on DS718+ behind FRITZ!Box.
EvoHome; MELCloud; P1 meter; Z-Stick GEN5; Z-Wave-js-ui; Sonoff USB-Dongle Plus-E; Zigbee2Mqtt; MQTT; Greenwave powernodes 1+6; Fibaro switch, plugs, smoke; FRITZ!DECT 200. Scripts listed in profile interests.
EvoHome; MELCloud; P1 meter; Z-Stick GEN5; Z-Wave-js-ui; Sonoff USB-Dongle Plus-E; Zigbee2Mqtt; MQTT; Greenwave powernodes 1+6; Fibaro switch, plugs, smoke; FRITZ!DECT 200. Scripts listed in profile interests.
Who is online
Users browsing this forum: No registered users and 1 guest