Re: Python Plugin: MqttMapper
Posted: Thursday 24 July 2025 0:04
A selector switch can be 244,62,0 or 244,73,18 (according the wiki...)
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}}}Code: Select all
{
"Maison W": {
"topic": "shellyemg3-b08184e81cd8/events",
"type": "243", "subtype": "29", "switchtype": "??",
"mapping": {"item": "params/em1:0/act_power"}
}
}
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"}
}
}Any hint?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.
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"}
}
}
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 .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. ЮSo I deleted the device in domoticz...and Mqttmapper created the same device exactlyFlyingDomotic 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.
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
Was correct in my first message and don't know when I changed that!!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
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}}}
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
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: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"}
}
}
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'.FYI, these messages are probably ping from/to MQTT server to keep connection active.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