Python Plugin: Shelly MQTT

Python and python framework

Moderator: leecollings

Gravityz
Posts: 583
Joined: Wednesday 16 December 2015 19:13
Target OS: NAS (Synology & others)
Domoticz version: 2022.2
Location: Netherlands
Contact:

Re: Python Plugin: Shelly MQTT

Post by Gravityz »

i agree with hoeby

the current shelly plugin uses the old school MQTT message style.(1 string per command/variable)
The new shellies use the more standard new MQTT style(1 big string with everything in it)

i think the new style is supported by the new MQTT auto discovery feature so no more special plugins needed
Maybe it also work for the old shellies

with node-red you can easy receive mqtt strings, filter/change those and send them back to domoticz

eg
i use node-red to receive the status of every device/light. translate it to be used in Google(nore nodes) and send the status back to domoticz
CronoS
Posts: 135
Joined: Wednesday 15 July 2015 23:40
Target OS: -
Domoticz version:
Contact:

Re: Python Plugin: Shelly MQTT

Post by CronoS »

Gravityz wrote: Wednesday 08 December 2021 12:39 ..
eg
i use node-red to receive the status of every device/light. translate it to be used in Google(nore nodes) and send the status back to domoticz
Thanks for the replies. In your opinion, is it smarter to invest time now in a NodeRed setup using Shellies (haven't got a clue yet how this works) or just simply wait that MQTT will be better implemented in the Shelly devices so that autodiscover is available natively by using Domoticz and in the meantime stick with this plugin?
hoeby
Posts: 528
Joined: Saturday 02 June 2018 11:05
Target OS: Raspberry Pi / ODroid
Domoticz version: V2022.1
Location: Echt, Netherlands
Contact:

Re: Python Plugin: Shelly MQTT

Post by hoeby »

The time you invest in nodered is not only for shellies.

You can use it for every device which does, for example mqtt.
Even devices that send out mqtt and are not supported by domoticz. If you have a little experiance with nodered you can concert those not supported mqtt messages to something domoticz can read.
Thin-client --> Docker Domoticz main environment
Pi3A+ --> Google home (GAssistPi)
Pi3B+ --> Docker (P1monitor, Domoticz test environment, Ubiquity controller)
Gravityz
Posts: 583
Joined: Wednesday 16 December 2015 19:13
Target OS: NAS (Synology & others)
Domoticz version: 2022.2
Location: Netherlands
Contact:

Re: Python Plugin: Shelly MQTT

Post by Gravityz »

also if you can use docker if possible.

docker uses standard images with which you can bring up node-red within minutes, it is that simple.

then the learning curve starts but once you play around with node-red you get the hang of it.

also on the node-red forum people are willing to help you out
coliin
Posts: 3
Joined: Sunday 29 October 2017 22:10
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.8153
Location: UK
Contact:

Re: Python Plugin: Shelly MQTT

Post by coliin »

Thanks for the work on the ShellyMQTT plugin. I'm just trying to get it to work for the first time and have followed the tutorial on installing this and Mosquito on the same RPI. Running with debug logging (see below) suggests that the events are being passed successfully though Mosquito to the plugin - but then there is an error:

2022-01-03 18:44:17.426 Error: ShellyMQTT: (ShellyMQTT) 'onMessage' failed 'KeyError'.
2022-01-03 18:44:17.427 Error: ShellyMQTT: (ShellyMQTT) ----> Line 1351 in '/home/pi/domoticz/plugins/Shelly_MQTT/plugin.py', function onMessage

I enable device discovery in Domoticz but there are no new devices found.

I've seen similar errors mentioned in some of the forum posts but not a definitive solution. Does anyone have any pointers?

Thanks in advance,
Colin.


2022-01-03 18:43:20.410 Status: Domoticz V2021.1 (c)2012-2021 GizMoCuz
2022-01-03 18:43:20.410 Status: Build Hash: 8547c5b7e, Date: 2021-04-17 16:29:11
2022-01-03 18:43:20.410 Status: Startup Path: /home/pi/domoticz/
2022-01-03 18:43:21.376 Status: PluginSystem: Started, Python version '3.7.3'.
2022-01-03 18:43:21.436 Status: WebServer(HTTP) started on address: :: with port 8080
2022-01-03 18:43:21.470 Status: WebServer(SSL) started on address: :: with port 443
2022-01-03 18:43:21.528 Status: TCPServer: shared server started...
2022-01-03 18:43:21.530 Status: RxQueue: queue worker started...
2022-01-03 18:43:23.530 Status: RFXCOM: Worker started...
2022-01-03 18:43:23.531 Status: ShellyMQTT: (ShellyMQTT) Entering work loop.
2022-01-03 18:43:23.532 Status: ShellyMQTT: (ShellyMQTT) Started.
2022-01-03 18:43:23.532 Status: NotificationSystem: thread started...
2022-01-03 18:43:23.540 Status: EventSystem: reset all events...
2022-01-03 18:43:23.557 Status: EventSystem: reset all device statuses...
2022-01-03 18:43:23.748 Status: PluginSystem: 1 plugins started.
2022-01-03 18:43:24.036 Status: ShellyMQTT: (ShellyMQTT) Initialized version 0.6.0
2022-01-03 18:43:24.215 Status: Python EventSystem: Initalizing event module.
2022-01-03 18:43:24.216 Status: EventSystem: Started
2022-01-03 18:43:24.217 Status: EventSystem: Queue thread started...
2022-01-03 18:44:17.416 ShellyMQTT: (ShellyMQTT) Received 850 bytes of data
2022-01-03 18:44:17.416 ShellyMQTT: (ShellyMQTT) 30 cf 06 00 28 73 68 65 6c 6c 69 65 73 2f 53 68 65 6c 6c 79 0Ϯ.(shellies/Shelly
2022-01-03 18:44:17.416 ShellyMQTT: (ShellyMQTT) 42 75 6c 62 44 75 6f 2d 38 43 41 41 42 35 35 46 36 44 43 39 BulbDuo-8CAAB55F6DC9
2022-01-03 18:44:17.416 ShellyMQTT: (ShellyMQTT) 2f 69 6e 66 6f 7b 22 77 69 66 69 5f 73 74 61 22 3a 7b 22 63 /info{"wifi_sta":{"c
2022-01-03 18:44:17.416 ShellyMQTT: (ShellyMQTT) 6f 6e 6e 65 63 74 65 64 22 3a 74 72 75 65 2c 22 73 73 69 64 onnected":true,"ssid
2022-01-03 18:44:17.417 ShellyMQTT: (ShellyMQTT) 22 3a 22 42 54 57 68 6f 6c 65 48 6f 6d 65 2d 4b 4a 46 22 2c ":"BTWholeHome-KJF",
2022-01-03 18:44:17.417 ShellyMQTT: (ShellyMQTT) 22 69 70 22 3a 22 31 39 32 2e 31 36 38 2e 30 2e 31 30 32 22 "ip":"192.168.0.102"
2022-01-03 18:44:17.417 ShellyMQTT: (ShellyMQTT) 2c 22 72 73 73 69 22 3a 2d 36 31 7d 2c 22 63 6c 6f 75 64 22 ,"rssi":-61},"cloud"
2022-01-03 18:44:17.417 ShellyMQTT: (ShellyMQTT) 3a 7b 22 65 6e 61 62 6c 65 64 22 3a 66 61 6c 73 65 2c 22 63 :{"enabled":false,"c
2022-01-03 18:44:17.417 ShellyMQTT: (ShellyMQTT) 6f 6e 6e 65 63 74 65 64 22 3a 66 61 6c 73 65 7d 2c 22 6d 71 onnected":false},"mq
2022-01-03 18:44:17.417 ShellyMQTT: (ShellyMQTT) 74 74 22 3a 7b 22 63 6f 6e 6e 65 63 74 65 64 22 3a 74 72 75 tt":{"connected":tru
2022-01-03 18:44:17.417 ShellyMQTT: (ShellyMQTT) 65 7d 2c 22 74 69 6d 65 22 3a 22 31 38 3a 34 34 22 2c 22 75 e},"time":"18:44","u
2022-01-03 18:44:17.417 ShellyMQTT: (ShellyMQTT) 6e 69 78 74 69 6d 65 22 3a 31 36 34 31 32 33 35 34 35 37 2c nixtime":1641235457,
2022-01-03 18:44:17.417 ShellyMQTT: (ShellyMQTT) 22 73 65 72 69 61 6c 22 3a 34 2c 22 68 61 73 5f 75 70 64 61 "serial":4,"has_upda
2022-01-03 18:44:17.417 ShellyMQTT: (ShellyMQTT) 74 65 22 3a 66 61 6c 73 65 2c 22 6d 61 63 22 3a 22 38 43 41 te":false,"mac":"8CA
2022-01-03 18:44:17.418 ShellyMQTT: (ShellyMQTT) 41 42 35 35 46 36 44 43 39 22 2c 22 63 66 67 5f 63 68 61 6e AB55F6DC9","cfg_chan
2022-01-03 18:44:17.418 ShellyMQTT: (ShellyMQTT) 67 65 64 5f 63 6e 74 22 3a 30 2c 22 61 63 74 69 6f 6e 73 5f ged_cnt":0,"actions_
2022-01-03 18:44:17.418 ShellyMQTT: (ShellyMQTT) 73 74 61 74 73 22 3a 7b 22 73 6b 69 70 70 65 64 22 3a 30 7d stats":{"skipped":0}
2022-01-03 18:44:17.418 ShellyMQTT: (ShellyMQTT) 2c 22 6c 69 67 68 74 73 22 3a 5b 7b 22 69 73 6f 6e 22 3a 74 ,"lights":[{"ison":t
2022-01-03 18:44:17.418 ShellyMQTT: (ShellyMQTT) 72 75 65 2c 22 73 6f 75 72 63 65 22 3a 22 68 74 74 70 22 2c rue,"source":"http",
2022-01-03 18:44:17.418 ShellyMQTT: (ShellyMQTT) 22 68 61 73 5f 74 69 6d 65 72 22 3a 66 61 6c 73 65 2c 22 74 "has_timer":false,"t
2022-01-03 18:44:17.418 ShellyMQTT: (ShellyMQTT) 69 6d 65 72 5f 73 74 61 72 74 65 64 22 3a 30 2c 22 74 69 6d imer_started":0,"tim
2022-01-03 18:44:17.418 ShellyMQTT: (ShellyMQTT) 65 72 5f 64 75 72 61 74 69 6f 6e 22 3a 30 2c 22 74 69 6d 65 er_duration":0,"time
2022-01-03 18:44:17.418 ShellyMQTT: (ShellyMQTT) 72 5f 72 65 6d 61 69 6e 69 6e 67 22 3a 30 2c 22 62 72 69 67 r_remaining":0,"brig
2022-01-03 18:44:17.419 ShellyMQTT: (ShellyMQTT) 68 74 6e 65 73 73 22 3a 31 30 30 2c 22 77 68 69 74 65 22 3a htness":100,"white":
2022-01-03 18:44:17.419 ShellyMQTT: (ShellyMQTT) 33 30 2c 22 74 65 6d 70 22 3a 33 38 34 30 2c 22 74 72 61 6e 30,"temp":3840,"tran
2022-01-03 18:44:17.419 ShellyMQTT: (ShellyMQTT) 73 69 74 69 6f 6e 22 3a 30 7d 5d 2c 22 6d 65 74 65 72 73 22 sition":0}],"meters"
2022-01-03 18:44:17.419 ShellyMQTT: (ShellyMQTT) 3a 5b 7b 22 70 6f 77 65 72 22 3a 39 2e 30 30 2c 22 69 73 5f :[{"power":9.00,"is_
2022-01-03 18:44:17.419 ShellyMQTT: (ShellyMQTT) 76 61 6c 69 64 22 3a 74 72 75 65 2c 22 74 69 6d 65 73 74 61 valid":true,"timesta
2022-01-03 18:44:17.419 ShellyMQTT: (ShellyMQTT) 6d 70 22 3a 31 36 34 31 32 33 35 34 35 37 2c 22 63 6f 75 6e mp":1641235457,"coun
2022-01-03 18:44:17.419 ShellyMQTT: (ShellyMQTT) 74 65 72 73 22 3a 5b 39 2e 30 30 30 2c 20 39 2e 30 30 30 2c ters":[9.000,.9.000,
2022-01-03 18:44:17.419 ShellyMQTT: (ShellyMQTT) 20 39 2e 30 30 30 5d 2c 22 74 6f 74 61 6c 22 3a 31 30 34 34 .9.000],"total":1044
2022-01-03 18:44:17.419 ShellyMQTT: (ShellyMQTT) 7d 5d 2c 22 75 70 64 61 74 65 22 3a 7b 22 73 74 61 74 75 73 }],"update":{"status
2022-01-03 18:44:17.419 ShellyMQTT: (ShellyMQTT) 22 3a 22 69 64 6c 65 22 2c 22 68 61 73 5f 75 70 64 61 74 65 ":"idle","has_update
2022-01-03 18:44:17.419 ShellyMQTT: (ShellyMQTT) 22 3a 66 61 6c 73 65 2c 22 6e 65 77 5f 76 65 72 73 69 6f 6e ":false,"new_version
2022-01-03 18:44:17.420 ShellyMQTT: (ShellyMQTT) 22 3a 22 32 30 32 31 31 31 30 39 2d 31 32 34 37 34 32 2f 76 ":"20211109-124742/v
2022-01-03 18:44:17.420 ShellyMQTT: (ShellyMQTT) 31 2e 31 31 2e 37 2d 67 36 38 32 61 30 64 62 22 2c 22 6f 6c 1.11.7-g682a0db","ol
2022-01-03 18:44:17.420 ShellyMQTT: (ShellyMQTT) 64 5f 76 65 72 73 69 6f 6e 22 3a 22 32 30 32 31 31 31 30 39 d_version":"20211109
2022-01-03 18:44:17.420 ShellyMQTT: (ShellyMQTT) 2d 31 32 34 37 34 32 2f 76 31 2e 31 31 2e 37 2d 67 36 38 32 -124742/v1.11.7-g682
2022-01-03 18:44:17.420 ShellyMQTT: (ShellyMQTT) 61 30 64 62 22 7d 2c 22 72 61 6d 5f 74 6f 74 61 6c 22 3a 35 a0db"},"ram_total":5
2022-01-03 18:44:17.420 ShellyMQTT: (ShellyMQTT) 31 33 35 32 2c 22 72 61 6d 5f 66 72 65 65 22 3a 33 39 32 38 1352,"ram_free":3928
2022-01-03 18:44:17.420 ShellyMQTT: (ShellyMQTT) 30 2c 22 66 73 5f 73 69 7a 65 22 3a 32 33 33 36 38 31 2c 22 0,"fs_size":233681,"
2022-01-03 18:44:17.420 ShellyMQTT: (ShellyMQTT) 66 73 5f 66 72 65 65 22 3a 31 36 33 39 30 33 2c 22 75 70 74 fs_free":163903,"upt
2022-01-03 18:44:17.420 ShellyMQTT: (ShellyMQTT) 69 6d 65 22 3a 37 30 30 36 7d .. .. .. .. .. .. .. .. .. .. ime":7006}
2022-01-03 18:44:17.420 ShellyMQTT: (ShellyMQTT) Received 49 bytes of data
2022-01-03 18:44:17.421 ShellyMQTT: (ShellyMQTT) 30 2f 00 2b 73 68 65 6c 6c 69 65 73 2f 53 68 65 6c 6c 79 42 0/.+shellies/ShellyB
2022-01-03 18:44:17.421 ShellyMQTT: (ShellyMQTT) 75 6c 62 44 75 6f 2d 38 43 41 41 42 35 35 46 36 44 43 39 2f ulbDuo-8CAAB55F6DC9/
2022-01-03 18:44:17.421 ShellyMQTT: (ShellyMQTT) 6c 69 67 68 74 2f 30 6f 6e .. .. .. .. .. .. .. .. .. .. .. light/0on
2022-01-03 18:44:17.421 ShellyMQTT: (ShellyMQTT) Received 214 bytes of data
2022-01-03 18:44:17.421 ShellyMQTT: (ShellyMQTT) 30 d3 01 00 32 73 68 65 6c 6c 69 65 73 2f 53 68 65 6c 6c 79 0Ӯ.2shellies/Shelly
2022-01-03 18:44:17.421 ShellyMQTT: (ShellyMQTT) 42 75 6c 62 44 75 6f 2d 38 43 41 41 42 35 35 46 36 44 43 39 BulbDuo-8CAAB55F6DC9
2022-01-03 18:44:17.421 ShellyMQTT: (ShellyMQTT) 2f 6c 69 67 68 74 2f 30 2f 73 74 61 74 75 73 7b 22 69 73 6f /light/0/status{"iso
2022-01-03 18:44:17.421 ShellyMQTT: (ShellyMQTT) 6e 22 3a 74 72 75 65 2c 22 73 6f 75 72 63 65 22 3a 22 68 74 n":true,"source":"ht
2022-01-03 18:44:17.421 ShellyMQTT: (ShellyMQTT) 74 70 22 2c 22 68 61 73 5f 74 69 6d 65 72 22 3a 66 61 6c 73 tp","has_timer":fals
2022-01-03 18:44:17.421 ShellyMQTT: (ShellyMQTT) 65 2c 22 74 69 6d 65 72 5f 73 74 61 72 74 65 64 22 3a 30 2c e,"timer_started":0,
2022-01-03 18:44:17.422 ShellyMQTT: (ShellyMQTT) 22 74 69 6d 65 72 5f 64 75 72 61 74 69 6f 6e 22 3a 30 2c 22 "timer_duration":0,"
2022-01-03 18:44:17.422 ShellyMQTT: (ShellyMQTT) 74 69 6d 65 72 5f 72 65 6d 61 69 6e 69 6e 67 22 3a 30 2c 22 timer_remaining":0,"
2022-01-03 18:44:17.422 ShellyMQTT: (ShellyMQTT) 62 72 69 67 68 74 6e 65 73 73 22 3a 31 30 30 2c 22 77 68 69 brightness":100,"whi
2022-01-03 18:44:17.422 ShellyMQTT: (ShellyMQTT) 74 65 22 3a 33 30 2c 22 74 65 6d 70 22 3a 33 38 34 30 2c 22 te":30,"temp":3840,"
2022-01-03 18:44:17.422 ShellyMQTT: (ShellyMQTT) 74 72 61 6e 73 69 74 69 6f 6e 22 3a 30 7d .. .. .. .. .. .. transition":0}
2022-01-03 18:44:17.422 ShellyMQTT: (ShellyMQTT) Received 57 bytes of data
2022-01-03 18:44:17.422 ShellyMQTT: (ShellyMQTT) 30 37 00 31 73 68 65 6c 6c 69 65 73 2f 53 68 65 6c 6c 79 42 07.1shellies/ShellyB
2022-01-03 18:44:17.422 ShellyMQTT: (ShellyMQTT) 75 6c 62 44 75 6f 2d 38 43 41 41 42 35 35 46 36 44 43 39 2f ulbDuo-8CAAB55F6DC9/
2022-01-03 18:44:17.422 ShellyMQTT: (ShellyMQTT) 6c 69 67 68 74 2f 30 2f 70 6f 77 65 72 39 2e 30 30 .. .. .. light/0/power9.00
2022-01-03 18:44:17.422 ShellyMQTT: (ShellyMQTT) Received 58 bytes of data
2022-01-03 18:44:17.423 ShellyMQTT: (ShellyMQTT) 30 38 00 32 73 68 65 6c 6c 69 65 73 2f 53 68 65 6c 6c 79 42 08.2shellies/ShellyB
2022-01-03 18:44:17.423 ShellyMQTT: (ShellyMQTT) 75 6c 62 44 75 6f 2d 38 43 41 41 42 35 35 46 36 44 43 39 2f ulbDuo-8CAAB55F6DC9/
2022-01-03 18:44:17.423 ShellyMQTT: (ShellyMQTT) 6c 69 67 68 74 2f 30 2f 65 6e 65 72 67 79 31 30 34 34 .. .. light/0/energy1044
2022-01-03 18:44:17.424 ShellyMQTT: (ShellyMQTT) MQTT message: shellies/ShellyBulbDuo-8CAAB55F6DC9/info {'wifi_sta': {'connected': True, 'ssid': 'BTWholeHome-KJF', 'ip': '192.168.0.102', 'rssi': -61}, 'cloud': {'enabled': False, 'connected': False}, 'mqtt': {'connected': True}, 'time': '18:44', 'unixtime': 1641235457, 'serial': 4, 'has_update': False, 'mac': '8CAAB55F6DC9', 'cfg_changed_cnt': 0, 'actions_stats': {'skipped': 0}, 'lights': [{'ison': True, 'source': 'http', 'has_timer': False, 'timer_started': 0, 'timer_duration': 0, 'timer_remaining': 0, 'brightness': 100, 'white': 30, 'temp': 3840, 'transition': 0}], 'meters': [{'power': 9.0, 'is_valid': True, 'timestamp': 1641235457, 'counters': [9.0, 9.0, 9.0], 'total': 1044}], 'update': {'status': 'idle', 'has_update': False, 'new_version': '20211109-124742/v1.11.7-g682a0db', 'old_version': '20211109-124742/v1.11.7-g682a0db'}, 'ram_total': 51352, 'ram_free': 39280, 'fs_size': 233681, 'fs_free': 163903, 'uptime': 7006}
2022-01-03 18:44:17.425 ShellyMQTT: (ShellyMQTT) MQTT message: shellies/ShellyBulbDuo-8CAAB55F6DC9/light/0 on
2022-01-03 18:44:17.425 ShellyMQTT: (ShellyMQTT) >>> Looking for device: ShellyBulbDuo-8CAAB55F6DC9-0-dimmer
2022-01-03 18:44:17.426 ShellyMQTT: (ShellyMQTT) MQTT message: shellies/ShellyBulbDuo-8CAAB55F6DC9/light/0/status {'ison': True, 'source': 'http', 'has_timer': False, 'timer_started': 0, 'timer_duration': 0, 'timer_remaining': 0, 'brightness': 100, 'white': 30, 'temp': 3840, 'transition': 0}
2022-01-03 18:44:17.426 ShellyMQTT: (ShellyMQTT) >>> Looking for device: ShellyBulbDuo-8CAAB55F6DC9-0-dimmer
2022-01-03 18:44:17.427 ShellyMQTT: (ShellyMQTT) Local context:
2022-01-03 18:44:17.427 ShellyMQTT: (ShellyMQTT) ----> 'Devices' '{}'
2022-01-03 18:44:17.427 ShellyMQTT: (ShellyMQTT) ----> 'Domoticz' '<module 'Domoticz' (built-in)>'
2022-01-03 18:44:17.427 ShellyMQTT: (ShellyMQTT) ----> 'Images' '{}'
2022-01-03 18:44:17.428 ShellyMQTT: (ShellyMQTT) ----> 'Parameters' '{'HardwareID': 13, 'HomeFolder': '/home/pi/domoticz/plugins/Shelly_MQTT/', 'StartupFolder': '/home/pi/domoticz/', 'UserDataFolder': '/home/pi/domoticz/', 'WebRoot': '', 'Database': '/home/pi/domoticz/domoticz.db', 'Language': 'en', 'Version': '0.6.0', 'Author': '', 'Name': 'ShellyMQTT', 'Address': '127.0.0.1', 'Port': '1883', 'SerialPort': '', 'Username': '', 'Password': '', 'Key': 'ShellyMQTT', 'Mode1': '0', 'Mode2': '0', 'Mode3': '0', 'Mode4': '0', 'Mode5': '0', 'Mode6': 'Verbose', 'DomoticzVersion': '2021.1', 'DomoticzHash': '8547c5b7e', 'DomoticzBuildTime': '2021-04-17 16:29:11'}'
2022-01-03 18:44:17.429 ShellyMQTT: (ShellyMQTT) ----> 'Settings' '{'DB_Version': '148', 'Title': 'Domoticz', 'LightHistoryDays': '30', 'MeterDividerEnergy': '1000', 'MeterDividerGas': '100', 'MeterDividerWater': '100', 'RandomTimerFrame': '15', 'ElectricVoltage': '230', 'CM113DisplayType': '0', '5MinuteHistoryDays': '5', 'SensorTimeout': '60', 'SensorTimeoutNotification': '0', 'UseAutoUpdate': '0', 'UseAutoBackup': '0', 'CostEnergy': '2149', 'CostEnergyT2': '2149', 'CostEnergyR1': '800', 'CostEnergyR2': '800', 'CostGas': '6218', 'CostWater': '16473', 'UseEmailInNotifications': '1', 'SendErrorNotifications': '0', 'EmailPort': '25', 'EmailAsAttachment': '0', 'DoorbellCommand': '0', 'SmartMeterType': '0', 'EnableTabLights': '1', 'EnableTabTemp': '1', 'EnableTabWeather': '0', 'EnableTabUtility': '1', 'EnableTabCustom': '1', 'EnableTabScenes': '1', 'EnableTabFloorplans': '0', 'NotificationSensorInterval': '43200', 'NotificationSwitchInterval': '0', 'RemoteSharedPort': '6144', 'Language': 'en', 'DashboardType': '0', 'MobileType': '1', 'WindUnit': '0', 'TempUnit': '0', 'WeightUnit': '0', 'SecStatus': '0', 'SecOnDelay': '30', 'AuthenticationMethod': '0', 'ReleaseChannel': '0', 'RaspCamParams': '-w 800 -h 600 -t 1', 'UVCParams': '-S80 -B128 -C128 -G80 -x800 -y600 -q100', 'AcceptNewHardware': '0', 'ZWavePollInterval': '60', 'ZWaveEnableDebug': '0', 'ZWaveNetworkKey': '0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x10', 'ZWaveEnableNightlyNetworkHeal': '0', 'BatteryLowNotification': '10', 'AllowWidgetOrdering': '1', 'ActiveTimerPlan': '0', 'HideDisabledHardwareSensors': '1', 'DisableDzVentsSystem': '0', 'DzVentsLogLevel': '4', 'LogEventScriptTrigger': '1', 'WebTheme': 'default', 'FloorplanPopupDelay': '750', 'FloorplanFullscreenMode': '0', 'FloorplanAnimateZoom': '1', 'FloorplanShowSensorValues': '1', 'FloorplanShowSwitchValues': '0', 'FloorplanShowSceneNames': '1', 'FloorplanRoomColour': 'Blue', 'FloorplanActiveOpacity': '25', 'FloorplanInactiveOpacity': '5', 'TempHome': '20', 'TempAway': '15', 'TempComfort': '22.0', 'DegreeDaysBaseTemperature': '18.0', 'HTTPURL': 'aHR0cHM6Ly93d3cuc29tZWdhdGV3YXkuY29tL3B1c2h1cmwucGhwP3VzZXJuYW1lPSNGSUVMRDEmcGFzc3dvcmQ9I0ZJRUxEMiZhcGlrZXk9I0ZJRUxEMyZmcm9tPSNGSUVMRDQmdG89I1RPJm1lc3NhZ2U9I01FU1NBR0U=', 'HTTPPostContentType': 'YXBwbGljYXRpb24vanNvbg==', 'ShowUpdateEffect': '0', 'ShortLogInterval': '5', 'SendErrorsAsNotification': '0', 'Location': '51.308347;-0.073511', 'ClickatellEnabled': '0', 'ClickatellAPI': '0', 'ClickatellFrom': '0', 'ClickatellPassword': '0', 'ClickatellTo': '0', 'ClickatellUser': '0', 'EmailFrom': '0', 'EmailServer': '0', 'EmailTo': '0', 'EmailPassword': '0', 'EmailUsername': '0', 'GCMEnabled': '0', 'HTTPEnabled': '0', 'HTTPField1': '0', 'HTTPField2': '0', 'HTTPField3': '0', 'HTTPField4': '0', 'HTTPPostData': '0', 'HTTPPostHeaders': '0', 'HTTPTo': '0', 'KodiIPAddress': '224.0.0.1', 'KodiEnabled': '0', 'KodiPort': '9777', 'KodiTimeToLive': '5', 'LmsPlayerMac': '0', 'LmsDuration': '5', 'LmsEnabled': '0', 'NMAAPI': '0', 'NMAEnabled': '0', 'ProwlAPI': '0', 'ProwlEnabled': '0', 'PushALotAPI': '0', 'PushALotEnabled': '0', 'PushbulletAPI': '0', 'PushbulletEnabled': '0', 'PushoverAPI': '0', 'PushoverUser': '0', 'PushoverEnabled': '0', 'PushsaferAPI': '0', 'PushsaferImage': '0', 'PushsaferEnabled': '0', 'WebUserName': 'Y29saWlu', 'WebPassword': '366bd8732e0c7f4078e70c72d866b4c6', 'WebLocalNetworks': '192.168.0.*; 127.0.0.*', 'SecPassword': 'd41d8cd98f00b204e9800998ecf8427e', 'ProtectionPassword': 'd41d8cd98f00b204e9800998ecf8427e', 'MyDomoticzUserId': '0', 'MyDomoticzSubsystems': '0', 'OneWireSensorPollPeriod': '0', 'OneWireSwitchPollPeriod': '0', 'EnableEventScriptSystem': '1', 'IFTTTEnabled': '0', 'EmailEnabled': '1', 'TelegramAPI': '0', 'TelegramChat': '0', 'TelegramEnabled': '0', 'WebRemoteProxyIPs': '0', 'IFTTTAPI': '0', 'EventSystemLogFullURL': '1', 'MaxElectricPower': '6000', 'FCMEnabled': '0'}'
2022-01-03 18:44:17.429 ShellyMQTT: (ShellyMQTT) ----> '_plugin' '<plugin.BasePlugin object at 0x7246a1b0>'
2022-01-03 18:44:17.429 ShellyMQTT: (ShellyMQTT) ----> 'errmsg' ''
2022-01-03 18:44:17.429 ShellyMQTT: (ShellyMQTT) ----> 'json' '<module 'json' from '/usr/lib/python3.7/json/__init__.py'>'
2022-01-03 18:44:17.430 ShellyMQTT: (ShellyMQTT) ----> 're' '<module 're' from '/usr/lib/python3.7/re.py'>'
2022-01-03 18:44:17.430 ShellyMQTT: (ShellyMQTT) ----> 'time' '<module 'time' (built-in)>'
2022-01-03 18:44:17.430 ShellyMQTT: (ShellyMQTT) MQTT message: shellies/ShellyBulbDuo-8CAAB55F6DC9/light/0/power 9.0
2022-01-03 18:44:17.430 ShellyMQTT: (ShellyMQTT) >>> Looking for device: ShellyBulbDuo-8CAAB55F6DC9-0-energy
2022-01-03 18:44:17.431 ShellyMQTT: (ShellyMQTT) MQTT message: shellies/ShellyBulbDuo-8CAAB55F6DC9/light/0/energy 1044
2022-01-03 18:44:17.431 ShellyMQTT: (ShellyMQTT) >>> Looking for device: ShellyBulbDuo-8CAAB55F6DC9-0-energy
2022-01-03 18:44:17.426 Error: ShellyMQTT: (ShellyMQTT) 'onMessage' failed 'KeyError'.
2022-01-03 18:44:17.427 Error: ShellyMQTT: (ShellyMQTT) ----> Line 1351 in '/home/pi/domoticz/plugins/Shelly_MQTT/plugin.py', function onMessage
2022-01-03 18:44:17.427 Error: ShellyMQTT: (ShellyMQTT) ----> Line 326 in '/home/pi/domoticz/plugins/Shelly_MQTT/plugin.py', function onMessage
2022-01-03 18:44:17.427 Error: ShellyMQTT: (ShellyMQTT) ----> Line 176 in '/home/pi/domoticz/plugins/Shelly_MQTT/mqtt.py', function onMessage
2022-01-03 18:44:17.427 Error: ShellyMQTT: (ShellyMQTT) ----> Line 1231 in '/home/pi/domoticz/plugins/Shelly_MQTT/plugin.py', function onMQTTPublish
2022-01-03 18:44:21.241 ShellyMQTT: (ShellyMQTT) Received 58 bytes of data
2022-01-03 18:44:21.242 ShellyMQTT: (ShellyMQTT) 30 38 00 32 73 68 65 6c 6c 69 65 73 2f 53 68 65 6c 6c 79 42 08.2shellies/ShellyB
2022-01-03 18:44:21.242 ShellyMQTT: (ShellyMQTT) 75 6c 62 44 75 6f 2d 38 43 41 41 42 35 35 46 36 44 43 39 2f ulbDuo-8CAAB55F6DC9/
2022-01-03 18:44:21.242 ShellyMQTT: (ShellyMQTT) 6c 69 67 68 74 2f 30 2f 65 6e 65 72 67 79 31 30 34 34 .. .. light/0/energy1044
2022-01-03 18:44:21.242 ShellyMQTT: (ShellyMQTT) MQTT message: shellies/ShellyBulbDuo-8CAAB55F6DC9/light/0/energy 1044
2022-01-03 18:44:21.243 ShellyMQTT: (ShellyMQTT) >>> Looking for device: ShellyBulbDuo-8CAAB55F6DC9-0-energy
2022-01-03 18:44:25.052 ShellyMQTT: (ShellyMQTT) Heartbeating...
2022-01-03 18:44:25.052 ShellyMQTT: (ShellyMQTT) MqttClient::ping
2022-01-03 18:44:25.052 ShellyMQTT: (ShellyMQTT) Sending 2 bytes of data
2022-01-03 18:44:25.052 ShellyMQTT: (ShellyMQTT) c0 00 .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. �
2022-01-03 18:44:25.103 ShellyMQTT: (ShellyMQTT) Received 2 bytes of data
2022-01-03 18:44:25.103 ShellyMQTT: (ShellyMQTT) d0 00 .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. Ю
2022-01-03 18:44:35.080 ShellyMQTT: (ShellyMQTT) Heartbeating...
2022-01-03 18:44:35.080 ShellyMQTT: (ShellyMQTT) MqttClient::ping
2022-01-03 18:44:35.080 ShellyMQTT: (ShellyMQTT) Sending 2 bytes of data
2022-01-03 18:44:35.080 ShellyMQTT: (ShellyMQTT) c0 00 .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. �
2022-01-03 18:44:35.131 ShellyMQTT: (ShellyMQTT) Received 2 bytes of data
2022-01-03 18:44:35.131 ShellyMQTT: (ShellyMQTT) d0 00 .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. Ю
2022-01-03 18:44:37.005 Status: EventSystem: Script event triggered: Extractor
2022-01-03 18:44:45.054 ShellyMQTT: (ShellyMQTT) Heartbeating...
2022-01-03 18:44:45.054 ShellyMQTT: (ShellyMQTT) MqttClient::ping
2022-01-03 18:44:45.054 ShellyMQTT: (ShellyMQTT) Sending 2 bytes of data
2022-01-03 18:44:45.054 ShellyMQTT: (ShellyMQTT) c0 00 .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. �
2022-01-03 18:44:45.105 ShellyMQTT: (ShellyMQTT) Received 2 bytes of data
2022-01-03 18:44:45.105 ShellyMQTT: (ShellyMQTT) d0 00 .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. Ю
Raspberry Pi Rfxtrx433 Domoticz v3.8153
kknuut
Posts: 1
Joined: Friday 07 January 2022 12:46
Target OS: -
Domoticz version:
Contact:

Re: Python Plugin: Shelly MQTT

Post by kknuut »

Hi,

Stumpled into this problem after installing my Shelly Pro4PM. I have been adding more shellys to my property and now feel bit uncertain as it seems Shelly has updated communication, which probably will find it's way to older devices too, but original plugin author is not actively developing currently.

As a fast fix, I forked original plugin and added very basic switch support to get it working for my use case.
It installs 4 switches and allows to command on / off. It does not support energy meters or separated switch modes.


You must configure MQTT custom path as following to get it into same topic structure as older units:

shellies/<shelly-ident>
for eg. shellies/shellypro4pm-1

"Generic status update over MQTT" should be enabled

My fork of the plugin with added support:

https://github.com/kknuut/Shelly_MQTT
coliin
Posts: 3
Joined: Sunday 29 October 2017 22:10
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.8153
Location: UK
Contact:

Re: Python Plugin: Shelly MQTT

Post by coliin »

Thanks for this - at least I know what *not* to spend time on now!
Raspberry Pi Rfxtrx433 Domoticz v3.8153
lio908
Posts: 2
Joined: Sunday 16 January 2022 18:01
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: Shelly MQTT

Post by lio908 »

Hello
Ho do i to send messages MQTT with sensor ON/OFF by Domoticz?
I Try with this script "script://python/mqttpub.py shellies/Shelly25_Bureau/relay/0 on"

with this script here
https://blogwifi.fr/brouillon-auto/

On log I read feedback of sensor, so I understand that MQTT is OK.

With MQTT Explorer, I read my Shelly sensor and when I test with Publish it's OK, relay 0 swith ON to OFF and OFF to ON but my sensor made nothink
By 192.168.0.xxx of my sensor, ON/OFF is OK, I here my Shelly to change

CL.
Gravityz
Posts: 583
Joined: Wednesday 16 December 2015 19:13
Target OS: NAS (Synology & others)
Domoticz version: 2022.2
Location: Netherlands
Contact:

Re: Python Plugin: Shelly MQTT

Post by Gravityz »

i think you are trying to do something which is not logical.

if you install the shelly MQTT plugin it will recognize the shelly 2.5 and will create switches in domoticz for it.
to control it just flip the switch in domoticz and it will send out the appropriate MQTT conmmands.

if you do not have/want the shelly plugin but you want to control the shelly with dummy switches in domoticz it is easier to use HTTP
just use the correct ip addres from the shelly 2.5 and you are good to go
testswitch.JPG
testswitch.JPG (47.52 KiB) Viewed 3100 times
lio908
Posts: 2
Joined: Sunday 16 January 2022 18:01
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: Shelly MQTT

Post by lio908 »

Thank you Gravityz

Second solution is OK, Shelly flip ON/OFF

First solution create all switche attached at the Shelly2.5 but there is no réaction...
I will réinstal plugin

Thank you
Gravityz
Posts: 583
Joined: Wednesday 16 December 2015 19:13
Target OS: NAS (Synology & others)
Domoticz version: 2022.2
Location: Netherlands
Contact:

Re: Python Plugin: Shelly MQTT

Post by Gravityz »

ok i understand.
please check in the shelly that mqtt is enabled and you DO NOT use any prefix
so enable MQTT
username blank
password blank
server: 192.168.1.xxx:1883

in domoticz at the shelly plugin
make sure you have the right MQTT server address(you need to install a seperate mqtt server, this is not the ip address of the shelly)
port also 1883
microchip1974
Posts: 14
Joined: Friday 21 February 2020 8:13
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.11774
Location: Italy
Contact:

Re: Python Plugin: Shelly MQTT

Post by microchip1974 »

Hello, i have a Shelly EM - Shelly MQTT working for all my other shellies and also reading energies and voltages auto creating the devices on Domoticz.
But the power messages are not creating any devices .
as per Faq i did :
-enable "Accept new hardware devices" in Domoticz settings
-DISABLE "Use custom MQTT prefix" at the Shelly device options
-enable "I am accepting that Power reading may be inaccurate and is totally unsupported, just enable it!" setting at Shelly_MQTT settings page

also erased al the Shelly EM devices but the autodiscover keeps on ignoring the power reading
Attachments
2.JPG
2.JPG (213.26 KiB) Viewed 3070 times
1.JPG
1.JPG (235.74 KiB) Viewed 3070 times
Pizigate Plugin version: 5.1.017
Firmware version: 0321
Gravityz
Posts: 583
Joined: Wednesday 16 December 2015 19:13
Target OS: NAS (Synology & others)
Domoticz version: 2022.2
Location: Netherlands
Contact:

Re: Python Plugin: Shelly MQTT

Post by Gravityz »

why are your reading negative?
maybe this is causing the problem

mine shows this

MQTT message: shellies/shelly1pm-98CDAC2FDC0E/relay/0/power 6.59
Last edited by Gravityz on Tuesday 18 January 2022 17:43, edited 1 time in total.
microchip1974
Posts: 14
Joined: Friday 21 February 2020 8:13
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.11774
Location: Italy
Contact:

Re: Python Plugin: Shelly MQTT

Post by microchip1974 »

its connected to solar panels and with cloud was the right way for good reading. With Shelly cloud everything was good. But i can give a change and invert both clamps.
Strange anyway that the device is not created with 0 or wrong readings
Pizigate Plugin version: 5.1.017
Firmware version: 0321
microchip1974
Posts: 14
Joined: Friday 21 February 2020 8:13
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.11774
Location: Italy
Contact:

Re: Python Plugin: Shelly MQTT

Post by microchip1974 »

Gravityz wrote: Tuesday 18 January 2022 11:27 whay are your reading negative?
maybe this is causing the problem
Clamps inverted, now values are positive but the plugin keeps on ignoring the two messages
shellies/shellyem-057CB5/emeter/1/power
shellies/shellyem-057CB5/emeter/0/power
and no device created for instant power in watts
Pizigate Plugin version: 5.1.017
Firmware version: 0321
Gravityz
Posts: 583
Joined: Wednesday 16 December 2015 19:13
Target OS: NAS (Synology & others)
Domoticz version: 2022.2
Location: Netherlands
Contact:

Re: Python Plugin: Shelly MQTT

Post by Gravityz »

with my shelly 1pm it only created an energy device, no power device so maybe it is a flaw of the plugin

no big deal for me because the instant power is visible on the kWh meter
indeed if you need power graphics you need the device
heistje
Posts: 23
Joined: Saturday 21 January 2017 13:42
Target OS: Raspberry Pi / ODroid
Domoticz version: 2023.2
Location: Belgium
Contact:

Re: Python Plugin: Shelly MQTT

Post by heistje »

I am considering buying some of Shelly TRVs.
I already use this plugin for other Shelly devices (some Plugs and Motion) and I am happy with it.
Is there any intention of adding the TRV to the list with supported devices of the Shelly MQTT plugin? Would be great!
Bullseye on RPI 4
Aeotec Z-Wave Plus Z-Stick Gen5
Zwave-JS-UI
RFXtrx433E
Eth8020
P1 USB
Shellys
ESP8266
Derik
Posts: 1601
Joined: Friday 18 October 2013 23:33
Target OS: Raspberry Pi / ODroid
Domoticz version: BETA
Location: Arnhem/Nijmegen Nederland
Contact:

Re: Python Plugin: Shelly MQTT

Post by Derik »

Hi... Hope there is some nfo here...
Is there perhaps not a option to use the mqtt settings from the shelly without a plugin?
I hope like a node-red or directly into Domoticz
In latest beta's, there is also a option build to skip the z2m plugin so you can youse the z2m config directly into Domoticz.
I have work some shelly in nodered[ get this from someone] only like to have more working in nodered.
I use almost from the beginning Domoticz, the most trouble i did have, was with a lot of plugins, so why no hardcored like other hardware,,,

Hope :-)

Perhaps work together with Rob from Domoticz...
Xu4: Beta Extreme antenna RFXcomE,WU Fi Ping ip P1 Gen5 PVOutput Harmony HUE SolarmanPv OTG Winddelen Alive ESP Buienradar MySensors WOL Winddelen counting RPi: Beta SMAspot RFlinkTest Domoticz ...Different backups
User avatar
waltervl
Posts: 5148
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: Python Plugin: Shelly MQTT

Post by waltervl »

All options (plugin, native c++ integration, node red) will need maintenance. So if someone is not maintained the plugin someone else can take over. Domoticz and it's python plugins is a community solution so the community is important.

The current Mqtt autodiscover Integration is only there because some major gateways are supporting MQTT HA Autodiscover protocol. Shelly is not supporting it. So you always will need an integration. I hope someone will update the python plugin as that is currently the best way to integrate Shelly devices.
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
Derik
Posts: 1601
Joined: Friday 18 October 2013 23:33
Target OS: Raspberry Pi / ODroid
Domoticz version: BETA
Location: Arnhem/Nijmegen Nederland
Contact:

Re: Python Plugin: Shelly MQTT

Post by Derik »

waltervl wrote: Sunday 06 February 2022 18:25 All options (plugin, native c++ integration, node red) will need maintenance. So if someone is not maintained the plugin someone else can take over. Domoticz and it's python plugins is a community solution so the community is important.

The current Mqtt autodiscover Integration is only there because some major gateways are supporting MQTT HA Autodiscover protocol. Shelly is not supporting it. So you always will need an integration. I hope someone will update the python plugin as that is currently the best way to integrate Shelly devices.
I think that open source hardware better hardcore works then a plugin.
I do respect every one that spend time in every open source project!
Only i my eyes should it be better to work together so all time is central investment...

Now there are a lot different projects . Imagine they work together..

The reason for z2m integration. There where a few icters that work together with rob ..
Perhaps some will cooperate in the slack domoticz channel..

I am a bricklayer. So not smart enough 🙈🙈🙈
Xu4: Beta Extreme antenna RFXcomE,WU Fi Ping ip P1 Gen5 PVOutput Harmony HUE SolarmanPv OTG Winddelen Alive ESP Buienradar MySensors WOL Winddelen counting RPi: Beta SMAspot RFlinkTest Domoticz ...Different backups
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest