Python Plugin: MqttMapper

Python and python framework

Moderator: leecollings

User avatar
waltervl
Posts: 6677
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2025.1
Location: NL
Contact:

Re: Python Plugin: MqttMapper

Post by waltervl »

A selector switch can be 244,62,0 or 244,73,18 (according the wiki...)
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
darrepac
Posts: 142
Joined: Tuesday 04 February 2014 21:31
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Isère, France
Contact:

Re: Python Plugin: MqttMapper

Post by darrepac »

Hi there,

After Shelly_MQTT (discontinued), ShellyTeacher (discontinued), I am jumping into MqttMapper to make my Shelly EM Gen3 read by domoticz.
A bit tricky to understand everything about the settings (even if the french version is clearer for me ;) ).
I want my (new) Shelly to publish values to my already in place Domoticz Device idx188 (which is General/kWh so 243/29 if I am correct).

Here is the MQTT message receive from Mosquitto:

Code: Select all

{"src":"shellyemg3-b08184e81cd8","dst":"shellyemg3-b08184e81cd8/events","method":"NotifyStatus","params":{"ts":1757758440.98,"em1:0":{"act_power":3528.0,"aprt_power":3575.3,"current":14.827,"freq":50.0,"pf":0.98,"voltage":244.4}}}
So here are my questions. Here is the JSON I started to write:

Code: Select all

{
    "Maison W": {
        "topic": "shellyemg3-b08184e81cd8/events",
        "type": "243", "subtype": "29", "switchtype": "??",
        "mapping": {"item": "params/em1:0/act_power"}
    }
}
I don't know what to put in switchtype.
I don't know where I can indicate the idx value of my actual device in Domoticz (188)
I am not sure if my mapping is correct for a General/kWh device

Once it will be correct, it could be interested to publish working examples of all Shelly devices type. It would interest quite some people I think
FlyingDomotic
Posts: 463
Joined: Saturday 27 February 2016 0:30
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.2
Contact:

Re: Python Plugin: MqttMapper

Post by FlyingDomotic »

As for all plug-in, MqttMapper can only write data into its own devices. You should create a new device (with shown configuration file, its name will be "Maison W") to get data. You can then copy changed from this device to any existing one with some dzVent/LUA script.

Concerning switchType, put it to zero.

Note that this kind of device needs 2 values: instant power (in W) followed by total power (in Wh). If you have total power from device, use it. Else, you can add line "options": {"EnergyMeterMode": "1"} into definition to calculate it from instant power, and add ";0" after instant power into "mapping" "iitem".
darrepac
Posts: 142
Joined: Tuesday 04 February 2014 21:31
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Isère, France
Contact:

Re: Python Plugin: MqttMapper

Post by darrepac »

So if I understood correctly the result is the following:

Code: Select all

{
    "Maison Wbis": {
        "topic": "shellyemg3-b08184e81cd8/events",
        "type": "244", "subtype": "73", "switchtype": "0",
        "mapping": {"item": "params/em1:0/act_power;0"},
        "options": {"EnergyMeterMode": "1"}
    }
}
But then I created the device and it crashed domoticz with the log full of following messages:
2025-09-14 14:46:40.489 Error: (FindModule) Domoticz/DomoticzEx modules not found in interpreter.
2025-09-14 14:46:40.489 Error: CPlugin:PyDomoticz_Debug, illegal operation, Plugin has not started yet.
Any hint?
User avatar
waltervl
Posts: 6677
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2025.1
Location: NL
Contact:

Re: Python Plugin: MqttMapper

Post by waltervl »

You should not create a device, the plugin does that for you.
Is this the only mapping JSON you use or are there already more?
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
darrepac
Posts: 142
Joined: Tuesday 04 February 2014 21:31
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Isère, France
Contact:

Re: Python Plugin: MqttMapper

Post by darrepac »

Sorry I mean when I created the hardware…
No other json, only this one
User avatar
waltervl
Posts: 6677
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2025.1
Location: NL
Contact:

Re: Python Plugin: MqttMapper

Post by waltervl »

