home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
71.16k stars 29.83k forks source link

MQTT problems / mqtt discovery not working anymore? #15919

Closed fluppie closed 6 years ago

fluppie commented 6 years ago

Home Assistant release with the issue:

0.75.3

Last working Home Assistant release (if known):

0.72

Operating environment (Hass.io/Docker/Windows/etc.):

hassbian release

Component/platform:

MQTT

Description of problem:

Around version 0.72 I would use the Sonoff Tasmota firmware 6.0.0a for adding sensors/switches to Home Assistant using MQTT discovery. As I upgraded to the latest version, I cannot add new sensors to Home Assistant. I see parse errors in the log files. Did something change in the MQTT component between 0.72 and today?

Problem-relevant configuration.yaml entries and (fill out even if it seems unimportant):

No entries as they were auto-discovered in the past.

Traceback (if applicable):

Additional information:

Copy/paste of the log:

2018-08-10 12:11:52 ERROR (MainThread) [homeassistant.core] Error doing job: Exception in callback MQTT._mqtt_handle_message(<paho.mqtt.cl...at 0x53569fb0>) Traceback (most recent call last):
 File "/usr/lib/python3.5/asyncio/events.py", line 126, in _run self._callback(*self._args)
 File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/components/mqtt/__init__.py", line 679, in _mqtt_handle_message msg.topic, payload, msg.qos)
 File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/core.py", line 300, in async_run_job target(*args)
 File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/components/light/mqtt.py", line 273, in rgb_received self._hs = color_util.color_RGB_to_hs(*rgb)
 TypeError: color_RGB_to_hs() takes 3 positional arguments but 5 were given 
2018-08-10 12:11:54 ERROR (MainThread) [homeassistant.core] Error doing job: Exception in callback MQTT._mqtt_handle_message(<paho.mqtt.cl...at 0x5d258f70>) Traceback (most recent call last):
 File "/usr/lib/python3.5/asyncio/events.py", line 126, in _run self._callback(*self._args)
 File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/components/mqtt/__init__.py", line 679, in _mqtt_handle_message msg.topic, payload, msg.qos)
 File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/core.py", line 300, in async_run_job target(*args)
 File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/components/light/mqtt.py", line 273, in rgb_received self._hs = color_util.color_RGB_to_hs(*rgb)
 TypeError: color_RGB_to_hs() takes 3 positional arguments but 5 were given 
2018-08-10 12:12:01 ERROR (MainThread) [homeassistant.core] Error doing job: Exception in callback MQTT._mqtt_handle_message(<paho.mqtt.cl...at 0x535a9bb0>) Traceback (most recent call last):
 File "/usr/lib/python3.5/asyncio/events.py", line 126, in _run self._callback(*self._args)
 File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/components/mqtt/__init__.py", line 679, in _mqtt_handle_message msg.topic, payload, msg.qos)
 File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/core.py", line 300, in async_run_job target(*args)
 File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/components/light/mqtt.py", line 250, in brightness_received device_value = float(templates[CONF_BRIGHTNESS](payload))
 ValueError: could not convert string to float: 
2018-08-10 12:12:01 ERROR (MainThread) [homeassistant.core] Error doing job: Exception in callback MQTT._mqtt_handle_message(<paho.mqtt.cl...at 0x53569d70>) Traceback (most recent call last):
 File "/usr/lib/python3.5/asyncio/events.py", line 126, in _run self._callback(*self._args)
 File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/components/mqtt/__init__.py", line 679, in _mqtt_handle_message msg.topic, payload, msg.qos)
 File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/core.py", line 300, in async_run_job target(*args)
 File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/components/light/mqtt.py", line 250, in brightness_received device_value = float(templates[CONF_BRIGHTNESS](payload))
 ValueError: could not convert string to float: 
