Python Plugin: MqttMapper

Python and python framework

Moderator: leecollings

FlyingDomotic
Posts: 349
Joined: Saturday 27 February 2016 0:30
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.2
Contact:

Re: Python Plugin: MqttMapper

Post by FlyingDomotic »

Hello!

Yes, you're right.

You should have something like:

Code: Select all

"PV2 watt": {
"topic": "energy/growatt",
"key": "energy/growatt/pv2watt",
"select": {"item": "device", "value": "QBL1CL305R"}},
"type": "248", "subtype": "1",
"mapping": {"item": "values/pv2watt", "multiplier": 0.1}
User avatar
winner61
Posts: 9
Joined: Friday 02 August 2024 12:13
Target OS: NAS (Synology & others)
Domoticz version: 2024.7
Location: Friesland / NL
Contact:

Re: Python Plugin: MqttMapper

Post by winner61 »

Thank you very much FlyingDomotic!! I had to fiddle a little to make it work but everything works perfect now. Many thanks.
For those who might need the correct syntax with these growatt inverters here an example how to implement the new options.

"BMS SOC ": {
"topic": "energy/growatt",
"key": "energy/growatt/bmssoc",
"select": {"item": "device", "value": "QBL1CL305R"},
"type": "243", "subtype": "6", "switchtype": "0",
"mapping": {"item": "values/bmssoc", "multiplier": 1}

Change the device ID to your own!!

Help with types and subtypes you can go to https://wiki.domoticz.com/Developing_a_ ... vice_Types
FlyingDomotic
Posts: 349
Joined: Saturday 27 February 2016 0:30
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.2
Contact:

Re: Python Plugin: MqttMapper

Post by FlyingDomotic »

You're welcome!
User avatar
winner61
Posts: 9
Joined: Friday 02 August 2024 12:13
Target OS: NAS (Synology & others)
Domoticz version: 2024.7
Location: Friesland / NL
Contact:

Re: Python Plugin: MqttMapper

Post by winner61 »

@FlyingDomotic . Everything is working fine but I see some strange behaviour when adding/updating mqttmapper plugin in domoticz. Before your last update I could not use the UPDATE button because the fields were empty. So I deleted the entry and added it again. Now I can use the UPDATE button but the fields show twice. Is that something from Domoticz or the MqttMapper plugin ?
mqm.png
mqm.png (58.92 KiB) Viewed 1104 times
FlyingDomotic
Posts: 349
Joined: Saturday 27 February 2016 0:30
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.2
Contact:

Re: Python Plugin: MqttMapper

Post by FlyingDomotic »

Normal behavior is as follow:
- install plug-in with git clone in domoticz/plugins/
- update it when needed by git pull

With more details, update is :
- git pull within plug-in folder
- either restart Domoticz *OR* goto hardware tab, select plug-in, don't change anything and click on "Update"

What you've got is strange (understand a bug, in Domoticz itself as it display plug-in data header twice, while there's only one copy in plug-in).

Concerning "update" button, it appears only when selecting a hardware in upper part, until you click on it.

To (try to) fix the issue, you may delete hardware from Domoticz, restart Domoticz and add the plug-in again.
hjzwiers
Posts: 215
Joined: Friday 12 January 2018 8:26
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: MqttMapper

Post by hjzwiers »

Changed meassage
Last edited by hjzwiers on Sunday 09 March 2025 8:38, edited 1 time in total.
hjzwiers
Posts: 215
Joined: Friday 12 January 2018 8:26
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: MqttMapper

Post by hjzwiers »

Does anyone know how to get two digits (eg 5.2 kwh or better 5200 watt) from:

"MQTTsignal": {
"topic": "homeassistant/easee/power",
"type": "243", "subtype": "29", "switchtype": "0",
"mapping": {"item": "values/current","multiplier": 1000}

So I need the output in watts, I have 0 at the moment

Thanks
HvdW
Posts: 591
Joined: Sunday 01 November 2015 22:45
Target OS: Raspberry Pi / ODroid
Domoticz version: 2023.2
Location: Twente
Contact:

Re: Python Plugin: MqttMapper

Post by HvdW »

Play with the multiplier and see if you get any results.
Bugs bug me.
FlyingDomotic
Posts: 349
Joined: Saturday 27 February 2016 0:30
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.2
Contact:

Re: Python Plugin: MqttMapper

Post by FlyingDomotic »

hjzwiers wrote: Sunday 09 March 2025 8:37 Does anyone know how to get two digits (eg 5.2 kwh or better 5200 watt) from:

"MQTTsignal": {
"topic": "homeassistant/easee/power",
"type": "243", "subtype": "29", "switchtype": "0",
"mapping": {"item": "values/current","multiplier": 1000}

So I need the output in watts, I have 0 at the moment

Thanks
Syntax seem good. However, topic may not be the right one (here, it's probably HA autodiscovery topic, which contain only device definition not values).

Device data is under another topic line, depending on device itself. If it's a ZigBee device, value is often under zigbee2mqtt/<Z2M device name>. Zwave devices also have the same king of topics. DIY devices are sometimes with <device name>/...

You may install MqttExplorer to have a look at you MQTT tree, and find right topic.
hjzwiers
Posts: 215
Joined: Friday 12 January 2018 8:26
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: MqttMapper

Post by hjzwiers »

Through the explorer app (mqtt explorer) is see the value of 0,0 so I am wondering why I dont see the same value in Domoticz. I'll know more once I charge the car.
FlyingDomotic
Posts: 349
Joined: Saturday 27 February 2016 0:30
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.2
Contact:

Re: Python Plugin: MqttMapper

Post by FlyingDomotic »

Could you post here a cut&paste or a screen copy of topic content?
hjzwiers
Posts: 215
Joined: Friday 12 January 2018 8:26
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: MqttMapper

Post by hjzwiers »

I got this error in the logging:

Status: Warning: Expecting svalue with at least 1 elements separated by semicolon, 0 elements received (""), notification not sent (Hardware: 31 - MQTT mapper, ID: homeassistant/easee/power, Unit: 2, Type: F3 - General, SubType: 29 - kWh)

now what do I need to change lol
Attachments
Screenshot 2025-03-10 154526.png
Screenshot 2025-03-10 154526.png (55.37 KiB) Viewed 453 times
FlyingDomotic
Posts: 349
Joined: Saturday 27 February 2016 0:30
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.2
Contact:

Re: Python Plugin: MqttMapper

Post by FlyingDomotic »

Very strange... Looks like a configuration error, where homeassistant topic was given instead of "real" one (like "eas" or perhaps none)

Giving key name (easee), would it be possible to have a look at "eas" root topic (the one with 4 topics and 134 messages) ?
hjzwiers
Posts: 215
Joined: Friday 12 January 2018 8:26
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: MqttMapper

Post by hjzwiers »

I moved the meassage to eas:

"MQTTsignal": {
"topic": "eas/easee/power",
"type": "243", "subtype": "29", "switchtype": "0",
"mapping": {"item": "values/value","multiplier": 1000}
}

I still get the same error message:

2025-03-11 08:43:38.304 Status: Warning: Expecting svalue with at least 1 elements separated by semicolon, 0 elements received (""), notification not sent (Hardware: 31 - MQTT mapper, ID: eas/easee/power, Unit: 7, Type: F3 - General, SubType: 29 - kWh)

So I think it is something wrong with the MQTTsignal, i changed it back to homeassistant, and I got this meassage

2025-03-11 09:48:31.733 MQTT mapper: onMQTTPublish found homeassistant/easee/power, Device 'MQTT mapper - Car charge', message '5.0019998550415'
2025-03-11 09:48:31.733 Error: MQTT mapper: Can't find >values/value< in >5.0019998550415<
2025-03-11 09:48:31.733 MQTT mapper: Setting MQTT mapper - Car charge to ><
2025-03-11 09:48:31.733 (MQTT mapper - Car charge) Updating device from 0:'' to have values 0:''.

So mqttmapper can find the value, but there is someting wrong with the displaying

"MQTTsignal": {
"topic": "homeassistant/easee/power",
"type": "243", "subtype": "29", "switchtype": "0",
"mapping": {"item": "values/value","multiplier": 1000}
}
Last edited by hjzwiers on Tuesday 11 March 2025 9:53, edited 1 time in total.
FlyingDomotic
Posts: 349
Joined: Saturday 27 February 2016 0:30
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.2
Contact:

Re: Python Plugin: MqttMapper

Post by FlyingDomotic »

Would it be possible to get "eas/easee/power" full content?

Concerning the error, it indicates that this kind of device (kWh counter) needs a value, while sent data only contents "" (meaning that value was not found or empty).

With "eas/easee/power" content, I'll help finding the right item.
hjzwiers
Posts: 215
Joined: Friday 12 January 2018 8:26
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: MqttMapper

Post by hjzwiers »

how do i get "full content"
I was also updating my previous message :-)
User avatar
waltervl
Posts: 5714
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: Python Plugin: MqttMapper

Post by waltervl »

hjzwiers wrote: Tuesday 11 March 2025 9:55 how do i get "full content"
I was also updating my previous message :-)
In mqtt explorer unfold to folder eas/easee/power
Select the power folder and copy the message/value (not a screenshot!). There is a copy value icon on the top right when the power topic is selected. See for a reference the Wiki for reporting MQTT AD issues https://wiki.domoticz.com/MQTT_AD_Repor ... nd_payload
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
hjzwiers
Posts: 215
Joined: Friday 12 January 2018 8:26
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: MqttMapper

Post by hjzwiers »

Topic: homeassistant/easee/power
Value: 0.0
Value : 5.00899982452393

I can display a chart of the values, i just show two to prove that mqtt is showing them fine. Is this what you meant?
FlyingDomotic
Posts: 349
Joined: Saturday 27 February 2016 0:30
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.2
Contact:

Re: Python Plugin: MqttMapper

Post by FlyingDomotic »

Are you sure that you have twice the same "value" item with different content?
hjzwiers
Posts: 215
Joined: Friday 12 January 2018 8:26
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: MqttMapper

Post by hjzwiers »

I just showed two values, it show only one

I keep getting
2025-03-11 10:27:48.926 Error: MQTT mapper: Can't find >value/watt< in >5.02199983596802<

MQTT sees the value, only can't use it ?
Post Reply

Who is online

Users browsing this forum: Bing [Bot], madpatrick and 1 guest