Hello,
i am trying to read WeeWX MQTT Topics.
partially it works, however I dont know where I am making the mistake.
Here My configuration.yaml
mqtt:
sensor:
- name: Outdoor_Temperature
state_topic: weather/outTemp_C
availability_topic: "weather/availability"
unique_id: uniqueid__weather_outtemp_c
value_template: "{{ value | round(1) }}"
unit_of_measurement: °C
icon: mdi:thermometer
device_class: temperature
- name: Indoor_Temperature
state_topic: weather/inTemp_C
availability_topic: "weather/availability"
unique_id: uniqueid__weather_intemp_c
value_template: "{{ value | round(1) }}"
unit_of_measurement: °C
icon: mdi:thermometer
device_class: temperature
- name: Wind_Speed_weewx
state_topic: "weather/windSpeed_kph"
availability_topic: "weather/availability"
unique_id: uniqueid__weather_windspeed_kph
value_template: “{{ value | round(1) }}”
unit_of_measurement: "km/h"
icon: mdi:weather-windy-variant
device_class: wind_speed
- name: Wind_Gust_weewx
state_topic: "weather/windGust_kph"
availability_topic: "weather/availability"
unique_id: uniqueid__weather_windgust_kph
value_template: “{{ value | round(1) }}”
unit_of_measurement: "km/h"
icon: mdi:weather-windy
device_class: wind_speed
and here the error log.
the first two - temperature sensors are working OK. the only problem is that I am not able to read Wind sensors.
Exception raised when updating state of sensor.wind_speed, topic: 'weather/windSpeed_kph' with payload: b'1.7702784000000003'
Exception raised when updating state of sensor.wind_gust, topic: 'weather/windGust_kph' with payload: b'1.7702784000000003'
Exception raised when updating state of sensor.wind_gust, topic: 'weather/windGust_kph' with payload: b'3.5405568000000005'
Exception raised when updating state of sensor.wind_speed, topic: 'weather/windSpeed_kph' with payload: b'2.0921472000000003'
Exception raised when updating state of sensor.wind_speed, topic: 'weather/windSpeed_kph' with payload: b'2.8968192000000004'
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 668, in state
numerical_value = float(value) # type:ignore[arg-type]
^^^^^^^^^^^^
ValueError: could not convert string to float: '“6.9”'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/mqtt/models.py", line 378, in process_write_state_requests
entity.async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 998, in async_write_ha_state
self._async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1119, in _async_write_ha_state
state, attr, capabilities, shadowed_attr = self.__async_calculate_state()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1056, in __async_calculate_state
state = self._stringify_state(available)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1004, in _stringify_state
if (state := self.state) is None:
^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 670, in state
raise ValueError(
ValueError: Sensor sensor.wind_speed has device class 'None', state class 'None' unit 'km/h' and suggested precision 'None' thus indicating it has a numeric value; however, it has the non-numeric value: '“6.9”' (<class 'str'>)
what is wrong with my configuration? I spent several hours to try different options, but nothing seems to be right.
Thank you,
Michal