2018-08-10 12:12:12 ERROR (MainThread) [homeassistant.core] Error doing job: Exception in callback MQTT._mqtt_handle_message(<paho.mqtt.cl...at 0x5d258770>) Traceback (most recent call last): File "/usr/lib/python3.5/asyncio/events.py", line 126, in _run self._callback(*self._args) File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/components/mqtt/__init__.py", line 679, in _mqtt_handle_message msg.topic, payload, msg.qos) File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/core.py", line 300, in async_run_job target(*args) File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/components/light/mqtt.py", line 273, in rgb_received self._hs = color_util.color_RGB_to_hs(*rgb) TypeError: color_RGB_to_hs() takes 3 positional arguments but 5 were given 
2018-08-10 12:12:20 ERROR (MainThread) [homeassistant.core] Error doing job: Exception in callback MQTT._mqtt_handle_message(<paho.mqtt.cl...at 0x541d1630>) Traceback (most recent call last): File "/usr/lib/python3.5/asyncio/events.py", line 126, in _run self._callback(*self._args) File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/components/mqtt/__init__.py", line 679, in _mqtt_handle_message msg.topic, payload, msg.qos) File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/core.py", line 300, in async_run_job target(*args) File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/components/light/mqtt.py", line 250, in brightness_received device_value = float(templates[CONF_BRIGHTNESS](payload)) ValueError: could not convert string to float: 
2018-08-10 12:22:03 ERROR (MainThread) [homeassistant.core] Error doing job: Exception in callback MQTT._mqtt_handle_message(<paho.mqtt.cl...at 0x6853a870>) Traceback (most recent call last): File "/usr/lib/python3.5/asyncio/events.py", line 126, in _run self._callback(*self._args) File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/components/mqtt/__init__.py", line 679, in _mqtt_handle_message msg.topic, payload, msg.qos) File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/core.py", line 300, in async_run_job target(*args) File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/components/light/mqtt.py", line 250, in brightness_received device_value = float(templates[CONF_BRIGHTNESS](payload)) ValueError: could not convert string to float: 
2018-08-10 12:22:45 ERROR (MainThread) [homeassistant.core] Error doing job: Exception in callback MQTT._mqtt_handle_message(<paho.mqtt.cl...at 0x53569f30>) Traceback (most recent call last): File "/usr/lib/python3.5/asyncio/events.py", line 126, in _run self._callback(*self._args) File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/components/mqtt/__init__.py", line 679, in _mqtt_handle_message msg.topic, payload, msg.qos) File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/core.py", line 300, in async_run_job target(*args) File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/components/light/mqtt.py", line 250, in brightness_received device_value = float(templates[CONF_BRIGHTNESS](payload)) ValueError: could not convert string to float: 
2018-08-10 12:24:22 ERROR (MainThread) [homeassistant.core] Error doing job: Exception in callback MQTT._mqtt_handle_message(<paho.mqtt.cl...at 0x66b34db0>) Traceback (most recent call last): File "/usr/lib/python3.5/asyncio/events.py", line 126, in _run self._callback(*self._args) File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/components/mqtt/__init__.py", line 679, in _mqtt_handle_message msg.topic, payload, msg.qos) File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/core.py", line 300, in async_run_job target(*args) File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/components/light/mqtt.py", line 250, in brightness_received device_value = float(templates[CONF_BRIGHTNESS](payload)) ValueError: could not convert string to float: 
2018-08-10 12:24:25 ERROR (MainThread) [homeassistant.core] Error doing job: Exception in callback MQTT._mqtt_handle_message(<paho.mqtt.cl...at 0x5fa8b030>) Traceback (most recent call last): File "/usr/lib/python3.5/asyncio/events.py", line 126, in _run self._callback(*self._args) File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/components/mqtt/__init__.py", line 679, in _mqtt_handle_message msg.topic, payload, msg.qos) File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/core.py", line 300, in async_run_job target(*args) File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/components/light/mqtt.py", line 250, in brightness_received device_value = float(templates[CONF_BRIGHTNESS](payload)) ValueError: could not convert string to float: 
2018-08-10 12:24:58 ERROR (MainThread) [homeassistant.core] Error doing job: Exception in callback MQTT._mqtt_handle_message(<paho.mqtt.cl...at 0x53569f30>) Traceback (most recent call last): File "/usr/lib/python3.5/asyncio/events.py", line 126, in _run self._callback(*self._args) File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/components/mqtt/__init__.py", line 679, in _mqtt_handle_message msg.topic, payload, msg.qos) File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/core.py", line 300, in async_run_job target(*args) File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/components/light/mqtt.py", line 250, in brightness_received device_value = float(templates[CONF_BRIGHTNESS](payload)) ValueError: could not convert string to float: 
2018-08-10 12:25:00 ERROR (MainThread) [homeassistant.core] Error doing job: Exception in callback MQTT._mqtt_handle_message(<paho.mqtt.cl...at 0x62c4bef0>) Traceback (most recent call last): File "/usr/lib/python3.5/asyncio/events.py", line 126, in _run self._callback(*self._args) File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/components/mqtt/__init__.py", line 679, in _mqtt_handle_message msg.topic, payload, msg.qos) File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/core.py", line 300, in async_run_job target(*args) File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/components/light/mqtt.py", line 250, in brightness_received device_value = float(templates[CONF_BRIGHTNESS](payload)) ValueError: could not convert string to float: 
2018-08-10 12:27:29 WARNING (MainThread) [homeassistant.components.mqtt.discovery] Unable to parse JSON wemosd1mini_test_1: 
2018-08-10 12:27:29 WARNING (MainThread) [homeassistant.components.mqtt.discovery] Unable to parse JSON wemosd1mini_test_1: 
2018-08-10 12:27:29 WARNING (MainThread) [homeassistant.components.mqtt.discovery] Unable to parse JSON wemosd1mini_test_2: 
2018-08-10 12:27:29 WARNING (MainThread) [homeassistant.components.mqtt.discovery] Unable to parse JSON wemosd1mini_test_2: 
2018-08-10 12:27:29 WARNING (MainThread) [homeassistant.components.mqtt.discovery] Unable to parse JSON wemosd1mini_test_3: 
2018-08-10 12:27:29 WARNING (MainThread) [homeassistant.components.mqtt.discovery] Unable to parse JSON wemosd1mini_test_3: 
2018-08-10 12:27:29 WARNING (MainThread) [homeassistant.components.mqtt.discovery] Unable to parse JSON wemosd1mini_test_4: 
2018-08-10 12:27:29 WARNING (MainThread) [homeassistant.components.mqtt.discovery] Unable to parse JSON wemosd1mini_test_4: 
2018-08-10 12:27:29 WARNING (MainThread) [homeassistant.components.mqtt.discovery] Unable to parse JSON wemosd1mini_test_5: 
2018-08-10 12:27:29 WARNING (MainThread) [homeassistant.components.mqtt.discovery] Unable to parse JSON wemosd1mini_test_5: 
2018-08-10 12:27:29 WARNING (MainThread) [homeassistant.components.mqtt.discovery] Unable to parse JSON wemosd1mini_test_6: 
2018-08-10 12:27:29 WARNING (MainThread) [homeassistant.components.mqtt.discovery] Unable to parse JSON wemosd1mini_test_6: 
2018-08-10 12:27:29 WARNING (MainThread) [homeassistant.components.mqtt.discovery] Unable to parse JSON wemosd1mini_test_7: 
2018-08-10 12:27:29 WARNING (MainThread) [homeassistant.components.mqtt.discovery] Unable to parse JSON wemosd1mini_test_7: 
2018-08-10 12:27:29 WARNING (MainThread) [homeassistant.components.mqtt.discovery] Unable to parse JSON wemosd1mini_test_8: 
2018-08-10 12:27:29 WARNING (MainThread) [homeassistant.components.mqtt.discovery] Unable to parse JSON wemosd1mini_test_8: 
fluppie commented 6 years ago

