Python plugin: Sonoff-Tasmota + Other devices supporting MQTT Discovery

Python and python framework

Moderator: leecollings

emontnemery
Posts: 38
Joined: Sunday 08 October 2017 13:50
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Python plugin: Sonoff-Tasmota + Other devices supporting MQTT Discovery

Post by emontnemery »

Domoticz MQTT Discovery plugin
Domoticz Python plugin which implements support for Home-Assistant style MQTT discovery.
https://github.com/emontnemery/domoticz_mqtt_discovery

Features:
  • Switch and dimmer devices will be automatically found and added to Domoticz device database
  • State in Domoticz in synchronized with device state (unlike with "Dummy hardware")
  • Note: Buttons are not yet supported
  • Note: Sensors are not yet supported
Prerequisites:
  • Domoticz must be from Jan19 2018 or newer (must include PR #2071)
  • Sonoff devices must be flashed with 5.11.1c or newer (must include support for home-assistant style MQTT discovery)
  • Sonoff devices must have option 19 set to 1 (setoption19 1)
  • Sonoff devices must be connected to MQTT server, and must have individual topics (by default all devices topic will be set to "sonoff", this will not work)
  • Sonoff fulltopic should be reasonable, for example "tasmota/%topic%/%prefix%/"
Instructions:
  • Clone github project https://github.com/emontnemery/domoticz_mqtt_discovery into Domoticz 'plugins' folder
  • Restart Domoticz
  • Create hardware of type "MQTT Discovery"
  • Set MQTT IP and port
  • Set "Debug" to "Verbose" for debug log
  • Domoticz should now detect any device running Tasmota firmware!
Reconos
Posts: 7
Joined: Wednesday 31 January 2018 14:26
Target OS: Windows
Domoticz version:
Contact:

Re: Python plugin: Sonoff-Tasmota + Other devices supporting MQTT Discovery

Post by Reconos »

Hi Emontnemery.

I hope this is the right place to get some help :)
Setup: Windows 2012r2
Pythons 3.6.4
Domoticz: 3.8871

upon trying to activate the plugin, my log is filled with the following (Hidden in spoler text to prevent massive wall of text):
Spoiler: show
2018-01-31 14:20:42.003 Error: (MQTT Discovery) 'onConnect' failed 'TypeError':'onConnect() missing 3 required positional arguments: 'Connection', 'Status', and 'Description''.
2018-01-31 14:20:51.655 (MQTT Discovery) Calling message handler 'onHeartbeat'.
2018-01-31 14:20:51.655 (MQTT Discovery) Heartbeating...
2018-01-31 14:20:51.655 (MQTT Discovery) MqttDevice::Ping
2018-01-31 14:20:51.655 (MQTT Discovery) Sending 2 bytes of data:
2018-01-31 14:20:51.655 (MQTT Discovery) c0 00 .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. �.
2018-01-31 14:20:51.655 Error: (MQTT Discovery): Async Read Exception: 10054, En eksisterende forbindelse blev tvangsafbrudt af en ekstern v�rt
2018-01-31 14:20:51.717 PluginSystem: Restarting I/O service thread.
2018-01-31 14:20:51.717 (MQTT Discovery) Disconnect event received for 'localhost:1883'.
2018-01-31 14:20:51.717 (MQTT Discovery): CPluginTransportTCP::handleDisconnect
2018-01-31 14:20:51.717 (MQTT Discovery) Calling message handler 'onDisconnect'.
2018-01-31 14:20:51.717 (MQTT Discovery) Disconnected from: localhost:1883
2018-01-31 14:20:51.717 (MQTT Discovery) MqttDevice::Close
2018-01-31 14:20:51.717 (MQTT Discovery) Deallocating connection object 'localhost' (localhost:1883).
2018-01-31 14:21:01.794 (MQTT Discovery) Calling message handler 'onHeartbeat'.
2018-01-31 14:21:01.794 (MQTT Discovery) Heartbeating...
2018-01-31 14:21:01.794 (MQTT Discovery) Reconnecting
2018-01-31 14:21:01.794 (MQTT Discovery) MqttDevice::Close
2018-01-31 14:21:01.794 (MQTT Discovery) MqttDevice::Connect
2018-01-31 14:21:01.795 (MQTT Discovery) MqttDevice::Open
2018-01-31 14:21:01.795 (MQTT Discovery) Protocol set to: 'MQTT'.
2018-01-31 14:21:01.795 (MQTT Discovery) Transport set to: 'TCP/IP', localhost:1883.
2018-01-31 14:21:01.796 PluginSystem: Starting I/O service thread.
2018-01-31 14:21:01.796 (MQTT Discovery) Connect directive received, action initiated successfully.
2018-01-31 14:21:01.852 (MQTT Discovery) Calling message handler 'onConnect'.
2018-01-31 14:21:01.852 Error: (MQTT Discovery) 'onConnect' failed 'TypeError':'onConnect() missing 3 required positional arguments: 'Connection', 'Status', and 'Description''.
2018-01-31 14:21:12.122 (MQTT Discovery) Calling message handler 'onHeartbeat'.
2018-01-31 14:21:12.122 (MQTT Discovery) Heartbeating...
2018-01-31 14:21:12.122 (MQTT Discovery) MqttDevice::Ping
2018-01-31 14:21:12.122 (MQTT Discovery) Sending 2 bytes of data:
2018-01-31 14:21:12.122 (MQTT Discovery) c0 00 .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. �.
2018-01-31 14:21:12.122 Error: (MQTT Discovery): Async Read Exception: 10054, En eksisterende forbindelse blev tvangsafbrudt af en ekstern v�rt
2018-01-31 14:21:12.184 PluginSystem: Restarting I/O service thread.
2018-01-31 14:21:12.184 (MQTT Discovery) Disconnect event received for 'localhost:1883'.
2018-01-31 14:21:12.184 (MQTT Discovery): CPluginTransportTCP::handleDisconnect
2018-01-31 14:21:12.184 (MQTT Discovery) Calling message handler 'onDisconnect'.
2018-01-31 14:21:12.184 (MQTT Discovery) Disconnected from: localhost:1883
Any idea what im doing wrong?
emontnemery
Posts: 38
Joined: Sunday 08 October 2017 13:50
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python plugin: Sonoff-Tasmota + Other devices supporting MQTT Discovery

Post by emontnemery »

Something is going wrong when connecting to the mqtt server. What settings are you using?
Reconos
Posts: 7
Joined: Wednesday 31 January 2018 14:26
Target OS: Windows
Domoticz version:
Contact:

Re: Python plugin: Sonoff-Tasmota + Other devices supporting MQTT Discovery

Post by Reconos »

I have attached my settings, almost standard.

I know the "activated" checkmark is removed on the screenshot, but that's only to stop it from spamming my log file :)
Attachments
settings.PNG
settings.PNG (21.29 KiB) Viewed 9428 times
Reconos
Posts: 7
Joined: Wednesday 31 January 2018 14:26
Target OS: Windows
Domoticz version:
Contact:

Re: Python plugin: Sonoff-Tasmota + Other devices supporting MQTT Discovery

Post by Reconos »

Sorry Emontnemery.

Im a long time lurker, and only registered today, so can't PM :(
emontnemery
Posts: 38
Joined: Sunday 08 October 2017 13:50
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python plugin: Sonoff-Tasmota + Other devices supporting MQTT Discovery

Post by emontnemery »

OK, no worries. I think the version of domoticz you use might not have python python support for mqtt. Did you compile by yourself or download an official binary?
Reconos
Posts: 7
Joined: Wednesday 31 January 2018 14:26
Target OS: Windows
Domoticz version:
Contact:

Re: Python plugin: Sonoff-Tasmota + Other devices supporting MQTT Discovery

Post by Reconos »

Im using the latest beta build :o
emontnemery
Posts: 38
Joined: Sunday 08 October 2017 13:50
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python plugin: Sonoff-Tasmota + Other devices supporting MQTT Discovery

Post by emontnemery »

I didn't notice until now you're using Windows..
This looks very similar to your issue, especially since domoticz is showing up in Danish (?) in your screenshots: http://www.domoticz.com/forum/viewtopic.php?t=16096
Workaround here:
viewtopic.php?f=6&t=16168

Please try the workaround and let me know!

Edit: I'll try to setup the windows version myself during the next few days
Reconos
Posts: 7
Joined: Wednesday 31 January 2018 14:26
Target OS: Windows
Domoticz version:
Contact:

Re: Python plugin: Sonoff-Tasmota + Other devices supporting MQTT Discovery

Post by Reconos »

Per the workaround, i set everything to English, but it doesn't seem to fix it for me :( ill try to fiddle around with it a bit and then ill try to update you if anything changes :)
User avatar
Dnpwwo
Posts: 820
Joined: Sunday 23 March 2014 9:00
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Melbourne, Australia
Contact:

Re: Python plugin: Sonoff-Tasmota + Other devices supporting MQTT Discovery

Post by Dnpwwo »

I would suggest trying to understand this error:

Code: Select all

2018-01-31 14:20:42.003 Error: (MQTT Discovery) 'onConnect' failed 'TypeError':'onConnect() missing 3 required positional arguments: 'Connection', 'Status', and 'Description''.
onConnect gets called on connection success or failure (Status and Description will tell you which).

For this plugin if onConnect does not execute the the MqttClient class won't set up the MQTT session (i.e send the connect message) so sending a Ping will cause the MQTT server to close the connection (without response) which you are seeing here as the Async Read aborting.

I haven't tested against Python 3.6 explicitly so you could try Python 3.5
The reasonable man adapts himself to the world; the unreasonable one persists to adapt the world to himself. Therefore all progress depends on the unreasonable man. George Bernard Shaw
mikeoo
Posts: 110
Joined: Sunday 22 March 2015 7:35
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Holland
Contact:

Re: Python plugin: Sonoff-Tasmota + Other devices supporting MQTT Discovery

Post by mikeoo »

Very nice Plugin :D

For testing i have setup two Sonsoff S20. It finds the Sonoffs just fine and al is working ok but Sonoff Smart Socket 01 is always find twice in the unused devices in Domoticz and I keep getting this error in Domoticz Log when i disable en enable MQTT Discovery or update the Plugin..

Code: Select all

  2018-02-03 16:36:40.289 (MQTT Discovery) Calling message handler 'onMessage'.
2018-02-03 16:36:40.290 (MQTT Discovery) onMessage called for connection: '127.0.0.1' type:'SUBACK' topic:'' payload:''
2018-02-03 16:36:40.290 (MQTT Discovery) Calling message handler 'onMessage'.
2018-02-03 16:36:40.295 (MQTT Discovery) onMessage called for connection: '127.0.0.1' type:'PUBLISH' topic:'tele/sonoff225/LWT' payload:'b'Online''
2018-02-03 16:36:40.296 (MQTT Discovery) tele/sonoff225/LWT
2018-02-03 16:36:40.296 (MQTT Discovery) getDevices key: '' configkey: '' value: '' config: '' topic: 'tele/sonoff225/LWT'
2018-02-03 16:36:40.297 (MQTT Discovery) getDevices found 1 devices
2018-02-03 16:36:40.297 (MQTT Discovery) Got state_topic
2018-02-03 16:36:40.297 (MQTT Discovery) TimedOut: '0'
2018-02-03 16:36:40.298 Error: (CDevice_update) Sonoff Smart Socket 02: Failed to parse parameters: 'nValue', 'sValue', 'Image', 'SignalLevel', 'BatteryLevel', 'Options', 'TimedOut', 'Name', 'TypeName', 'Type', 'Subtype', 'Switchtype' or 'Used' expected.
2018-02-03 16:36:40.298 Error: (MQTT Discovery) 'CDevice_update' failed 'TypeError':'Required argument 'nValue' (pos 1) not found'.
2018-02-03 16:36:40.298 (MQTT Discovery) Calling message handler 'onMessage'.
2018-02-03 16:36:40.298 (MQTT Discovery) onMessage called for connection: '127.0.0.1' type:'PUBLISH' topic:'homeassistant/switch/sonoffAFBDA8/config' payload:'b'{"name":"Sonoff Smart Socket 01","command_topic":"cmnd/sonoffAFBDA8/POWER","state_topic":"stat/sonoffAFBDA8/RESULT","value_template":"{{value_json.POWER}}","payload_off":"OFF","payload_on":"ON","availability_topic":"tele/sonoffAFBDA8/LWT","payload_available":"Online","payload_not_available":"Offline"}''
2018-02-03 16:36:40.299 (MQTT Discovery) homeassistant/switch/sonoffAFBDA8/config
2018-02-03 16:36:40.299 (MQTT Discovery) updateDeviceSettings devicename: 'sonoffAFBDA8' devicetype: 'switch' config: '{'payload_not_available': 'Offline', 'availability_topic': 'tele/sonoffAFBDA8/LWT', 'payload_available': 'Online', 'command_topic': 'cmnd/sonoffAFBDA8/POWER', 'payload_on': 'ON', 'payload_off': 'OFF', 'state_topic': 'stat/sonoffAFBDA8/RESULT', 'value_template': '{{value_json.POWER}}', 'name': 'Sonoff Smart Socket 01'}'
2018-02-03 16:36:40.299 (MQTT Discovery) getDevices key: 'devicename' configkey: '' value: 'sonoffAFBDA8' config: '' topic: ''
2018-02-03 16:36:40.300 (MQTT Discovery) getDevices found 1 devices
2018-02-03 16:36:40.300 (MQTT Discovery) Calling message handler 'onMessage'.
2018-02-03 16:36:40.300 (MQTT Discovery) onMessage called for connection: '127.0.0.1' type:'PUBLISH' topic:'homeassistant/switch/sonoff222/config' payload:'b'{"name":"Sonoff Smart Socket 01","command_topic":"cmnd/sonoff222/POWER","state_topic":"stat/sonoff222/RESULT","value_template":"{{value_json.POWER}}","payload_off":"OFF","payload_on":"ON","availability_topic":"tele/sonoff222/LWT","payload_available":"Online","payload_not_available":"Offline"}''
2018-02-03 16:36:40.300 (MQTT Discovery) homeassistant/switch/sonoff222/config
2018-02-03 16:36:40.301 (MQTT Discovery) updateDeviceSettings devicename: 'sonoff222' devicetype: 'switch' config: '{'payload_not_available': 'Offline', 'availability_topic': 'tele/sonoff222/LWT', 'payload_available': 'Online', 'command_topic': 'cmnd/sonoff222/POWER', 'payload_on': 'ON', 'payload_off': 'OFF', 'state_topic': 'stat/sonoff222/RESULT', 'value_template': '{{value_json.POWER}}', 'name': 'Sonoff Smart Socket 01'}'
2018-02-03 16:36:40.301 (MQTT Discovery) getDevices key: 'devicename' configkey: '' value: 'sonoff222' config: '' topic: ''
2018-02-03 16:36:40.301 (MQTT Discovery) getDevices found 1 devices
2018-02-03 16:36:40.301 (MQTT Discovery) Calling message handler 'onMessage'.
2018-02-03 16:36:40.302 (MQTT Discovery) onMessage called for connection: '127.0.0.1' type:'PUBLISH' topic:'homeassistant/switch/sonoff225/config' payload:'b'{"name":"Sonoff Smart Socket 02","command_topic":"cmnd/sonoff225/POWER","state_topic":"stat/sonoff225/RESULT","value_template":"{{value_json.POWER}}","payload_off":"OFF","payload_on":"ON","availability_topic":"tele/sonoff225/LWT","payload_available":"Online","payload_not_available":"Offline"}''
2018-02-03 16:36:40.302 (MQTT Discovery) homeassistant/switch/sonoff225/config
2018-02-03 16:36:40.302 (MQTT Discovery) updateDeviceSettings devicename: 'sonoff225' devicetype: 'switch' config: '{'payload_not_available': 'Offline', 'availability_topic': 'tele/sonoff225/LWT', 'payload_available': 'Online', 'command_topic': 'cmnd/sonoff225/POWER', 'payload_on': 'ON', 'payload_off': 'OFF', 'state_topic': 'stat/sonoff225/RESULT', 'value_template': '{{value_json.POWER}}', 'name': 'Sonoff Smart Socket 02'}'
2018-02-03 16:36:40.303 (MQTT Discovery) getDevices key: 'devicename' configkey: '' value: 'sonoff225' config: '' topic: ''
2018-02-03 16:36:40.303 (MQTT Discovery) getDevices found 1 devices
2018-02-03 16:36:40.303 (MQTT Discovery) Calling message handler 'onMessage'.
2018-02-03 16:36:40.303 (MQTT Discovery) onMessage called for connection: '127.0.0.1' type:'PUBLISH' topic:'tele/sonoff222/LWT' payload:'b'Online''
2018-02-03 16:36:40.303 (MQTT Discovery) tele/sonoff222/LWT
2018-02-03 16:36:40.304 (MQTT Discovery) getDevices key: '' configkey: '' value: '' config: '' topic: 'tele/sonoff222/LWT'
2018-02-03 16:36:40.304 (MQTT Discovery) getDevices found 1 devices
2018-02-03 16:36:40.305 (MQTT Discovery) Got state_topic
2018-02-03 16:36:40.305 (MQTT Discovery) TimedOut: '0'
2018-02-03 16:36:40.305 Error: (CDevice_update) MQTT Discovery - Sonoff Smart Socket 01: Failed to parse parameters: 'nValue', 'sValue', 'Image', 'SignalLevel', 'BatteryLevel', 'Options', 'TimedOut', 'Name', 'TypeName', 'Type', 'Subtype', 'Switchtype' or 'Used' expected.
2018-02-03 16:36:40.305 Error: (MQTT Discovery) 'CDevice_update' failed 'TypeError':'Required argument 'nValue' (pos 1) not found'.
2018-02-03 16:36:49.631 (MQTT Discovery) Calling message handler 'onHeartbeat'.
2018-02-03 16:36:49.633 (MQTT Discovery) Heartbeating...
2018-02-03 16:36:49.633 (MQTT Discovery) MqttDevice::Ping
2018-02-03 16:36:49.634 (MQTT Discovery) Sending 2 bytes of data:
2018-02-03 16:36:49.634 (MQTT Discovery) c0 00 .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. �.
2018-02-03 16:36:49.684 (MQTT Discovery) Received 2 bytes of data:
2018-02-03 16:36:49.684 (MQTT Discovery) d0 00 .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. �.
2018-02-03 16:36:49.685 (MQTT Discovery) Calling message handler 'onMessage'.
2018-02-03 16:36:49.685 (MQTT Discovery) onMessage called for connection: '127.0.0.1' type:'PINGRESP' topic:'' payload:''
2018-02-03 16:36:58.516 (MySensors Gateway Ethernet) Temp (Aanvoer CV)
2018-02-03 16:36:58.527 (MySensors Gateway Ethernet) Temp (Retour CV)
2018-02-03 16:36:59.663 (MQTT Discovery) Calling message handler 'onHeartbeat'.
2018-02-03 16:36:59.663 (MQTT Discovery) Heartbeating...
2018-02-03 16:36:59.663 (MQTT Discovery) MqttDevice::Ping
2018-02-03 16:36:59.664 (MQTT Discovery) Sending 2 bytes of data:
2018-02-03 16:36:59.664 (MQTT Discovery) c0 00 .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. �.
2018-02-03 16:36:59.714 (MQTT Discovery) Received 2 bytes of data:
2018-02-03 16:36:59.715 (MQTT Discovery) d0 00 .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. �.
2018-02-03 16:36:59.715 (MQTT Discovery) Calling message handler 'onMessage'.
2018-02-03 16:36:59.715 (MQTT Discovery) onMessage called for connection: '127.0.0.1' type:'PINGRESP' topic:'' payload:''
2018-02-03 16:37:04.140 Notification sent (Email)
2018-02-03 16:37:09.646 (MQTT Discovery) Calling message handler 'onHeartbeat'.
2018-02-03 16:37:09.647 (MQTT Discovery) Heartbeating...
2018-02-03 16:37:09.647 (MQTT Discovery) MqttDevice::Ping
2018-02-03 16:37:09.647 (MQTT Discovery) Sending 2 bytes of data:
2018-02-03 16:37:09.647 (MQTT Discovery) c0 00 .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. �.
2018-02-03 16:37:09.698 (MQTT Discovery) Received 2 bytes of data:
2018-02-03 16:37:09.698 (MQTT Discovery) d0 00 .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. �.
2018-02-03 16:37:09.698 (MQTT Discovery) Calling message handler 'onMessage'.
2018-02-03 16:37:09.698 (MQTT Discovery) onMessage called for connection: '127.0.0.1' type:'PINGRESP' topic:'' payload:''
2018-02-03 16:37:19.619 (MQTT Discovery) Calling message handler 'onHeartbeat'.
2018-02-03 16:37:19.620 (MQTT Discovery) Heartbeating...
2018-02-03 16:37:19.620 (MQTT Discovery) MqttDevice::Ping
2018-02-03 16:37:19.620 (MQTT Discovery) Sending 2 bytes of data:
2018-02-03 16:37:19.620 (MQTT Discovery) c0 00 .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. �.
2018-02-03 16:37:19.670 (MQTT Discovery) Received 2 bytes of data:
2018-02-03 16:37:19.671 (MQTT Discovery) d0 00 .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. �.
2018-02-03 16:37:19.671 (MQTT Discovery) Calling message handler 'onMessage'.
2018-02-03 16:37:19.671 (MQTT Discovery) onMessage called for connection: '127.0.0.1' type:'PINGRESP' topic:'' payload:''
2018-02-03 16:37:29.658 (MQTT Discovery) Calling message handler 'onHeartbeat'.
2018-02-03 16:37:29.658 (MQTT Discovery) Heartbeating...
2018-02-03 16:37:29.658 (MQTT Discovery) MqttDevice::Ping
2018-02-03 16:37:29.659 (MQTT Discovery) Sending 2 bytes of data:
2018-02-03 16:37:29.659 (MQTT Discovery) c0 00 .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. �.
2018-02-03 16:37:29.709 (MQTT Discovery) Received 2 bytes of data:
2018-02-03 16:37:29.709 (MQTT Discovery) d0 00 .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. �.
2018-02-03 16:37:29.710 (MQTT Discovery) Calling message handler 'onMessage'.
2018-02-03 16:37:29.710 (MQTT Discovery) onMessage called for connection: '127.0.0.1' type:'PINGRESP' topic:'' payload:''
2018-02-03 16:37:33.536 (MySensors Gateway Ethernet) Temp (Aanvoer CV)
2018-02-03 16:37:33.547 (MySensors Gateway Ethernet) Temp (Retour CV)
2018-02-03 16:37:39.632 (MQTT Discovery) Calling message handler 'onHeartbeat'.
2018-02-03 16:37:39.632 (MQTT Discovery) Heartbeating...
2018-02-03 16:37:39.632 (MQTT Discovery) MqttDevice::Ping
2018-02-03 16:37:39.633 (MQTT Discovery) Sending 2 bytes of data:
2018-02-03 16:37:39.633 (MQTT Discovery) c0 00 .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. �.
2018-02-03 16:37:39.683 (MQTT Discovery) Received 2 bytes of data:
2018-02-03 16:37:39.683 (MQTT Discovery) d0 00 .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. �.
2018-02-03 16:37:39.684 (MQTT Discovery) Calling message handler 'onMessage'.
2018-02-03 16:37:39.684 (MQTT Discovery) onMessage called for connection: '127.0.0.1' type:'PINGRESP' topic:'' payload:''
2018-02-03 16:37:49.655 (MQTT Discovery) Calling message handler 'onHeartbeat'.
2018-02-03 16:37:49.656 (MQTT Discovery) Heartbeating...
2018-02-03 16:37:49.656 (MQTT Discovery) MqttDevice::Ping
2018-02-03 16:37:49.656 (MQTT Discovery) Sending 2 bytes of data:
2018-02-03 16:37:49.656 (MQTT Discovery) c0 00 .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. �.
2018-02-03 16:37:49.706 (MQTT Discovery) Received 2 bytes of data:
2018-02-03 16:37:49.707 (MQTT Discovery) d0 00 .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. �.
2018-02-03 16:37:49.707 (MQTT Discovery) Calling message handler 'onMessage'.
2018-02-03 16:37:49.707 (MQTT Discovery) onMessage called for connection: '127.0.0.1' type:'PINGRESP' topic:'' payload:''
2018-02-03 16:37:59.629 (MQTT Discovery) Calling message handler 'onHeartbeat'.
2018-02-03 16:37:59.629 (MQTT Discovery) Heartbeating...
2018-02-03 16:37:59.629 (MQTT Discovery) MqttDevice::Ping
2018-02-03 16:37:59.630 (MQTT Discovery) Sending 2 bytes of data:
2018-02-03 16:37:59.630 (MQTT Discovery) c0 00 .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. �.
2018-02-03 16:37:59.680 (MQTT Discovery) Received 2 bytes of data:
2018-02-03 16:37:59.681 (MQTT Discovery) d0 00 .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. �.
2018-02-03 16:37:59.681 (MQTT Discovery) Calling message handler 'onMessage'.
2018-02-03 16:37:59.681 (MQTT Discovery) onMessage called for connection: '127.0.0.1' type:'PINGRESP' topic:'' payload:''
2018-02-03 16:38:03.083 MQTT: Topic: domoticz/in, Message: {"idx":2908,"nvalue":0,"svalue":"71"}
 

I can add the Sonoff and then it is function perfectly. S

o how can i get solve the errors and why is it finding the first one always twice.

Other question:
Is it normal when i disable the plugin the Sonoff switch is also not working anymore. When i enable the plugin the switch is also working again.

Code: Select all

 2018-02-03 16:45:38.797 User: Admin initiated a switch command (2911/Sonoff Smart Socket 02/On)
2018-02-03 16:45:38.797 Error: Switch command not send!, Hardware device disabled or not found!
2018-02-03 16:45:47.783 User: Admin initiated a switch command (2911/Sonoff Smart Socket 02/On)
2018-02-03 16:45:47.784 Error: Switch command not send!, Hardware device disabled or not found! 
Tasmota version: 5.11.1h
emontnemery
Posts: 38
Joined: Sunday 08 October 2017 13:50
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python plugin: Sonoff-Tasmota + Other devices supporting MQTT Discovery

Post by emontnemery »

I would suggest trying to understand this error:

Code: Select all

2018-01-31 14:20:42.003 Error: (MQTT Discovery) 'onConnect' failed 'TypeError':'onConnect() missing 3 required positional arguments: 'Connection', 'Status', and 'Description''.
onConnect gets called on connection success or failure (Status and Description will tell you which).
Yeah, like you say the plugin doesn't handle the situation well, but the real issue is why the callback is not called. In the other threads I linked to it was suggested the onConnect callback dies not work if Windows language is not English. Was that confirmed ?
Are there dependencies to python version?
Last edited by emontnemery on Sunday 04 February 2018 2:14, edited 1 time in total.
emontnemery
Posts: 38
Joined: Sunday 08 October 2017 13:50
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python plugin: Sonoff-Tasmota + Other devices supporting MQTT Discovery

Post by emontnemery »

@mikeoo thanks for testing!

The error in the log is due to commit 4e26e85 by @dnpwwo (nValue and sValue are again mandatory for Device.Update). I'll fix that, thanks for reporting!

For the issue with one device created twice, it would be really helpful if you can catch a full log showing adding of MQTT Discovery plugin hardware and discovery of your devices.

Yes, it's correct you can't control the sonoff switch from Domoticz if the hardware (plugin) is disabled.
mikeoo
Posts: 110
Joined: Sunday 22 March 2015 7:35
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Holland
Contact:

Re: Python plugin: Sonoff-Tasmota + Other devices supporting MQTT Discovery

Post by mikeoo »

emontnemery wrote: Sunday 04 February 2018 2:13 @mikeoo thanks for testing!

The error in the log is due to commit 4e26e85 by @dnpwwo (nValue and sValue are again mandatory for Device.Update). I'll fix that, thanks for reporting!

For the issue with one device created twice, it would be really helpful if you can catch a full log showing adding of MQTT Discovery plugin hardware and discovery of your devices.
Tnx for the answer and help

Problem wit finding it twice is solved. I reset the Sonoff S20 to its defaults and configured it again and now it is only discovering once :D
Last edited by mikeoo on Sunday 04 February 2018 9:51, edited 1 time in total.
emontnemery
Posts: 38
Joined: Sunday 08 October 2017 13:50
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python plugin: Sonoff-Tasmota + Other devices supporting MQTT Discovery

Post by emontnemery »

@mikeoo, I mean a log with same settings as the snippet showing the errors you pasted before (i.e. with 'Debug' set to 'Verbose' for the plugin) but which includes creation of "MQTT Discovery" hardware and discovery of your Sonoffs, to hopefully show why your Sonoff S20 is duplicated.
mikeoo
Posts: 110
Joined: Sunday 22 March 2015 7:35
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Holland
Contact:

Re: Python plugin: Sonoff-Tasmota + Other devices supporting MQTT Discovery

Post by mikeoo »

emontnemery wrote: Sunday 04 February 2018 9:33 @mikeoo, I mean a log with same settings as the snippet showing the errors you pasted before (i.e. with 'Debug' set to 'Verbose' for the plugin) but which includes creation of "MQTT Discovery" hardware and discovery of your Sonoffs, to hopefully show why your Sonoff S20 is duplicated.
Update my post buy did not refresh page so didn't see your already give a reaction, your quick.

Update
Problem wit finding it twice is solved. I reset the Sonoff S20 to its defaults and configured Tasmota again and now it is only discovering once :D

Find some extra errors now in the log of Domoticz. Maby the some problem as the first error.

Code: Select all

 2018-02-04 09:33:51.423 Error: (MQTT Discovery) 'CDevice_update' failed 'TypeError':'Required argument 'nValue' (pos 1) not found'.
2018-02-04 09:41:33.861 Error: (MQTT Discovery) 'onMessage' failed 'TypeError':'string indices must be integers'.
2018-02-04 09:41:33.862 Error: (MQTT Discovery) ----> Line 526 in /home/pi/domoticz/plugins/domoticz_mqtt_discovery/plugin.py, function onMessage
2018-02-04 09:41:33.862 Error: (MQTT Discovery) ----> Line 177 in /home/pi/domoticz/plugins/domoticz_mqtt_discovery/plugin.py, function onMessage
2018-02-04 09:41:33.862 Error: (MQTT Discovery) ----> Line 343 in /home/pi/domoticz/plugins/domoticz_mqtt_discovery/plugin.py, function updateDeviceSettings
2018-02-04 09:41:41.336 Error: (MQTT Discovery) 'onMessage' failed 'TypeError':'string indices must be integers'.
2018-02-04 09:41:41.336 Error: (MQTT Discovery) ----> Line 526 in /home/pi/domoticz/plugins/domoticz_mqtt_discovery/plugin.py, function onMessage
2018-02-04 09:41:41.336 Error: (MQTT Discovery) ----> Line 177 in /home/pi/domoticz/plugins/domoticz_mqtt_discovery/plugin.py, function onMessage
2018-02-04 09:41:41.336 Error: (MQTT Discovery) ----> Line 343 in /home/pi/domoticz/plugins/domoticz_mqtt_discovery/plugin.py, function updateDeviceSettings
2018-02-04 09:42:40.890 Error: (MQTT Discovery) 'onMessage' failed 'TypeError':'string indices must be integers'.
2018-02-04 09:42:40.891 Error: (MQTT Discovery) ----> Line 526 in /home/pi/domoticz/plugins/domoticz_mqtt_discovery/plugin.py, function onMessage
2018-02-04 09:42:40.891 Error: (MQTT Discovery) ----> Line 177 in /home/pi/domoticz/plugins/domoticz_mqtt_discovery/plugin.py, function onMessage
2018-02-04 09:42:40.891 Error: (MQTT Discovery) ----> Line 343 in /home/pi/domoticz/plugins/domoticz_mqtt_discovery/plugin.py, function updateDeviceSettings
2018-02-04 09:43:09.391 Error: (MQTT Discovery) 'onMessage' failed 'TypeError':'string indices must be integers'.
2018-02-04 09:43:09.392 Error: (MQTT Discovery) ----> Line 526 in /home/pi/domoticz/plugins/domoticz_mqtt_discovery/plugin.py, function onMessage
2018-02-04 09:43:09.392 Error: (MQTT Discovery) ----> Line 177 in /home/pi/domoticz/plugins/domoticz_mqtt_discovery/plugin.py, function onMessage
2018-02-04 09:43:09.392 Error: (MQTT Discovery) ----> Line 343 in /home/pi/domoticz/plugins/domoticz_mqtt_discovery/plugin.py, function updateDeviceSettings 
emontnemery
Posts: 38
Joined: Sunday 08 October 2017 13:50
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python plugin: Sonoff-Tasmota + Other devices supporting MQTT Discovery

Post by emontnemery »

dnpwwo, I've tested with Python 3.6.4 on Windows, and I don't see the errors Reconos sees. How to debug?
Would it make sense to make a special build with debug prints in CPlugin::Callback to dump the pParams struct?

Reconos, maybe you can double check that Domoticz is actually using your Python 3.6.4 install, you should see something like this on the 'Status' tab in the log:

Code: Select all

2018-02-04 11:57:14.380 Domoticz V3.8873 (c)2012-2018 GizMoCuz
2018-02-04 11:57:14.383 Build Hash: 77d4f417, Date: 2018-01-31 15:50:27
2018-02-04 11:57:14.687 PluginSystem: Started, Python version '3.6.4'
emontnemery
Posts: 38
Joined: Sunday 08 October 2017 13:50
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python plugin: Sonoff-Tasmota + Other devices supporting MQTT Discovery

Post by emontnemery »

mikeoo, can you reproduce the new error with 'Debug' set to 'Verbose' for the plugin and share log?
mikeoo
Posts: 110
Joined: Sunday 22 March 2015 7:35
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Holland
Contact:

Re: Python plugin: Sonoff-Tasmota + Other devices supporting MQTT Discovery

Post by mikeoo »

emontnemery wrote: Sunday 04 February 2018 12:33 mikeoo, can you reproduce the new error with 'Debug' set to 'Verbose' for the plugin and share log?
I cannot reproduce it. I will leave logging running in verbose so maybe it will reappear later.

I have now 2 Sonoff S20 running with this plugin for testing. Both working when I click on the switch in Domoticz.
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.

Code: Select all

 2018-02-04 13:31:36.321 (MQTT Discovery) Device Name: 'Verlichting Trap'
2018-02-04 13:31:36.321 (MQTT Discovery) Device nValue: 0
2018-02-04 13:31:36.321 (MQTT Discovery) Device sValue: ''
2018-02-04 13:31:36.321 (MQTT Discovery) Device LastLevel: 0
2018-02-04 13:31:36.322 (MQTT Discovery) Device Options: {'config': '{"payload_not_available": "Offline", "availability_topic": "tele/sonoff225/LWT", "payload_available": "Online", "command_topic": "cmnd/sonoff225/POWER", "payload_on": "ON", "payload_off": "OFF", "state_topic": "stat/sonoff225/RESULT", "value_template": "{{value_json.POWER}}", "name": "Sonoff Smart Socket 02"}', 'devicename': 'sonoff225'}
2018-02-04 13:31:36.322 (MQTT Discovery) Debug log level set to: 'true'.
2018-02-04 13:31:36.322 (MQTT Discovery) MqttDevice::__init__
2018-02-04 13:31:36.322 (MQTT Discovery) MqttDevice::Open
2018-02-04 13:31:36.322 (MQTT Discovery) Heartbeat interval set to: 10.
2018-02-04 13:31:36.322 (MQTT Discovery) Protocol set to: 'MQTT'.
2018-02-04 13:31:36.322 (MQTT Discovery) Transport set to: 'TCP/IP', 127.0.0.1:1883.
2018-02-04 13:31:36.323 PluginSystem: Starting I/O service thread.
2018-02-04 13:31:36.323 (MQTT Discovery) Connect directive received, action initiated successfully.
2018-02-04 13:31:36.373 (MQTT Discovery) Calling message handler 'onConnect'.
2018-02-04 13:31:36.373 (MQTT Discovery) Successful connect to: 127.0.0.1:1883
2018-02-04 13:31:36.374 (MQTT Discovery) MqttDevice::Connect
2018-02-04 13:31:36.374 (MQTT Discovery) Sending 22 bytes of data:
2018-02-04 13:31:36.374 (MQTT Discovery) 10 14 00 04 4d 51 54 54 04 02 00 3c 00 08 44 6f 6d 6f 74 69 ....MQTT...<..Domoti
2018-02-04 13:31:36.374 (MQTT Discovery) 63 7a .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. cz
2018-02-04 13:31:36.425 (MQTT Discovery) Received 4 bytes of data:
2018-02-04 13:31:36.425 (MQTT Discovery) 20 02 00 00 .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. ....
2018-02-04 13:31:36.425 (MQTT Discovery) Calling message handler 'onMessage'.
2018-02-04 13:31:36.425 (MQTT Discovery) onMessage called for connection: '127.0.0.1' type:'CONNACK' topic:'' payload:''
2018-02-04 13:31:36.426 (MQTT Discovery) getTopics: '{'tele/sonoffAFBDA8/LWT', 'stat/sonoffAFBDA8/RESULT', 'cmnd/sonoff225/POWER', 'tele/sonoff225/LWT', 'stat/sonoff225/RESULT', 'cmnd/sonoffAFBDA8/POWER', 'homeassistant/#'}'
2018-02-04 13:31:36.426 (MQTT Discovery) MqttDevice::Subscribe
2018-02-04 13:31:36.426 (MQTT Discovery) Sending 168 bytes of data:
2018-02-04 13:31:36.426 (MQTT Discovery) 82 a5 01 00 01 00 15 74 65 6c 65 2f 73 6f 6e 6f 66 66 41 46 ��.....tele/sonoffAF
2018-02-04 13:31:36.427 (MQTT Discovery) 42 44 41 38 2f 4c 57 54 00 00 18 73 74 61 74 2f 73 6f 6e 6f BDA8/LWT...stat/sono
2018-02-04 13:31:36.427 (MQTT Discovery) 66 66 41 46 42 44 41 38 2f 52 45 53 55 4c 54 00 00 14 63 6d ffAFBDA8/RESULT...cm
2018-02-04 13:31:36.427 (MQTT Discovery) 6e 64 2f 73 6f 6e 6f 66 66 32 32 35 2f 50 4f 57 45 52 00 00 nd/sonoff225/POWER..
2018-02-04 13:31:36.427 (MQTT Discovery) 12 74 65 6c 65 2f 73 6f 6e 6f 66 66 32 32 35 2f 4c 57 54 00 .tele/sonoff225/LWT.
2018-02-04 13:31:36.427 (MQTT Discovery) 00 15 73 74 61 74 2f 73 6f 6e 6f 66 66 32 32 35 2f 52 45 53 ..stat/sonoff225/RES
2018-02-04 13:31:36.427 (MQTT Discovery) 55 4c 54 00 00 17 63 6d 6e 64 2f 73 6f 6e 6f 66 66 41 46 42 ULT...cmnd/sonoffAFB
2018-02-04 13:31:36.427 (MQTT Discovery) 44 41 38 2f 50 4f 57 45 52 00 00 0f 68 6f 6d 65 61 73 73 69 DA8/POWER...homeassi
2018-02-04 13:31:36.427 (MQTT Discovery) 73 74 61 6e 74 2f 23 00 .. .. .. .. .. .. .. .. .. .. .. .. stant/#.
2018-02-04 13:31:36.428 (MQTT Discovery) Received 11 bytes of data:
2018-02-04 13:31:36.429 (MQTT Discovery) 90 09 00 01 00 00 00 00 00 00 00 .. .. .. .. .. .. .. .. .. �..........
2018-02-04 13:31:36.429 (MQTT Discovery) Received 28 bytes of data:
2018-02-04 13:31:36.429 (MQTT Discovery) 31 1a 00 12 74 65 6c 65 2f 73 6f 6e 6f 66 66 32 32 35 2f 4c 1...tele/sonoff225/L
2018-02-04 13:31:36.429 (MQTT Discovery) 57 54 4f 6e 6c 69 6e 65 .. .. .. .. .. .. .. .. .. .. .. .. WTOnline
2018-02-04 13:31:36.429 (MQTT Discovery) Received 347 bytes of data:
2018-02-04 13:31:36.429 (MQTT Discovery) 31 d8 02 00 28 68 6f 6d 65 61 73 73 69 73 74 61 6e 74 2f 73 1�..(homeassistant/s
2018-02-04 13:31:36.429 (MQTT Discovery) 77 69 74 63 68 2f 73 6f 6e 6f 66 66 41 46 42 44 41 38 2f 63 witch/sonoffAFBDA8/c
2018-02-04 13:31:36.429 (MQTT Discovery) 6f 6e 66 69 67 7b 22 6e 61 6d 65 22 3a 22 53 6f 6e 6f 66 66 onfig{"name":"Sonoff
2018-02-04 13:31:36.430 (MQTT Discovery) 20 53 6d 61 72 74 20 53 6f 63 6b 65 74 20 30 31 22 2c 22 63 .Smart.Socket.01","c
2018-02-04 13:31:36.430 (MQTT Discovery) 6f 6d 6d 61 6e 64 5f 74 6f 70 69 63 22 3a 22 63 6d 6e 64 2f ommand_topic":"cmnd/
2018-02-04 13:31:36.430 (MQTT Discovery) 73 6f 6e 6f 66 66 41 46 42 44 41 38 2f 50 4f 57 45 52 22 2c sonoffAFBDA8/POWER",
2018-02-04 13:31:36.430 (MQTT Discovery) 22 73 74 61 74 65 5f 74 6f 70 69 63 22 3a 22 73 74 61 74 2f "state_topic":"stat/
2018-02-04 13:31:36.430 (MQTT Discovery) 73 6f 6e 6f 66 66 41 46 42 44 41 38 2f 52 45 53 55 4c 54 22 sonoffAFBDA8/RESULT"
2018-02-04 13:31:36.430 (MQTT Discovery) 2c 22 76 61 6c 75 65 5f 74 65 6d 70 6c 61 74 65 22 3a 22 7b ,"value_template":"{
2018-02-04 13:31:36.430 (MQTT Discovery) 7b 76 61 6c 75 65 5f 6a 73 6f 6e 2e 50 4f 57 45 52 7d 7d 22 {value_json.POWER}}"
2018-02-04 13:31:36.430 (MQTT Discovery) 2c 22 70 61 79 6c 6f 61 64 5f 6f 66 66 22 3a 22 4f 46 46 22 ,"payload_off":"OFF"
2018-02-04 13:31:36.430 (MQTT Discovery) 2c 22 70 61 79 6c 6f 61 64 5f 6f 6e 22 3a 22 4f 4e 22 2c 22 ,"payload_on":"ON","
2018-02-04 13:31:36.431 (MQTT Discovery) 61 76 61 69 6c 61 62 69 6c 69 74 79 5f 74 6f 70 69 63 22 3a availability_topic":
2018-02-04 13:31:36.431 (MQTT Discovery) 22 74 65 6c 65 2f 73 6f 6e 6f 66 66 41 46 42 44 41 38 2f 4c "tele/sonoffAFBDA8/L
2018-02-04 13:31:36.431 (MQTT Discovery) 57 54 22 2c 22 70 61 79 6c 6f 61 64 5f 61 76 61 69 6c 61 62 WT","payload_availab
2018-02-04 13:31:36.431 (MQTT Discovery) 6c 65 22 3a 22 4f 6e 6c 69 6e 65 22 2c 22 70 61 79 6c 6f 61 le":"Online","payloa
2018-02-04 13:31:36.431 (MQTT Discovery) 64 5f 6e 6f 74 5f 61 76 61 69 6c 61 62 6c 65 22 3a 22 4f 66 d_not_available":"Of
2018-02-04 13:31:36.431 (MQTT Discovery) 66 6c 69 6e 65 22 7d .. .. .. .. .. .. .. .. .. .. .. .. .. fline"}
2018-02-04 13:31:36.431 (MQTT Discovery) Received 329 bytes of data:
2018-02-04 13:31:36.431 (MQTT Discovery) 31 c6 02 00 25 68 6f 6d 65 61 73 73 69 73 74 61 6e 74 2f 73 1�..%homeassistant/s
2018-02-04 13:31:36.431 (MQTT Discovery) 77 69 74 63 68 2f 73 6f 6e 6f 66 66 32 32 35 2f 63 6f 6e 66 witch/sonoff225/conf
2018-02-04 13:31:36.432 (MQTT Discovery) 69 67 7b 22 6e 61 6d 65 22 3a 22 56 65 72 6c 69 63 68 74 69 ig{"name":"Verlichti
2018-02-04 13:31:36.432 (MQTT Discovery) 6e 67 20 54 72 61 70 22 2c 22 63 6f 6d 6d 61 6e 64 5f 74 6f ng.Trap","command_to
2018-02-04 13:31:36.432 (MQTT Discovery) 70 69 63 22 3a 22 63 6d 6e 64 2f 73 6f 6e 6f 66 66 32 32 35 pic":"cmnd/sonoff225
2018-02-04 13:31:36.432 (MQTT Discovery) 2f 50 4f 57 45 52 22 2c 22 73 74 61 74 65 5f 74 6f 70 69 63 /POWER","state_topic
2018-02-04 13:31:36.432 (MQTT Discovery) 22 3a 22 73 74 61 74 2f 73 6f 6e 6f 66 66 32 32 35 2f 52 45 ":"stat/sonoff225/RE
2018-02-04 13:31:36.432 (MQTT Discovery) 53 55 4c 54 22 2c 22 76 61 6c 75 65 5f 74 65 6d 70 6c 61 74 SULT","value_templat
2018-02-04 13:31:36.432 (MQTT Discovery) 65 22 3a 22 7b 7b 76 61 6c 75 65 5f 6a 73 6f 6e 2e 50 4f 57 e":"{{value_json.POW
2018-02-04 13:31:36.432 (MQTT Discovery) 45 52 7d 7d 22 2c 22 70 61 79 6c 6f 61 64 5f 6f 66 66 22 3a ER}}","payload_off":
2018-02-04 13:31:36.432 (MQTT Discovery) 22 4f 46 46 22 2c 22 70 61 79 6c 6f 61 64 5f 6f 6e 22 3a 22 "OFF","payload_on":"
2018-02-04 13:31:36.432 (MQTT Discovery) 4f 4e 22 2c 22 61 76 61 69 6c 61 62 69 6c 69 74 79 5f 74 6f ON","availability_to
2018-02-04 13:31:36.433 (MQTT Discovery) 70 69 63 22 3a 22 74 65 6c 65 2f 73 6f 6e 6f 66 66 32 32 35 pic":"tele/sonoff225
2018-02-04 13:31:36.433 (MQTT Discovery) 2f 4c 57 54 22 2c 22 70 61 79 6c 6f 61 64 5f 61 76 61 69 6c /LWT","payload_avail
2018-02-04 13:31:36.433 (MQTT Discovery) 61 62 6c 65 22 3a 22 4f 6e 6c 69 6e 65 22 2c 22 70 61 79 6c able":"Online","payl
2018-02-04 13:31:36.433 (MQTT Discovery) 6f 61 64 5f 6e 6f 74 5f 61 76 61 69 6c 61 62 6c 65 22 3a 22 oad_not_available":"
2018-02-04 13:31:36.433 (MQTT Discovery) 4f 66 66 6c 69 6e 65 22 7d .. .. .. .. .. .. .. .. .. .. .. Offline"}
2018-02-04 13:31:36.433 (MQTT Discovery) Calling message handler 'onMessage'.
2018-02-04 13:31:36.433 (MQTT Discovery) onMessage called for connection: '127.0.0.1' type:'SUBACK' topic:'' payload:''
2018-02-04 13:31:36.433 (MQTT Discovery) Calling message handler 'onMessage'.
2018-02-04 13:31:36.437 (MQTT Discovery) onMessage called for connection: '127.0.0.1' type:'PUBLISH' topic:'tele/sonoff225/LWT' payload:'b'Online''
2018-02-04 13:31:36.438 (MQTT Discovery) tele/sonoff225/LWT
2018-02-04 13:31:36.438 (MQTT Discovery) getDevices key: '' configkey: '' value: '' config: '' topic: 'tele/sonoff225/LWT'
2018-02-04 13:31:36.438 (MQTT Discovery) getDevices found 1 devices
2018-02-04 13:31:36.439 (MQTT Discovery) Got state_topic
2018-02-04 13:31:36.439 (MQTT Discovery) TimedOut: '0'
2018-02-04 13:31:36.439 Error: (CDevice_update) Verlichting Trap: Failed to parse parameters: 'nValue', 'sValue', 'Image', 'SignalLevel', 'BatteryLevel', 'Options', 'TimedOut', 'Name', 'TypeName', 'Type', 'Subtype', 'Switchtype' or 'Used' expected.
2018-02-04 13:31:36.439 Error: (MQTT Discovery) 'CDevice_update' failed 'TypeError':'Required argument 'nValue' (pos 1) not found'.
2018-02-04 13:31:36.439 (MQTT Discovery) Calling message handler 'onMessage'.
2018-02-04 13:31:36.439 (MQTT Discovery) onMessage called for connection: '127.0.0.1' type:'PUBLISH' topic:'homeassistant/switch/sonoffAFBDA8/config' payload:'b'{"name":"Sonoff Smart Socket 01","command_topic":"cmnd/sonoffAFBDA8/POWER","state_topic":"stat/sonoffAFBDA8/RESULT","value_template":"{{value_json.POWER}}","payload_off":"OFF","payload_on":"ON","availability_topic":"tele/sonoffAFBDA8/LWT","payload_available":"Online","payload_not_available":"Offline"}''
2018-02-04 13:31:36.440 (MQTT Discovery) homeassistant/switch/sonoffAFBDA8/config
2018-02-04 13:31:36.440 (MQTT Discovery) updateDeviceSettings devicename: 'sonoffAFBDA8' devicetype: 'switch' config: '{'payload_not_available': 'Offline', 'availability_topic': 'tele/sonoffAFBDA8/LWT', 'payload_available': 'Online', 'command_topic': 'cmnd/sonoffAFBDA8/POWER', 'payload_on': 'ON', 'payload_off': 'OFF', 'state_topic': 'stat/sonoffAFBDA8/RESULT', 'value_template': '{{value_json.POWER}}', 'name': 'Sonoff Smart Socket 01'}'
2018-02-04 13:31:36.440 (MQTT Discovery) getDevices key: 'devicename' configkey: '' value: 'sonoffAFBDA8' config: '' topic: ''
2018-02-04 13:31:36.440 (MQTT Discovery) getDevices found 1 devices
2018-02-04 13:31:36.441 (MQTT Discovery) Calling message handler 'onMessage'.
2018-02-04 13:31:36.441 (MQTT Discovery) onMessage called for connection: '127.0.0.1' type:'PUBLISH' topic:'homeassistant/switch/sonoff225/config' payload:'b'{"name":"Verlichting Trap","command_topic":"cmnd/sonoff225/POWER","state_topic":"stat/sonoff225/RESULT","value_template":"{{value_json.POWER}}","payload_off":"OFF","payload_on":"ON","availability_topic":"tele/sonoff225/LWT","payload_available":"Online","payload_not_available":"Offline"}''
2018-02-04 13:31:36.441 (MQTT Discovery) homeassistant/switch/sonoff225/config
2018-02-04 13:31:36.441 (MQTT Discovery) updateDeviceSettings devicename: 'sonoff225' devicetype: 'switch' config: '{'payload_not_available': 'Offline', 'availability_topic': 'tele/sonoff225/LWT', 'payload_available': 'Online', 'command_topic': 'cmnd/sonoff225/POWER', 'payload_on': 'ON', 'payload_off': 'OFF', 'state_topic': 'stat/sonoff225/RESULT', 'value_template': '{{value_json.POWER}}', 'name': 'Verlichting Trap'}'
2018-02-04 13:31:36.441 (MQTT Discovery) getDevices key: 'devicename' configkey: '' value: 'sonoff225' config: '' topic: ''
2018-02-04 13:31:36.441 (MQTT Discovery) getDevices found 1 devices
2018-02-04 13:31:45.860 (MQTT Discovery) Calling message handler 'onHeartbeat'.
2018-02-04 13:31:45.861 (MQTT Discovery) Heartbeating...
2018-02-04 13:31:45.861 (MQTT Discovery) MqttDevice::Ping
2018-02-04 13:31:45.861 (MQTT Discovery) Sending 2 bytes of data:
2018-02-04 13:31:45.861 (MQTT Discovery) c0 00 .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. �.
2018-02-04 13:31:45.912 (MQTT Discovery) Received 2 bytes of data:
2018-02-04 13:31:45.912 (MQTT Discovery) d0 00 .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. �.
2018-02-04 13:31:45.912 (MQTT Discovery) Calling message handler 'onMessage'.
2018-02-04 13:31:45.913 (MQTT Discovery) onMessage called for connection: '127.0.0.1' type:'PINGRESP' topic:'' payload:''  
I will reset that one again in Tasmota and try to see if it goes better then.

Update
I reset the one "Trap verlichting" in Tasmota to its defaults and reconfigured it and then turned on the plugin and get again the error for this one.

Code: Select all

 2018-02-04 13:42:45.783 (MQTT Discovery) 7b 76 61 6c 75 65 5f 6a 73 6f 6e 2e 50 4f 57 45 52 7d 7d 22 {value_json.POWER}}"
2018-02-04 13:42:45.783 (MQTT Discovery) 2c 22 70 61 79 6c 6f 61 64 5f 6f 66 66 22 3a 22 4f 46 46 22 ,"payload_off":"OFF"
2018-02-04 13:42:45.783 (MQTT Discovery) 2c 22 70 61 79 6c 6f 61 64 5f 6f 6e 22 3a 22 4f 4e 22 2c 22 ,"payload_on":"ON","
2018-02-04 13:42:45.783 (MQTT Discovery) 61 76 61 69 6c 61 62 69 6c 69 74 79 5f 74 6f 70 69 63 22 3a availability_topic":
2018-02-04 13:42:45.783 (MQTT Discovery) 22 74 65 6c 65 2f 73 6f 6e 6f 66 66 32 32 35 2f 4c 57 54 22 "tele/sonoff225/LWT"
2018-02-04 13:42:45.784 (MQTT Discovery) 2c 22 70 61 79 6c 6f 61 64 5f 61 76 61 69 6c 61 62 6c 65 22 ,"payload_available"
2018-02-04 13:42:45.784 (MQTT Discovery) 3a 22 4f 6e 6c 69 6e 65 22 2c 22 70 61 79 6c 6f 61 64 5f 6e :"Online","payload_n
2018-02-04 13:42:45.784 (MQTT Discovery) 6f 74 5f 61 76 61 69 6c 61 62 6c 65 22 3a 22 4f 66 66 6c 69 ot_available":"Offli
2018-02-04 13:42:45.784 (MQTT Discovery) 6e 65 22 7d .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. ne"}
2018-02-04 13:42:45.784 (MQTT Discovery) Calling message handler 'onMessage'.
2018-02-04 13:42:45.784 (MQTT Discovery) onMessage called for connection: '127.0.0.1' type:'SUBACK' topic:'' payload:''
2018-02-04 13:42:45.784 (MQTT Discovery) Calling message handler 'onMessage'.
2018-02-04 13:42:45.788 (MQTT Discovery) onMessage called for connection: '127.0.0.1' type:'PUBLISH' topic:'homeassistant/switch/sonoffAFBDA8/config' payload:'b'{"name":"Sonoff Smart Socket 01","command_topic":"cmnd/sonoffAFBDA8/POWER","state_topic":"stat/sonoffAFBDA8/RESULT","value_template":"{{value_json.POWER}}","payload_off":"OFF","payload_on":"ON","availability_topic":"tele/sonoffAFBDA8/LWT","payload_available":"Online","payload_not_available":"Offline"}''
2018-02-04 13:42:45.789 (MQTT Discovery) homeassistant/switch/sonoffAFBDA8/config
2018-02-04 13:42:45.789 (MQTT Discovery) updateDeviceSettings devicename: 'sonoffAFBDA8' devicetype: 'switch' config: '{'payload_not_available': 'Offline', 'availability_topic': 'tele/sonoffAFBDA8/LWT', 'payload_available': 'Online', 'command_topic': 'cmnd/sonoffAFBDA8/POWER', 'payload_on': 'ON', 'payload_off': 'OFF', 'state_topic': 'stat/sonoffAFBDA8/RESULT', 'value_template': '{{value_json.POWER}}', 'name': 'Sonoff Smart Socket 01'}'
2018-02-04 13:42:45.789 (MQTT Discovery) getDevices key: 'devicename' configkey: '' value: 'sonoffAFBDA8' config: '' topic: ''
2018-02-04 13:42:45.789 (MQTT Discovery) getDevices found 1 devices
2018-02-04 13:42:45.790 (MQTT Discovery) Calling message handler 'onMessage'.
2018-02-04 13:42:45.790 (MQTT Discovery) onMessage called for connection: '127.0.0.1' type:'PUBLISH' topic:'homeassistant/switch/sonoff225/config' payload:'b'{"name":"Verlichting Trap","command_topic":"cmnd/sonoff225/POWER","state_topic":"stat/sonoff225/RESULT","value_template":"{{value_json.POWER}}","payload_off":"OFF","payload_on":"ON","availability_topic":"tele/sonoff225/LWT","payload_available":"Online","payload_not_available":"Offline"}''
2018-02-04 13:42:45.790 (MQTT Discovery) homeassistant/switch/sonoff225/config
2018-02-04 13:42:45.790 (MQTT Discovery) updateDeviceSettings devicename: 'sonoff225' devicetype: 'switch' config: '{'payload_not_available': 'Offline', 'availability_topic': 'tele/sonoff225/LWT', 'payload_available': 'Online', 'command_topic': 'cmnd/sonoff225/POWER', 'payload_on': 'ON', 'payload_off': 'OFF', 'state_topic': 'stat/sonoff225/RESULT', 'value_template': '{{value_json.POWER}}', 'name': 'Verlichting Trap'}'
2018-02-04 13:42:45.790 (MQTT Discovery) getDevices key: 'devicename' configkey: '' value: 'sonoff225' config: '' topic: ''
2018-02-04 13:42:45.790 (MQTT Discovery) getDevices found 0 devices
2018-02-04 13:42:45.791 (MQTT Discovery) updateDeviceSettings: Did not find device with key='state_topic', value = 'stat/sonoff225/RESULT'
2018-02-04 13:42:45.791 (MQTT Discovery) devicetype == 'switch'
2018-02-04 13:42:45.791 (MQTT Discovery) isTasmota: False
2018-02-04 13:42:45.791 (MQTT Discovery) Creating device with unit: 2
2018-02-04 13:42:45.791 (MQTT Discovery) Creating device 'Verlichting Trap'.
2018-02-04 13:42:45.795 (MQTT Discovery) getTopics: '{'tele/sonoffAFBDA8/LWT', 'stat/sonoffAFBDA8/RESULT', 'cmnd/sonoff225/POWER', 'tele/sonoff225/LWT', 'stat/sonoff225/RESULT', 'cmnd/sonoffAFBDA8/POWER', 'homeassistant/#'}'
2018-02-04 13:42:45.796 (MQTT Discovery) MqttDevice::Subscribe
2018-02-04 13:42:45.796 (MQTT Discovery) Sending 168 bytes of data:
2018-02-04 13:42:45.796 (MQTT Discovery) 82 a5 01 00 02 00 15 74 65 6c 65 2f 73 6f 6e 6f 66 66 41 46 ��.....tele/sonoffAF
2018-02-04 13:42:45.796 (MQTT Discovery) 42 44 41 38 2f 4c 57 54 00 00 18 73 74 61 74 2f 73 6f 6e 6f BDA8/LWT...stat/sono
2018-02-04 13:42:45.796 (MQTT Discovery) 66 66 41 46 42 44 41 38 2f 52 45 53 55 4c 54 00 00 14 63 6d ffAFBDA8/RESULT...cm
2018-02-04 13:42:45.797 (MQTT Discovery) 6e 64 2f 73 6f 6e 6f 66 66 32 32 35 2f 50 4f 57 45 52 00 00 nd/sonoff225/POWER..
2018-02-04 13:42:45.797 (MQTT Discovery) 12 74 65 6c 65 2f 73 6f 6e 6f 66 66 32 32 35 2f 4c 57 54 00 .tele/sonoff225/LWT.
2018-02-04 13:42:45.797 (MQTT Discovery) 00 15 73 74 61 74 2f 73 6f 6e 6f 66 66 32 32 35 2f 52 45 53 ..stat/sonoff225/RES
2018-02-04 13:42:45.797 (MQTT Discovery) 55 4c 54 00 00 17 63 6d 6e 64 2f 73 6f 6e 6f 66 66 41 46 42 ULT...cmnd/sonoffAFB
2018-02-04 13:42:45.797 (MQTT Discovery) 44 41 38 2f 50 4f 57 45 52 00 00 0f 68 6f 6d 65 61 73 73 69 DA8/POWER...homeassi
2018-02-04 13:42:45.797 (MQTT Discovery) 73 74 61 6e 74 2f 23 00 .. .. .. .. .. .. .. .. .. .. .. .. stant/#.
2018-02-04 13:42:45.847 (MQTT Discovery) Received 715 bytes of data:
2018-02-04 13:42:45.848 (MQTT Discovery) 90 09 00 02 00 00 00 00 00 00 00 31 1a 00 12 74 65 6c 65 2f �..........1...tele/
2018-02-04 13:42:45.848 (MQTT Discovery) 73 6f 6e 6f 66 66 32 32 35 2f 4c 57 54 4f 6e 6c 69 6e 65 31 sonoff225/LWTOnline1
2018-02-04 13:42:45.848 (MQTT Discovery) d8 02 00 28 68 6f 6d 65 61 73 73 69 73 74 61 6e 74 2f 73 77 �..(homeassistant/sw
2018-02-04 13:42:45.848 (MQTT Discovery) 69 74 63 68 2f 73 6f 6e 6f 66 66 41 46 42 44 41 38 2f 63 6f itch/sonoffAFBDA8/co
2018-02-04 13:42:45.848 (MQTT Discovery) 6e 66 69 67 7b 22 6e 61 6d 65 22 3a 22 53 6f 6e 6f 66 66 20 nfig{"name":"Sonoff.
2018-02-04 13:42:45.848 (MQTT Discovery) 53 6d 61 72 74 20 53 6f 63 6b 65 74 20 30 31 22 2c 22 63 6f Smart.Socket.01","co
2018-02-04 13:42:45.848 (MQTT Discovery) 6d 6d 61 6e 64 5f 74 6f 70 69 63 22 3a 22 63 6d 6e 64 2f 73 mmand_topic":"cmnd/s
2018-02-04 13:42:45.848 (MQTT Discovery) 6f 6e 6f 66 66 41 46 42 44 41 38 2f 50 4f 57 45 52 22 2c 22 onoffAFBDA8/POWER","
2018-02-04 13:42:45.849 (MQTT Discovery) 73 74 61 74 65 5f 74 6f 70 69 63 22 3a 22 73 74 61 74 2f 73 state_topic":"stat/s
2018-02-04 13:42:45.849 (MQTT Discovery) 6f 6e 6f 66 66 41 46 42 44 41 38 2f 52 45 53 55 4c 54 22 2c onoffAFBDA8/RESULT",
2018-02-04 13:42:45.849 (MQTT Discovery) 22 76 61 6c 75 65 5f 74 65 6d 70 6c 61 74 65 22 3a 22 7b 7b "value_template":"{{
2018-02-04 13:42:45.849 (MQTT Discovery) 76 61 6c 75 65 5f 6a 73 6f 6e 2e 50 4f 57 45 52 7d 7d 22 2c value_json.POWER}}",
2018-02-04 13:42:45.849 (MQTT Discovery) 22 70 61 79 6c 6f 61 64 5f 6f 66 66 22 3a 22 4f 46 46 22 2c "payload_off":"OFF",
2018-02-04 13:42:45.849 (MQTT Discovery) 22 70 61 79 6c 6f 61 64 5f 6f 6e 22 3a 22 4f 4e 22 2c 22 61 "payload_on":"ON","a
2018-02-04 13:42:45.849 (MQTT Discovery) 76 61 69 6c 61 62 69 6c 69 74 79 5f 74 6f 70 69 63 22 3a 22 vailability_topic":"
2018-02-04 13:42:45.849 (MQTT Discovery) 74 65 6c 65 2f 73 6f 6e 6f 66 66 41 46 42 44 41 38 2f 4c 57 tele/sonoffAFBDA8/LW
2018-02-04 13:42:45.849 (MQTT Discovery) 54 22 2c 22 70 61 79 6c 6f 61 64 5f 61 76 61 69 6c 61 62 6c T","payload_availabl
2018-02-04 13:42:45.849 (MQTT Discovery) 65 22 3a 22 4f 6e 6c 69 6e 65 22 2c 22 70 61 79 6c 6f 61 64 e":"Online","payload
2018-02-04 13:42:45.850 (MQTT Discovery) 5f 6e 6f 74 5f 61 76 61 69 6c 61 62 6c 65 22 3a 22 4f 66 66 _not_available":"Off
2018-02-04 13:42:45.850 (MQTT Discovery) 6c 69 6e 65 22 7d 31 c6 02 00 25 68 6f 6d 65 61 73 73 69 73 line"}1�..%homeassis
2018-02-04 13:42:45.850 (MQTT Discovery) 74 61 6e 74 2f 73 77 69 74 63 68 2f 73 6f 6e 6f 66 66 32 32 tant/switch/sonoff22
2018-02-04 13:42:45.850 (MQTT Discovery) 35 2f 63 6f 6e 66 69 67 7b 22 6e 61 6d 65 22 3a 22 56 65 72 5/config{"name":"Ver
2018-02-04 13:42:45.850 (MQTT Discovery) 6c 69 63 68 74 69 6e 67 20 54 72 61 70 22 2c 22 63 6f 6d 6d lichting.Trap","comm
2018-02-04 13:42:45.850 (MQTT Discovery) 61 6e 64 5f 74 6f 70 69 63 22 3a 22 63 6d 6e 64 2f 73 6f 6e and_topic":"cmnd/son
2018-02-04 13:42:45.850 (MQTT Discovery) 6f 66 66 32 32 35 2f 50 4f 57 45 52 22 2c 22 73 74 61 74 65 off225/POWER","state
2018-02-04 13:42:45.850 (MQTT Discovery) 5f 74 6f 70 69 63 22 3a 22 73 74 61 74 2f 73 6f 6e 6f 66 66 _topic":"stat/sonoff
2018-02-04 13:42:45.850 (MQTT Discovery) 32 32 35 2f 52 45 53 55 4c 54 22 2c 22 76 61 6c 75 65 5f 74 225/RESULT","value_t
2018-02-04 13:42:45.851 (MQTT Discovery) 65 6d 70 6c 61 74 65 22 3a 22 7b 7b 76 61 6c 75 65 5f 6a 73 emplate":"{{value_js
2018-02-04 13:42:45.851 (MQTT Discovery) 6f 6e 2e 50 4f 57 45 52 7d 7d 22 2c 22 70 61 79 6c 6f 61 64 on.POWER}}","payload
2018-02-04 13:42:45.851 (MQTT Discovery) 5f 6f 66 66 22 3a 22 4f 46 46 22 2c 22 70 61 79 6c 6f 61 64 _off":"OFF","payload
2018-02-04 13:42:45.851 (MQTT Discovery) 5f 6f 6e 22 3a 22 4f 4e 22 2c 22 61 76 61 69 6c 61 62 69 6c _on":"ON","availabil
2018-02-04 13:42:45.851 (MQTT Discovery) 69 74 79 5f 74 6f 70 69 63 22 3a 22 74 65 6c 65 2f 73 6f 6e ity_topic":"tele/son
2018-02-04 13:42:45.851 (MQTT Discovery) 6f 66 66 32 32 35 2f 4c 57 54 22 2c 22 70 61 79 6c 6f 61 64 off225/LWT","payload
2018-02-04 13:42:45.851 (MQTT Discovery) 5f 61 76 61 69 6c 61 62 6c 65 22 3a 22 4f 6e 6c 69 6e 65 22 _available":"Online"
2018-02-04 13:42:45.851 (MQTT Discovery) 2c 22 70 61 79 6c 6f 61 64 5f 6e 6f 74 5f 61 76 61 69 6c 61 ,"payload_not_availa
2018-02-04 13:42:45.851 (MQTT Discovery) 62 6c 65 22 3a 22 4f 66 66 6c 69 6e 65 22 7d .. .. .. .. .. ble":"Offline"}
2018-02-04 13:42:45.852 (MQTT Discovery) Calling message handler 'onMessage'.
2018-02-04 13:42:45.852 (MQTT Discovery) onMessage called for connection: '127.0.0.1' type:'SUBACK' topic:'' payload:''
2018-02-04 13:42:45.852 (MQTT Discovery) Calling message handler 'onMessage'.
2018-02-04 13:42:45.852 (MQTT Discovery) onMessage called for connection: '127.0.0.1' type:'PUBLISH' topic:'tele/sonoff225/LWT' payload:'b'Online''
2018-02-04 13:42:45.853 (MQTT Discovery) tele/sonoff225/LWT
2018-02-04 13:42:45.853 (MQTT Discovery) getDevices key: '' configkey: '' value: '' config: '' topic: 'tele/sonoff225/LWT'
2018-02-04 13:42:45.853 (MQTT Discovery) getDevices found 1 devices
2018-02-04 13:42:45.854 (MQTT Discovery) Got state_topic
2018-02-04 13:42:45.854 (MQTT Discovery) TimedOut: '0'
2018-02-04 13:42:45.854 Error: (CDevice_update) MQTT Discovery - Verlichting Trap: Failed to parse parameters: 'nValue', 'sValue', 'Image', 'SignalLevel', 'BatteryLevel', 'Options', 'TimedOut', 'Name', 'TypeName', 'Type', 'Subtype', 'Switchtype' or 'Used' expected.
2018-02-04 13:42:45.854 Error: (MQTT Discovery) 'CDevice_update' failed 'TypeError':'Required argument 'nValue' (pos 1) not found'.
2018-02-04 13:42:45.854 (MQTT Discovery) Calling message handler 'onMessage'.
2018-02-04 13:42:45.855 (MQTT Discovery) onMessage called for connection: '127.0.0.1' type:'PUBLISH' topic:'homeassistant/switch/sonoffAFBDA8/config' payload:'b'{"name":"Sonoff Smart Socket 01","command_topic":"cmnd/sonoffAFBDA8/POWER","state_topic":"stat/sonoffAFBDA8/RESULT","value_template":"{{value_json.POWER}}","payload_off":"OFF","payload_on":"ON","availability_topic":"tele/sonoffAFBDA8/LWT","payload_available":"Online","payload_not_available":"Offline"}''
2018-02-04 13:42:45.855 (MQTT Discovery) homeassistant/switch/sonoffAFBDA8/config
2018-02-04 13:42:45.855 (MQTT Discovery) updateDeviceSettings devicename: 'sonoffAFBDA8' devicetype: 'switch' config: '{'payload_not_available': 'Offline', 'availability_topic': 'tele/sonoffAFBDA8/LWT', 'payload_available': 'Online', 'command_topic': 'cmnd/sonoffAFBDA8/POWER', 'payload_on': 'ON', 'payload_off': 'OFF', 'state_topic': 'stat/sonoffAFBDA8/RESULT', 'value_template': '{{value_json.POWER}}', 'name': 'Sonoff Smart Socket 01'}'
2018-02-04 13:42:45.855 (MQTT Discovery) getDevices key: 'devicename' configkey: '' value: 'sonoffAFBDA8' config: '' topic: ''
2018-02-04 13:42:45.855 (MQTT Discovery) getDevices found 1 devices
2018-02-04 13:42:45.855 (MQTT Discovery) Calling message handler 'onMessage'.
2018-02-04 13:42:45.856 (MQTT Discovery) onMessage called for connection: '127.0.0.1' type:'PUBLISH' topic:'homeassistant/switch/sonoff225/config' payload:'b'{"name":"Verlichting Trap","command_topic":"cmnd/sonoff225/POWER","state_topic":"stat/sonoff225/RESULT","value_template":"{{value_json.POWER}}","payload_off":"OFF","payload_on":"ON","availability_topic":"tele/sonoff225/LWT","payload_available":"Online","payload_not_available":"Offline"}''
2018-02-04 13:42:45.856 (MQTT Discovery) homeassistant/switch/sonoff225/config
2018-02-04 13:42:45.856 (MQTT Discovery) updateDeviceSettings devicename: 'sonoff225' devicetype: 'switch' config: '{'payload_not_available': 'Offline', 'availability_topic': 'tele/sonoff225/LWT', 'payload_available': 'Online', 'command_topic': 'cmnd/sonoff225/POWER', 'payload_on': 'ON', 'payload_off': 'OFF', 'state_topic': 'stat/sonoff225/RESULT', 'value_template': '{{value_json.POWER}}', 'name': 'Verlichting Trap'}'
2018-02-04 13:42:45.856 (MQTT Discovery) getDevices key: 'devicename' configkey: '' value: 'sonoff225' config: '' topic: ''
2018-02-04 13:42:45.856 (MQTT Discovery) getDevices found 1 devices
2018-02-04 13:42:55.126 (MQTT Discovery) Calling message handler 'onHeartbeat'.
2018-02-04 13:42:55.126 (MQTT Discovery) Heartbeating...
2018-02-04 13:42:55.126 (MQTT Discovery) MqttDevice::Ping
2018-02-04 13:42:55.126 (MQTT Discovery) Sending 2 bytes of data:
2018-02-04 13:42:55.127 (MQTT Discovery) c0 00 .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. �.
2018-02-04 13:42:55.177 (MQTT Discovery) Received 2 bytes of data:
2018-02-04 13:42:55.177 (MQTT Discovery) d0 00 .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. �.
2018-02-04 13:42:55.177 (MQTT Discovery) Calling message handler 'onMessage'.
2018-02-04 13:42:55.178 (MQTT Discovery) onMessage called for connection: '127.0.0.1' type:'PINGRESP' topic:'' payload:''
2018-02-04 13:42:59.112 (MySensors Gateway Ethernet) Temp (Aanvoer CV)
2018-02-04 13:42:59.138 (MySensors Gateway Ethernet) Temp (Retour CV)
2018-02-04 13:43:05.149 (MQTT Discovery) Calling message handler 'onHeartbeat'.
2018-02-04 13:43:05.149 (MQTT Discovery) Heartbeating...
2018-02-04 13:43:05.150 (MQTT Discovery) MqttDevice::Ping
2018-02-04 13:43:05.150 (MQTT Discovery) Sending 2 bytes of data:
2018-02-04 13:43:05.150 (MQTT Discovery) c0 00 .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. �.
2018-02-04 13:43:05.200 (MQTT Discovery) Received 2 bytes of data:
2018-02-04 13:43:05.201 (MQTT Discovery) d0 00 .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. �.
2018-02-04 13:43:05.201 (MQTT Discovery) Calling message handler 'onMessage'.
2018-02-04 13:43:05.201 (MQTT Discovery) onMessage called for connection: '127.0.0.1' type:'PINGRESP' topic:'' payload:'' 
Domoticz Beta V3.8875
Sonoff-Tasmota 5.11.1i
Reconos
Posts: 7
Joined: Wednesday 31 January 2018 14:26
Target OS: Windows
Domoticz version:
Contact:

Re: Python plugin: Sonoff-Tasmota + Other devices supporting MQTT Discovery

Post by Reconos »

emontnemery wrote: Sunday 04 February 2018 12:31 dnpwwo, I've tested with Python 3.6.4 on Windows, and I don't see the errors Reconos sees. How to debug?
Would it make sense to make a special build with debug prints in CPlugin::Callback to dump the pParams struct?

Reconos, maybe you can double check that Domoticz is actually using your Python 3.6.4 install, you should see something like this on the 'Status' tab in the log:

Code: Select all

2018-02-04 11:57:14.380 Domoticz V3.8873 (c)2012-2018 GizMoCuz
2018-02-04 11:57:14.383 Build Hash: 77d4f417, Date: 2018-01-31 15:50:27
2018-02-04 11:57:14.687 PluginSystem: Started, Python version '3.6.4'
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 
 2018-02-04 15:17:10.319 Build Hash: 3674fa59, Date: 2018-02-02 16:03:49 
 2018-02-04 15:17:10.360 EventSystem: reset all events... 
 2018-02-04 15:17:10.403 PluginSystem: Started, Python version '3.6.4'. 
 2018-02-04 15:17:10.420 WebServer(HTTP) started on address: :: with port 8080 
 2018-02-04 15:17:10.662 WebServer(SSL) started on address: :: with port 443 
 2018-02-04 15:17:10.664 Proxymanager started. 
 2018-02-04 15:17:10.666 TCPServer: shared server started... 
 2018-02-04 15:17:10.667 Incoming connection from: 10.0.0.100 
 2018-02-04 15:17:10.667 RxQueue: queue worker started... 
 2018-02-04 15:17:12.678 Wunderground: Worker started... 
 2018-02-04 15:17:12.678 EventSystem: reset all events... 
 2018-02-04 15:17:12.679 EventSystem: reset all device statuses... 
 2018-02-04 15:17:12.717 Python EventSystem: Initalizing event module. 
 2018-02-04 15:17:12.718 EventSystem: Started 
 2018-02-04 15:17:12.718 EventSystem: Queue thread started... 
 2018-02-04 15:17:12.878 PluginSystem: Entering work loop. 
 2018-02-04 15:17:12.891 RFLink: Using serial port: COM1 
 2018-02-04 15:17:13.712 MQTT: Connecting to localhost:1883 
 2018-02-04 15:17:13.818 MQTT: connected to: localhost:1883 
 2018-02-04 15:17:13.918 MQTT: Subscribed 
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest