Page 2 of 3
Re: Python plugin: Sonoff-Tasmota + Other devices supporting MQTT Discovery
Posted: Monday 05 February 2018 9:27
by emontnemery
When i disable the plugin and a few seconds later switch it back on i get on error on one of them and can't resolve that.
I pushed a commit which should remove this error (it's the same as the first error you reported).
By the way, did you see any side effect when this error was shown such as switch not working?
(It should have been harmless except for annoying error message in the log).
Re: Python plugin: Sonoff-Tasmota + Other devices supporting MQTT Discovery
Posted: Monday 05 February 2018 9:33
by mikeoo
emontnemery wrote: ↑Monday 05 February 2018 9:27
When i disable the plugin and a few seconds later switch it back on i get on error on one of them and can't resolve that.
I pushed a commit which should remove this error (it's the same as the first error you reported).
By the way, did you see any side effect when this error was shown such as switch not working?
(It should have been harmless except for annoying error message in the log).
Run Git Pull and disable and enable the plugin and now i get this error
Code: Select all
2018-02-05 09:32:41.578 Error: (MQTTDiscovery) failed to load 'plugin.py', Python Path used was '/home/pi/domoticz/plugins/domoticz_mqtt_discovery/:/usr/lib/python3.4/:/usr/lib/python3.4/plat-arm-linux-gnueabihf:/usr/lib/python3.4/lib-dynload'.
2018-02-05 09:32:41.578 Error: (MQTT Discovery) Module Import failed, exception: 'SyntaxError'
2018-02-05 09:32:41.578 Error: (MQTT Discovery) Import detail: File: /home/pi/domoticz/plugins/domoticz_mqtt_discovery/plugin.py, Line: 480, offset: 41
2018-02-05 09:32:41.578 Error: (MQTT Discovery) Error Line 'device.Update(nValue=nValue, sValue, TimedOut=TimedOut)
And a few seconds later
Code: Select all
2018-02-05 09:34:00.190 Error: MQTT Discovery hardware (15) thread seems to have ended unexpectedly
Logging with Verbose is not working for this because it stops running
No my switches are not working any more

Re: Python plugin: Sonoff-Tasmota + Other devices supporting MQTT Discovery
Posted: Monday 05 February 2018 10:24
by emontnemery
Run Git Pull and disable and enable the plugin and now i get this error
Sorry, please update again, it should be fixed now!

Re: Python plugin: Sonoff-Tasmota + Other devices supporting MQTT Discovery
Posted: Monday 05 February 2018 11:23
by mikeoo
emontnemery wrote: ↑Monday 05 February 2018 10:24
Run Git Pull and disable and enable the plugin and now i get this error
Sorry, please update again, it should be fixed now!
No problem. That is part of testing

If you need more testing let me know.
Tnx for the quick fix and plugin now running without errors
For your other question, there was no side effect with the error but pure cosmetic. Logging is otherwise full with errors so this is much better.
Re: Python plugin: Sonoff-Tasmota + Other devices supporting MQTT Discovery
Posted: Monday 12 February 2018 21:15
by emontnemery
Reconos wrote: ↑Sunday 04 February 2018 15:21
My Domoticz is using my 3.6.4 Python installation:
Code: Select all
2018-02-04 15:17:10.318 Domoticz V3.8875 (c)2012-2018 GizMoCuz
I have some time to look at this now, and I prepared a debug build which should hopefully helps narrow down why the onConnect callback does not work.
Is PM working for you now in the Domoticz forum? Otherwise, how about discussing on github?
Re: Python plugin: Sonoff-Tasmota + Other devices supporting MQTT Discovery
Posted: Tuesday 13 February 2018 6:54
by Reconos
emontnemery wrote: ↑Monday 12 February 2018 21:15
Reconos wrote: ↑Sunday 04 February 2018 15:21
My Domoticz is using my 3.6.4 Python installation:
Code: Select all
2018-02-04 15:17:10.318 Domoticz V3.8875 (c)2012-2018 GizMoCuz
I have some time to look at this now, and I prepared a debug build which should hopefully helps narrow down why the onConnect callback does not work.
Is PM working for you now in the Domoticz forum? Otherwise, how about discussing on github?
Pm's are working now, so just throw me a message

Re: Python plugin: Sonoff-Tasmota + Other devices supporting MQTT Discovery
Posted: Monday 26 February 2018 5:28
by Wob76
Hi,
This sounds very interesting, do you have a little more documentation on the MQTT formating, Topic, payload, etc?
I am currently using a custom nodered flow for controlling my lightify lighting, I tried to implement auto creation of the lights but it proved problematic in matching using the names to match them up, and I couldn't find a way to push a MAC into the device via JSON. If I could reformat my MQTT messages to meet your requirements it could be a good fit.
Thanks,
Wob
Re: Python plugin: Sonoff-Tasmota + Other devices supporting MQTT Discovery
Posted: Monday 26 February 2018 7:18
by mikeoo
Update
Look like the latest Domoticz Beta V3.8968 solve the problem
---------------------------------------------------------------------------------------
Yesterday i update the plugin with Git Pull. Plug-in was working fine from 5-2-2018.
In the morning a get errors in te log of Domoticz.
When i restart the system and Domoticz i get the error also when ik finsched with rebooting.
Code: Select all
2018-02-26 07:21:01.355 EventSystem: Queue thread started...
2018-02-26 07:21:01.409 (MQTT Discovery) Successful connect to: 127.0.0.1:1883
2018-02-26 07:21:01.422 MQTT: Subscribed
2018-02-26 07:21:01.544 Error: (MQTT Discovery) 'onMessage' failed 'AttributeError':''Domoticz.Device' object has no attribute 'SwitchType''.
2018-02-26 07:21:01.544 Error: (MQTT Discovery) ----> Line 645 in /home/pi/domoticz/plugins/domoticz_mqtt_discovery/plugin.py, function onMessage
2018-02-26 07:21:01.544 Error: (MQTT Discovery) ----> Line 191 in /home/pi/domoticz/plugins/domoticz_mqtt_discovery/plugin.py, function onMessage
2018-02-26 07:21:01.544 Error: (MQTT Discovery) ----> Line 159 in /home/pi/domoticz/plugins/domoticz_mqtt_discovery/plugin.py, function onMessage
2018-02-26 07:21:01.545 Error: (MQTT Discovery) ----> Line 215 in /home/pi/domoticz/plugins/domoticz_mqtt_discovery/plugin.py, function onMQTTPublish
2018-02-26 07:21:01.545 Error: (MQTT Discovery) ----> Line 470 in /home/pi/domoticz/plugins/domoticz_mqtt_discovery/plugin.py, function updateDeviceSettings
2018-02-26 07:21:01.546 Error: (MQTT Discovery) 'onMessage' failed 'AttributeError':''Domoticz.Device' object has no attribute 'SwitchType''.
2018-02-26 07:21:01.546 Error: (MQTT Discovery) ----> Line 645 in /home/pi/domoticz/plugins/domoticz_mqtt_discovery/plugin.py, function onMessage
2018-02-26 07:21:01.546 Error: (MQTT Discovery) ----> Line 191 in /home/pi/domoticz/plugins/domoticz_mqtt_discovery/plugin.py, function onMessage
2018-02-26 07:21:01.546 Error: (MQTT Discovery) ----> Line 159 in /home/pi/domoticz/plugins/domoticz_mqtt_discovery/plugin.py, function onMessage
2018-02-26 07:21:01.546 Error: (MQTT Discovery) ----> Line 215 in /home/pi/domoticz/plugins/domoticz_mqtt_discovery/plugin.py, function onMQTTPublish
2018-02-26 07:21:01.546 Error: (MQTT Discovery) ----> Line 470 in /home/pi/domoticz/plugins/domoticz_mqtt_discovery/plugin.py, function updateDeviceSettings
I had one S20 removed from the power socket and was with status red in Domoticz. Pluged the S20 in the powersocket and is working fine but again with errors in the log.
Code: Select all
2018-02-26 07:28:02.506 Error: (MQTT Discovery) 'onMessage' failed 'AttributeError':''Domoticz.Device' object has no attribute 'SwitchType''.
2018-02-26 07:28:02.506 Error: (MQTT Discovery) ----> Line 645 in /home/pi/domoticz/plugins/domoticz_mqtt_discovery/plugin.py, function onMessage
2018-02-26 07:28:02.506 Error: (MQTT Discovery) ----> Line 191 in /home/pi/domoticz/plugins/domoticz_mqtt_discovery/plugin.py, function onMessage
2018-02-26 07:28:02.506 Error: (MQTT Discovery) ----> Line 159 in /home/pi/domoticz/plugins/domoticz_mqtt_discovery/plugin.py, function onMessage
2018-02-26 07:28:02.506 Error: (MQTT Discovery) ----> Line 215 in /home/pi/domoticz/plugins/domoticz_mqtt_discovery/plugin.py, function onMQTTPublish
2018-02-26 07:28:02.506 Error: (MQTT Discovery) ----> Line 470 in /home/pi/domoticz/plugins/domoticz_mqtt_discovery/plugin.py, function updateDeviceSettings
Re: Python plugin: Sonoff-Tasmota + Other devices supporting MQTT Discovery
Posted: Friday 16 March 2018 0:59
by emontnemery
Wob76 wrote: ↑Monday 26 February 2018 5:28
This sounds very interesting, do you have a little more documentation on the MQTT formating, Topic, payload, etc?
I am currently using a custom nodered flow for controlling my lightify lighting, I tried to implement auto creation of the lights but it proved problematic in matching using the names to match them up, and I couldn't find a way to push a MAC into the device via JSON. If I could reformat my MQTT messages to meet your requirements it could be a good fit.
MQTT formatting requirements is documented here:
https://home-assistant.io/docs/mqtt/discovery/
Re: Python plugin: Sonoff-Tasmota + Other devices supporting MQTT Discovery
Posted: Friday 16 March 2018 1:01
by emontnemery
Hi Reconos, did you ever get it working?
Re: Python plugin: Sonoff-Tasmota + Other devices supporting MQTT Discovery
Posted: Friday 04 May 2018 19:39
by Mazzokun
Hi all, I have Domoticz Version: 3.9389 and Tasmota Program Version 5.13.1.
Domoticz auto discover the sonoff devices and I can control them with domoticz or Hardware button.
But if I stop domoticz service, manually change relais status and then re-enable domoticz, the status of the relais are not updated anymore.
I think I have done something dirty but I can't understand what... I post the screen of my config..
Thanks for help

Re: Python plugin: Sonoff-Tasmota + Other devices supporting MQTT Discovery
Posted: Saturday 02 June 2018 21:31
by mvveelen
I have the same settings, and no devices are found.
Setup: RPi3, latest beta Domoticz, done the setoption19 1 thingy, MQTT up and running.
Sonoff setup:
MQTT Host 192.168.0.124
MQTT Port 1883
MQTT Client & Fallback Topic DVES_AF76EE
MQTT User
MQTT Topic sonoff35 (every Sonoff has it's own Topic)
MQTT Group Topic sonoffs
MQTT Full Topic cmnd/sonoff35/
Full topic: %prefix%/%topic%/
Domoticz setup:
MQTT Server address:localhost
Port: 1883
Username:
Password:
Discovery topic: sonoffs
Ignored device topics (comma separated): tasmota/sonoff
What is wrong with this setup?
Edit:
I also have this error message in the log:
2018-06-03 11:30:25.656 (MQTT discovery) Warning: could not load plugin options '' as JSON object
What could this mean ? How can I solve this ?
Re: Python plugin: Sonoff-Tasmota + Other devices supporting MQTT Discovery
Posted: Sunday 03 June 2018 22:34
by RoRoo
I've been fiddling around with this plugin this evening to try to get it to work..
A bit of a noob with MQTT and Tasmoda but it seems to work since the Domoticz logs show the status change of the sonoff
But when I flip the switch (so to speak) in Domoticz, the switch goes off but the status doesn't change to off in Domoticz.
Re: Python plugin: Sonoff-Tasmota + Other devices supporting MQTT Discovery
Posted: Tuesday 05 June 2018 10:30
by RoRoo
Just a little update
After I used the "classic" method to attach my device (MQTT with lan attached and then dummy switch) and changed the idx in the sonoff. Both switches started to be in sync.
removed the classic setup. and the status was no longer in sync.
So I decided to remove the Discovery plugin and work with the "classic" method.
Re: Python plugin: Sonoff-Tasmota + Other devices supporting MQTT Discovery
Posted: Saturday 11 August 2018 20:19
by mvveelen
After using the MQTT discovery for a while, I suddenly have some of the Sonoff devices being discovered as a "Dimmer" instead of the usual ON/OFF Switches. I'm using the latest Domoticz and have the latest (6.1.1) Tasmota. Removing the devices doesn't help. After restarting Domoticz, I have to set all dimmers to ON/OFF switches and it's driving me crazy.
What is causing this? Not all of the Sonoff's have this issue. I compared the settings and they are identical, except for the IP addresses and the topics (and name of course). I hope someone can give me some pointers on how to fix this.
Re: Python plugin: Sonoff-Tasmota + Other devices supporting MQTT Discovery
Posted: Saturday 18 August 2018 8:57
by emontnemery
mvveelen wrote: ↑Saturday 11 August 2018 20:19
After using the MQTT discovery for a while, I suddenly have some of the Sonoff devices being discovered as a "Dimmer" instead of the usual ON/OFF Switches.
Just to confirm, this is now fully solved by
https://github.com/emontnemery/domoticz ... y/issues/8 ?
Re: Python plugin: Sonoff-Tasmota + Other devices supporting MQTT Discovery
Posted: Saturday 18 August 2018 8:59
by emontnemery
RoRoo wrote: ↑Sunday 03 June 2018 22:34
I've been fiddling around with this plugin this evening to try to get it to work..
A bit of a noob with MQTT and Tasmoda but it seems to work since the Domoticz logs show the status change of the sonoff
But when I flip the switch (so to speak) in Domoticz, the switch goes off but the status doesn't change to off in Domoticz.
This should definitely work..
If you're willing to give it a try again, please reply here or (preferred) open an issue on github:
https://github.com/emontnemery/domoticz_mqtt_discovery
Re: Python plugin: Sonoff-Tasmota + Other devices supporting MQTT Discovery
Posted: Saturday 18 August 2018 9:00
by emontnemery
Mazzokun wrote: ↑Friday 04 May 2018 19:39
Domoticz auto discover the sonoff devices and I can control them with domoticz or Hardware button.
But if I stop domoticz service, manually change relais status and then re-enable domoticz, the status of the relais are not updated anymore.
This should definitely work..
If you're willing to give it a try again, please reply here or (preferred) open an issue on github:
https://github.com/emontnemery/domoticz_mqtt_discovery
Re: Python plugin: Sonoff-Tasmota + Other devices supporting MQTT Discovery
Posted: Monday 14 January 2019 15:15
by mikeoo
I want to add some new flashed Sonoff devices to Domoticz but i can't get them in to Domoticz. Did this before and was always working fine and still working nice with the existing ones.
Setup Tasmota on the device the same way as the older ones with only different topic name.
In Tasmota i added setoption19 1 in console so it sets to ON.
Sonoff-Tasmota 6.4.1 version
Debug log and it is seeing the name i gave it
Ender 3 Printer, so there is some communication. But when i search in Domoticz devices tab or list there is nothing. Tried the Allow for 5 minutes option just te be sure but makes no difference.
Any tips?
Code: Select all
2019-01-14 15:07:01.708 (MQTT Discovery) onMQTTPublish: homeassistant/light/375D17_LI_1/config:b''
2019-01-14 15:07:01.708 (MQTT Discovery) onMQTTPublish: homeassistant/switch/375D17_RL_1/config:b'{"name":"Ender 3 Printer","cmd_t":"~cmnd/POWER","stat_t":"~tele/STATE","val_tpl":"{{value_json.POWER}}","pl_off":"OFF","pl_on":"ON","avty_t":"~tele/LWT","pl_avail":"Online","pl_not_avail":"Offline","uniq_id":"375D17_RL_1","device":{"identifiers":["375D17"],"name":"Ender 3 Printer","model":"Sonoff Basic","sw_version":"6.4.1(sonoff)","manufacturer":"Tasmota"}, "~":"sonoff230/"}'
2019-01-14 15:07:01.709 (MQTT Discovery) onMQTTPublish: homeassistant/light/375D17_LI_2/config:b''
2019-01-14 15:07:01.709 (MQTT Discovery) onMQTTPublish: homeassistant/switch/375D17_RL_2/config:b''
2019-01-14 15:07:01.710 (MQTT Discovery) onMQTTPublish: homeassistant/light/375D17_LI_3/config:b''
2019-01-14 15:07:01.760 (MQTT Discovery) Received 340 bytes of data
2019-01-14 15:07:01.760 (MQTT Discovery) 30 29 00 27 68 6f 6d 65 61 73 73 69 73 74 61 6e 74 2f 73 77 0).'homeassistant/sw
2019-01-14 15:07:01.760 (MQTT Discovery) 69 74 63 68 2f 33 37 35 44 31 37 5f 52 4c 5f 33 2f 63 6f 6e itch/375D17_RL_3/con
2019-01-14 15:07:01.760 (MQTT Discovery) 66 69 67 30 28 00 26 68 6f 6d 65 61 73 73 69 73 74 61 6e 74 fig0(.&homeassistant
2019-01-14 15:07:01.761 (MQTT Discovery) 2f 6c 69 67 68 74 2f 33 37 35 44 31 37 5f 4c 49 5f 34 2f 63 /light/375D17_LI_4/c
2019-01-14 15:07:01.761 (MQTT Discovery) 6f 6e 66 69 67 30 29 00 27 68 6f 6d 65 61 73 73 69 73 74 61 onfig0).'homeassista
2019-01-14 15:07:01.761 (MQTT Discovery) 6e 74 2f 73 77 69 74 63 68 2f 33 37 35 44 31 37 5f 52 4c 5f nt/switch/375D17_RL_
2019-01-14 15:07:01.761 (MQTT Discovery) 34 2f 63 6f 6e 66 69 67 30 28 00 26 68 6f 6d 65 61 73 73 69 4/config0(.&homeassi
2019-01-14 15:07:01.761 (MQTT Discovery) 73 74 61 6e 74 2f 6c 69 67 68 74 2f 33 37 35 44 31 37 5f 4c stant/light/375D17_L
2019-01-14 15:07:01.761 (MQTT Discovery) 49 5f 35 2f 63 6f 6e 66 69 67 30 29 00 27 68 6f 6d 65 61 73 I_5/config0).'homeas
2019-01-14 15:07:01.761 (MQTT Discovery) 73 69 73 74 61 6e 74 2f 73 77 69 74 63 68 2f 33 37 35 44 31 sistant/switch/375D1
2019-01-14 15:07:01.761 (MQTT Discovery) 37 5f 52 4c 5f 35 2f 63 6f 6e 66 69 67 30 28 00 26 68 6f 6d 7_RL_5/config0(.&hom
2019-01-14 15:07:01.762 (MQTT Discovery) 65 61 73 73 69 73 74 61 6e 74 2f 6c 69 67 68 74 2f 33 37 35 eassistant/light/375
2019-01-14 15:07:01.762 (MQTT Discovery) 44 31 37 5f 4c 49 5f 36 2f 63 6f 6e 66 69 67 30 29 00 27 68 D17_LI_6/config0).'h
2019-01-14 15:07:01.762 (MQTT Discovery) 6f 6d 65 61 73 73 69 73 74 61 6e 74 2f 73 77 69 74 63 68 2f omeassistant/switch/
2019-01-14 15:07:01.762 (MQTT Discovery) 33 37 35 44 31 37 5f 52 4c 5f 36 2f 63 6f 6e 66 69 67 30 28 375D17_RL_6/config0(
2019-01-14 15:07:01.762 (MQTT Discovery) 00 26 68 6f 6d 65 61 73 73 69 73 74 61 6e 74 2f 6c 69 67 68 .&homeassistant/ligh
2019-01-14 15:07:01.762 (MQTT Discovery) 74 2f 33 37 35 44 31 37 5f 4c 49 5f 37 2f 63 6f 6e 66 69 67 t/375D17_LI_7/config
2019-01-14 15:07:01.763 (MQTT Discovery) Received 43 bytes of data
2019-01-14 15:07:01.763 (MQTT Discovery) 30 29 00 27 68 6f 6d 65 61 73 73 69 73 74 61 6e 74 2f 73 77 0).'homeassistant/sw
2019-01-14 15:07:01.763 (MQTT Discovery) 69 74 63 68 2f 33 37 35 44 31 37 5f 52 4c 5f 37 2f 63 6f 6e itch/375D17_RL_7/con
2019-01-14 15:07:01.763 (MQTT Discovery) 66 69 67 .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. fig
2019-01-14 15:07:01.764 (MQTT Discovery) onMQTTPublish: homeassistant/switch/375D17_RL_3/config:b''
2019-01-14 15:07:01.764 (MQTT Discovery) onMQTTPublish: homeassistant/light/375D17_LI_4/config:b''
2019-01-14 15:07:01.764 (MQTT Discovery) onMQTTPublish: homeassistant/switch/375D17_RL_4/config:b''
2019-01-14 15:07:01.765 (MQTT Discovery) onMQTTPublish: homeassistant/light/375D17_LI_5/config:b''
2019-01-14 15:07:01.765 (MQTT Discovery) onMQTTPublish: homeassistant/switch/375D17_RL_5/config:b''
2019-01-14 15:07:01.766 (MQTT Discovery) onMQTTPublish: homeassistant/light/375D17_LI_6/config:b''
2019-01-14 15:07:01.766 (MQTT Discovery) onMQTTPublish: homeassistant/switch/375D17_RL_6/config:b''
2019-01-14 15:07:01.767 (MQTT Discovery) onMQTTPublish: homeassistant/light/375D17_LI_7/config:b''
2019-01-14 15:07:01.767 (MQTT Discovery) onMQTTPublish: homeassistant/switch/375D17_RL_7/config:b''
2019-01-14 15:07:07.129 (MQTT Discovery) Heartbeating...
2019-01-14 15:07:07.129 (MQTT Discovery) MqttClient::Ping
2019-01-14 15:07:07.130 (MQTT Discovery) Sending 2 bytes of data
2019-01-14 15:07:07.130 (MQTT Discovery) c0 00 .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. �.
2019-01-14 15:07:07.180 (MQTT Discovery) Received 2 bytes of data
2019-01-14 15:07:07.180 (MQTT Discovery) d0 00 .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. �.
2019-01-14 15:07:07.705 MQTT: Topic: domoticz/in, Message: {"idx":3418,"nvalue":0,"svalue":"30.4"}
Update
Flashed Tasmota 6.1.1 what I am using for the older S20 i am using already and now the new S20 is discovered fine.
So problem is with newer version of Tasmota.
One thing i noticed
With version v6.1.1 the log shows
Code: Select all
00:00:07 MQT: homeassistant/switch/sonoff230_3/config = (retained)
With version v6.4.1 the log shows
Code: Select all
2019-01-14 15:07:01.764 (MQTT Discovery) onMQTTPublish: homeassistant/switch/375D17_RL_4/config:b''
Topic is different. With the new versions it shows a part of the MAC address even when i filled the setting exactly the same as with v6.1.1
Re: Python plugin: Sonoff-Tasmota + Other devices supporting MQTT Discovery
Posted: Saturday 26 January 2019 9:07
by HenriM
It will be fixed with next update of the MQTT Disovery plugin. See also
https://github.com/emontnemery/domoticz ... /issues/12