Okay, detecting a switch/relay seems to work, only it doesn't accept the sensors. I used an older Tasmota version to check if it was the newer 6.xxxx version. Log file from the Tasmota module:

00:00:00 Project sonoff bme680_1_5140 (Topic bme680_1_5140, Fallback DVES_1BAB51, GroupTopic sonoffs) Version 5.14.0-2_4_1
00:00:00 WIF: Connecting to AP1 WiFi2016AP1 in mode 11N as bme680_1_5140-2897...
00:00:05 WIF: Connected
00:00:05 DNS: Initialized
00:00:05 HTP: Web server active on bme680_1_5140-2897.local with IP address 192.168.1.58
00:00:06 MQT: Attempting connection...
00:00:06 MQT: Connected
00:00:06 MQT: tele/bme680_1_5140/LWT = Online (retained)
00:00:06 MQT: cmnd/bme680_1_5140/POWER = 
00:00:06 MQT: tele/bme680_1_5140/INFO1 = {"Module":"Generic","Version":"5.14.0","FallbackTopic":"DVES_1BAB51","GroupTopic":"sonoffs"}
00:00:06 MQT: tele/bme680_1_5140/INFO2 = {"WebServerMode":"Admin","Hostname":"bme680_1_5140-2897","IPAddress":"192.168.1.58"}
00:00:06 MQT: tele/bme680_1_5140/INFO3 = {"RestartReason":"External System"}
00:00:06 MQT: homeassistant/light/bme680_1_5140_1/config =  (retained)
00:00:06 MQT: homeassistant/switch/bme680_1_5140_1/config = {"name":"bme680_1_5140","command_topic":"cmnd/bme680_1_5140/POWER","state_topic":"stat/bme680_1_5140/RESULT","value_template":"{{value_json.POWER}}","payload_off":"OFF","payload_on":"ON","availability_topic":"tele/bme680_1_5140/LWT","payload_available":"Online","payload_not_available":"Offline"} (retained)
00:00:06 MQT: homeassistant/light/bme680_1_5140_2/config =  (retained)
00:00:06 MQT: homeassistant/switch/bme680_1_5140_2/config =  (retained)
00:00:06 MQT: homeassistant/light/bme680_1_5140_3/config =  (retained)
00:00:06 MQT: homeassistant/switch/bme680_1_5140_3/config =  (retained)
00:00:06 MQT: homeassistant/light/bme680_1_5140_4/config =  (retained)
00:00:06 MQT: homeassistant/switch/bme680_1_5140_4/config =  (retained)
00:00:06 MQT: homeassistant/light/bme680_1_5140_5/config =  (retained)
00:00:06 MQT: homeassistant/switch/bme680_1_5140_5/config =  (retained)
00:00:06 MQT: homeassistant/light/bme680_1_5140_6/config =  (retained)
00:00:06 MQT: homeassistant/switch/bme680_1_5140_6/config =  (retained)
00:00:06 MQT: homeassistant/light/bme680_1_5140_7/config =  (retained)
00:00:06 MQT: homeassistant/switch/bme680_1_5140_7/config =  (retained)
00:00:06 MQT: homeassistant/light/bme680_1_5140_8/config =  (retained)
00:00:06 MQT: homeassistant/switch/bme680_1_5140_8/config =  (retained)
13:30:30 MQT: stat/bme680_1_5140/RESULT = {"POWER":"OFF"}
13:30:30 MQT: stat/bme680_1_5140/POWER = OFF
13:30:38 MQT: tele/bme680_1_5140/STATE = {"Time":"2018-08-12T13:30:38","Uptime":"0T00:00:15","Vcc":2.974,"POWER":"OFF","Wifi":{"AP":1,"SSId":"WiFi2016AP1","RSSI":82,"APMac":"78:8A:20:5A:41:76"}}
13:30:38 MQT: tele/bme680_1_5140/SENSOR = {"Time":"2018-08-12T13:30:38","AM2301":{"Temperature":20.2,"Humidity":1.0},"BME680":{"Temperature":25.8,"Humidity":43.9,"Pressure":1012.7,"Gas":0.00},"TempUnit":"C"}
kukachik commented 6 years ago

Check tasmota command

SetOption30 | 1 / on | Enforce Home-Assistant discovery for light group only

Tasmota auto dicsovery support only switch/light components.

fabaff commented 6 years ago

This seems to be a Tasmota issue and needs to be addressed there as MQTT discovery is working fine for other implementation.