Perhaps try it without to check
"options": {"EnergyMeterMode": "1"}

And is the plugin running when the JSON is empty?
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
darrepac
Posts: 142
Joined: Tuesday 04 February 2014 21:31
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Isère, France
Contact:

Re: Python Plugin: MqttMapper

Post by darrepac »

So I am back on it, it doesn't crash now with:

Code: Select all

{
    "Maison Wbis": {
        "topic": "shellyemg3-b08184e81cd8/events",
        "type": "244", "subtype": "73", "switchtype": "0",
        "mapping": {"item": "params/em1:0/act_power;0"},
        "options": {"EnergyMeterMode": "1"}
    }
}

but it creates only one device that is not a power meter device:
Screenshot.png
Screenshot.png (32.11 KiB) Viewed 146 times
I tried to put more verbose debug messages, but it's cryptic to me:

Code: Select all

2025-09-26 16:24:34.219 ShellyEMGen3: Debug logging mask set to: PYTHON PLUGIN DEVICE CONNECTION MESSAGE
2025-09-26 16:24:34.220 ShellyEMGen3: /home/pi/domoticz/plugins/MqttMapper/shellyemgen3.json is a version 1.0 file
2025-09-26 16:24:34.310 ShellyEMGen3: pluginV1::__init__
2025-09-26 16:24:34.311 ShellyEMGen3: 'HardwareID': '23'
2025-09-26 16:24:34.311 ShellyEMGen3: 'HomeFolder': '/home/pi/domoticz/plugins/MqttMapper/'
2025-09-26 16:24:34.311 ShellyEMGen3: 'StartupFolder': '/home/pi/domoticz/'
2025-09-26 16:24:34.311 ShellyEMGen3: 'UserDataFolder': '/home/pi/domoticz/'
2025-09-26 16:24:34.312 ShellyEMGen3: 'Database': '/home/pi/domoticz/domoticz.db'
2025-09-26 16:24:34.312 ShellyEMGen3: 'Language': 'fr'
2025-09-26 16:24:34.312 ShellyEMGen3: 'Version': '25.9.19-1'
2025-09-26 16:24:34.312 ShellyEMGen3: 'Author': 'Flying Domotic'
2025-09-26 16:24:34.312 ShellyEMGen3: 'Name': 'ShellyEMGen3'
2025-09-26 16:24:34.312 ShellyEMGen3: 'Address': '127.0.0.1'
2025-09-26 16:24:34.313 ShellyEMGen3: 'Port': '1883'
2025-09-26 16:24:34.313 ShellyEMGen3: 'Key': 'MqttMapper'
2025-09-26 16:24:34.313 ShellyEMGen3: 'Mode1': 'shellyemgen3.json'
2025-09-26 16:24:34.313 ShellyEMGen3: 'Mode6': 'Verbose'
2025-09-26 16:24:34.314 ShellyEMGen3: 'DomoticzVersion': '2025.1'
2025-09-26 16:24:34.314 ShellyEMGen3: 'DomoticzHash': '89d5c900d'
2025-09-26 16:24:34.314 ShellyEMGen3: 'DomoticzBuildTime': '2025-05-05 09:02:49'
2025-09-26 16:24:34.314 ShellyEMGen3: Device count: 1
2025-09-26 16:24:34.315 ShellyEMGen3: Device: 1 - ID: 437, Name: 'ShellyEMGen3 - Maison Wbis', nValue: 0, sValue: ''
2025-09-26 16:24:34.316 ShellyEMGen3: MqttClient::__init__
2025-09-26 16:24:34.319 ShellyEMGen3: Protocol set to: 'MQTT'.
2025-09-26 16:24:34.319 ShellyEMGen3: Transport set to: 'TCP/IP', 127.0.0.1:1883.
2025-09-26 16:24:34.319 ShellyEMGen3: Connect directive received, action initiated successfully.
2025-09-26 16:24:34.320 ShellyEMGen3: Heartbeat interval set to: 3.
2025-09-26 16:24:34.370 ShellyEMGen3: MqttClient::onConnect
2025-09-26 16:24:34.371 ShellyEMGen3: MqttClient::onConnect connect to 127.0.0.1:1883, ID=Domoticz_MqttMapper_23_1758896674
2025-09-26 16:24:34.371 ShellyEMGen3: Sending 47 bytes of data
2025-09-26 16:24:34.371 ShellyEMGen3: 10 2d 00 04 4d 51 54 54 04 02 00 3c 00 21 44 6f 6d 6f 74 69 .-..MQTT...<.!Domoti
2025-09-26 16:24:34.371 ShellyEMGen3: 63 7a 5f 4d 71 74 74 4d 61 70 70 65 72 5f 32 33 5f 31 37 35 cz_MqttMapper_23_175
2025-09-26 16:24:34.372 ShellyEMGen3: 38 38 39 36 36 37 34 .. .. .. .. .. .. .. .. .. .. .. .. .. 8896674
2025-09-26 16:24:34.422 ShellyEMGen3: Received 4 bytes of data
2025-09-26 16:24:34.423 ShellyEMGen3: 20 02 00 00 .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. ....
2025-09-26 16:24:34.423 ShellyEMGen3: onMQTTConnected
2025-09-26 16:24:34.423 ShellyEMGen3: getTopics: '{'shellyemg3-b08184e81cd8/events'}'
2025-09-26 16:24:34.424 ShellyEMGen3: MqttClient::Subscribe to [{'Topic': 'shellyemg3-b08184e81cd8/events', 'QoS': 0}]
2025-09-26 16:24:34.424 ShellyEMGen3: Sending 37 bytes of data
2025-09-26 16:24:34.424 ShellyEMGen3: 82 23 00 01 00 1e 73 68 65 6c 6c 79 65 6d 67 33 2d 62 30 38 £....shellyemg3-b08
2025-09-26 16:24:34.424 ShellyEMGen3: 31 38 34 65 38 31 63 64 38 2f 65 76 65 6e 74 73 00 .. .. .. 184e81cd8/events.
2025-09-26 16:24:34.475 ShellyEMGen3: Received 5 bytes of data
2025-09-26 16:24:34.476 ShellyEMGen3: 90 03 00 01 00 .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. Ю...
2025-09-26 16:24:34.476 ShellyEMGen3: onMQTTSubscribed
2025-09-26 16:24:35.309 Status: EventSystem: Script event triggered: /home/pi/domoticz/scripts/lua/script_device_solaire.lua
2025-09-26 16:24:36.081 ShellyEMGen3: Sending 2 bytes of data
2025-09-26 16:24:36.082 ShellyEMGen3: c0 00 .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. �
2025-09-26 16:24:36.133 ShellyEMGen3: Received 2 bytes of data
2025-09-26 16:24:36.133 ShellyEMGen3: d0 00 .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. Ю
FlyingDomotic
Posts: 463
Joined: Saturday 27 February 2016 0:30
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.2
Contact:

Re: Python Plugin: MqttMapper

Post by FlyingDomotic »

Domoticz sometimes not so good manages changing device type.

If you change "type", "subtype" or "switchtype" in json configuration file, you may have to delete device first to let it create instead of modify device.
darrepac
Posts: 142
Joined: Tuesday 04 February 2014 21:31
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Isère, France
Contact:

Re: Python Plugin: MqttMapper

Post by darrepac »

FlyingDomotic wrote: Friday 26 September 2025 18:59 Domoticz sometimes not so good manages changing device type.

If you change "type", "subtype" or "switchtype" in json configuration file, you may have to delete device first to let it create instead of modify device.
So I deleted the device in domoticz...and Mqttmapper created the same device exactly

Code: Select all

2025-09-26 19:07:27.141 ShellyEMGen3: Debug logging mask set to: PYTHON PLUGIN DEVICE
2025-09-26 19:07:27.142 ShellyEMGen3: /home/pi/domoticz/plugins/MqttMapper/shellyemgen3.json is a version 1.0 file
2025-09-26 19:07:27.234 ShellyEMGen3: pluginV1::__init__
2025-09-26 19:07:27.234 ShellyEMGen3: 'HardwareID': '23'
2025-09-26 19:07:27.234 ShellyEMGen3: 'HomeFolder': '/home/pi/domoticz/plugins/MqttMapper/'
2025-09-26 19:07:27.234 ShellyEMGen3: 'StartupFolder': '/home/pi/domoticz/'
2025-09-26 19:07:27.235 ShellyEMGen3: 'UserDataFolder': '/home/pi/domoticz/'
2025-09-26 19:07:27.235 ShellyEMGen3: 'Database': '/home/pi/domoticz/domoticz.db'
2025-09-26 19:07:27.235 ShellyEMGen3: 'Language': 'fr'
2025-09-26 19:07:27.235 ShellyEMGen3: 'Version': '25.9.19-1'
2025-09-26 19:07:27.235 ShellyEMGen3: 'Author': 'Flying Domotic'
2025-09-26 19:07:27.235 ShellyEMGen3: 'Name': 'ShellyEMGen3'
2025-09-26 19:07:27.235 ShellyEMGen3: 'Address': '127.0.0.1'
2025-09-26 19:07:27.235 ShellyEMGen3: 'Port': '1883'
2025-09-26 19:07:27.235 ShellyEMGen3: 'Key': 'MqttMapper'
2025-09-26 19:07:27.235 ShellyEMGen3: 'Mode1': 'shellyemgen3.json'
2025-09-26 19:07:27.235 ShellyEMGen3: 'Mode6': 'Debug'
2025-09-26 19:07:27.235 ShellyEMGen3: 'DomoticzVersion': '2025.1'
2025-09-26 19:07:27.235 ShellyEMGen3: 'DomoticzHash': '89d5c900d'
2025-09-26 19:07:27.235 ShellyEMGen3: 'DomoticzBuildTime': '2025-05-05 09:02:49'
2025-09-26 19:07:27.236 ShellyEMGen3: Device count: 0
2025-09-26 19:07:27.237 ShellyEMGen3: Creating device Maison Wbis
2025-09-26 19:07:27.237 ShellyEMGen3: Creating device 'Maison Wbis'.
2025-09-26 19:07:27.241 ShellyEMGen3: MqttClient::__init__
2025-09-26 19:07:27.244 ShellyEMGen3: Heartbeat interval set to: 3.
2025-09-26 19:07:27.245 ShellyEMGen3: MqttClient::onConnect
2025-09-26 19:07:27.245 ShellyEMGen3: MqttClient::onConnect connect to 127.0.0.1:1883, ID=Domoticz_MqttMapper_23_1758906447
2025-09-26 19:07:27.296 ShellyEMGen3: onMQTTConnected
2025-09-26 19:07:27.297 ShellyEMGen3: getTopics: '{'shellyemg3-b08184e81cd8/events'}'
2025-09-26 19:07:27.297 ShellyEMGen3: MqttClient::Subscribe to [{'Topic': 'shellyemg3-b08184e81cd8/events', 'QoS': 0}]
2025-09-26 19:07:27.348 ShellyEMGen3: onMQTTSubscribed
FlyingDomotic
Posts: 463
Joined: Saturday 27 February 2016 0:30
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.2
Contact:

Re: Python Plugin: MqttMapper

Post by FlyingDomotic »

Type 244, subtype 73, switchtype 0 is an on/off switch.

To get a kWh device, use 243/29/0
darrepac
Posts: 142
Joined: Tuesday 04 February 2014 21:31
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Isère, France
Contact:

Re: Python Plugin: MqttMapper

Post by darrepac »

FlyingDomotic wrote: Friday 26 September 2025 20:16 Type 244, subtype 73, switchtype 0 is an on/off switch.

To get a kWh device, use 243/29/0
Was correct in my first message and don't know when I changed that!! :?
Sorry!
SO now the device is ok but not updated at all.
I checked with mosquito and I receive well the messages:

Code: Select all

{"src":"shellyemg3-b08184e81cd8","dst":"shellyemg3-b08184e81cd8/events","method":"NotifyStatus","params":{"ts":1758911352.22,"em1:0":{"act_power":578.0,"aprt_power":719.8,"current":2.952,"freq":50.0,"pf":0.83,"voltage":247.1}}}
Where can I look?

Increasing verbosity, I have this:

Code: Select all

2025-09-26 20:33:08.053 ShellyEMGen3: c0 00 .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. �
2025-09-26 20:33:08.104 ShellyEMGen3: Received 2 bytes of data
2025-09-26 20:33:08.104 ShellyEMGen3: d0 00 .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. Ю
2025-09-26 20:33:11.063 ShellyEMGen3: Sending 2 bytes of data
2025-09-26 20:33:11.064 ShellyEMGen3: c0 00 .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. �
2025-09-26 20:33:11.115 ShellyEMGen3: Received 2 bytes of data
darrepac
Posts: 142
Joined: Tuesday 04 February 2014 21:31
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Isère, France
Contact:

Re: Python Plugin: MqttMapper

Post by darrepac »

I think I need to use the following topic : "shellyemg3-b08184e81cd8/events/rpc" (was missing "rpc") but then I have error in the log (at least it receives something):

Code: Select all

2025-09-26 20:52:55.011 ShellyEMGen3: onMQTTPublish found shellyemg3-b08184e81cd8/events/rpc, Device 'ShellyEMGen3 - Maison Wbis', message '{'src': 'shellyemg3-b08184e81cd8', 'dst': 'shellyemg3-b08184e81cd8/events', 'method': 'NotifyStatus', 'params': {'ts': 1758912779.39, 'em1:0': {'act_power': 397.7, 'aprt_power': 619.5, 'current': 2.583, 'freq': 50.0, 'pf': 0.74, 'voltage': 243.1}}}'
2025-09-26 20:52:55.012 Error: ShellyEMGen3: Can't find >0'< in >'{'src': 'shellyemg3-b08184e81cd8', 'dst': 'shellyemg3-b08184e81cd8/events', 'method': 'NotifyStatus', 'params': {'ts': 1758912779.39, 'em1:0': {'act_power': 397.7, 'aprt_power': 619.5, 'current': 2.583, 'freq': 50.0, 'pf': 0.74, 'voltage': 243.1}}}<, message ignored
2025-09-26 20:52:55.064 ShellyEMGen3: onMQTTPublish found shellyemg3-b08184e81cd8/events/rpc, Device 'ShellyEMGen3 - Maison Wbis', message '{'src': 'shellyemg3-b08184e81cd8', 'dst': 'shellyemg3-b08184e81cd8/events', 'method': 'NotifyStatus', 'params': {'ts': 1758912778.39, 'em1:1': {'act_power': 0.0, 'aprt_power': 4.9, 'current': 0.02, 'freq': 50.0, 'pf': 0.0, 'voltage': 243.0}}}'
2025-09-26 20:52:55.065 Error: ShellyEMGen3: Can't find >params/em1:0/act_power'< in >'{'src': 'shellyemg3-b08184e81cd8', 'dst': 'shellyemg3-b08184e81cd8/events', 'method': 'NotifyStatus', 'params': {'ts': 1758912778.39, 'em1:1': {'act_power': 0.0, 'aprt_power': 4.9, 'current': 0.02, 'freq': 50.0, 'pf': 0.0, 'voltage': 243.0}}}<, message ignored
2025-09-26 20:
So I guess it is a mapping error, but it is not trial to find the right mapping
darrepac
Posts: 142
Joined: Tuesday 04 February 2014 21:31
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Isère, France
Contact:

Re: Python Plugin: MqttMapper

Post by darrepac »

Found the mistake: need a "~" before the 0

Code: Select all

{
    "Maison Wbis": {
        "topic": "shellyemg3-b08184e81cd8/events/rpc",
        "type": "243", "subtype": "29", "switchtype": "0",
        "mapping": {"item": "params/em1:0/act_power;~0"},
        "options": {"EnergyMeterMode": "1"}
    }
}
So now the log sounds good but I don't still have any value in the device itself (but the update_timestamp change!):

Code: Select all

2025-09-26 21:21:03.147 ShellyEMGen3: onMQTTPublish found shellyemg3-b08184e81cd8/events/rpc, Device 'ShellyEMGen3 - Maison Wbis', message '{'src': 'shellyemg3-b08184e81cd8', 'dst': 'shellyemg3-b08184e81cd8/events', 'method': 'NotifyStatus', 'params': {'ts': 1758914471.57, 'em1:0': {'act_power': 399.7, 'aprt_power': 635.7, 'current': 2.641, 'freq': 50.0, 'pf': 0.73, 'voltage': 243.9}}}'
2025-09-26 21:21:03.148 ShellyEMGen3: Setting ShellyEMGen3 - Maison Wbis to >399.7;0<
2025-09-26 21:21:03.148 (ShellyEMGen3 - Maison Wbis) Updating device from 404:'' to have values 0:'399.7;0'.
FlyingDomotic
Posts: 463
Joined: Saturday 27 February 2016 0:30
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.2
Contact:

Re: Python Plugin: MqttMapper

Post by FlyingDomotic »

darrepac wrote: Friday 26 September 2025 20:31 Increasing verbosity, I have this:

Code: Select all

2025-09-26 20:33:08.053 ShellyEMGen3: c0 00 .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. �
2025-09-26 20:33:08.104 ShellyEMGen3: Received 2 bytes of data
2025-09-26 20:33:08.104 ShellyEMGen3: d0 00 .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. Ю
2025-09-26 20:33:11.063 ShellyEMGen3: Sending 2 bytes of data
2025-09-26 20:33:11.064 ShellyEMGen3: c0 00 .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. �
2025-09-26 20:33:11.115 ShellyEMGen3: Received 2 bytes of data
FYI, these messages are probably ping from/to MQTT server to keep connection active.
darrepac
Posts: 142
Joined: Tuesday 04 February 2014 21:31
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Isère, France
Contact:

Re: Python Plugin: MqttMapper

Post by darrepac »

My issue is similar than this one https://github.com/FlyingDomotic/domoti ... /issues/19 that's doesn't seem really solved....but moving the device from "computed" to "device" make it work and then back to "computed" and still working
Hope it could help others
FlyingDomotic
Posts: 463
Joined: Saturday 27 February 2016 0:30
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.2
Contact:

Re: Python Plugin: MqttMapper

Post by FlyingDomotic »

The mentioned issue has link to Domoticz issue that's still opened. Until it's fixed in Domoticz, changing options twice could make the job.
User avatar
TiXav
Posts: 63
Joined: Saturday 28 November 2015 22:25
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: France
Contact:

Re: Python Plugin: MqttMapper

Post by TiXav »

Hello,
I have a little issue with one shelly device, the "Lastupdate" of the switch device is updated each time when apower/voltage/freq/current is changing althought the state of the switch does not change
DZ.png
DZ.png (89.42 KiB) Viewed 86 times
below my setup in the Mqttmapper :
"Living": {
"topic": "shelly132/status/switch:0",
"type": "244", "subtype": "73", "switchtype": "0",
"mapping": {
"item": "output",
"default": "0",
"values": {"False": "0", "True" : "100"}
},
"set": {
"topic": "shelly132/rpc",
"payload": "{ \"id\":0, \"src\": \"domoticz\", \"method\": \"Switch.Set\", \"params\":{\"id\":0,\"on\":#}}",
"mapping": {"values": {"false": "0", "true" : "100"}}
}
}
what is my mistake ?
FlyingDomotic
Posts: 463
Joined: Saturday 27 February 2016 0:30
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.2
Contact:

Re: Python Plugin: MqttMapper

Post by FlyingDomotic »

As of now, there's no test on value change to set last update date, it's updated each time we got a new message.

Z2M also works as this.

However, it may be a good idea to set last update only on value change. I'll see how to implement an option to do that.

Stay tuned!
User avatar
TiXav
Posts: 63
Joined: Saturday 28 November 2015 22:25
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: France
Contact:

Re: Python Plugin: MqttMapper

Post by TiXav »

Great!
Thank you
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest