Tasmota data not stored as numbers

Hi,

I’m using Tasmota on a Wemos D1 to read out my power meter. On the same ESP is also a counter running for my gas meter. All values are not shown as numbers in Home Assistant. At the moment I created template sensors for each field to access the data as numbers. What could be the problem here? Other tasmota devices are working perfectly fine.

Thanks
Philipp

Welcome!

I think you need to ‘force’ a unit of measure on the sensor. Below is how I do this for some of my sensors that do not include units of measure. Apologies, that my example is a bit more complicated than is should be as I break out parts of my configuration in to ‘sub file’ under configuration.yaml. There are standard ‘units of measure’ in Home Assistant, however you can ‘make up’ your own for unique sensors such as my example for air quality, HA does not have a AQI measure (which is not really a SI measure or such, so I just create it by entering it here for the sensor). Good hunting!

# in my configuration.yaml file

  # Customization file
  customize: !include customize.yaml

# in my customize.yaml file:

sensor.waqi_ontario_route_60_near_road_san_bernardino_california:
  unit_of_measurement: "AQI"


All values in HA is stored as text
If there is a known unit attached, then it can be automatically converted to a number.
If you have no unit and need a number then you need to convert it when you retrieve it, but it is not always possible to do that, because some elements do not allow that in the input.

Thanks for the explanations!!

I added this to my configuration.yaml and the sensors behave now like numbers and the log will not log every change in the number.

homeassistant:
  customize:
    sensor.tasmota_mt631_total_out:
      unit_of_measurement: "kWh"
    sensor.tasmota_mt631_total_in:
      unit_of_measurement: "kWh"
    sensor.tasmota_mt631_power_cur:
      unit_of_measurement: "W"
    sensor.tasmota_counter_c1:
      unit_of_measurement: "pls"

I was wondering if the saving of the data as text could produce any performance issues, but if you say that it is always saved in the same way, it shouldn’t matter, I guess.

Many thanks again
Philipp