heinekmadsen / esphome_components

ESPHome custom_components
30 stars 39 forks source link

Wrong icon for the battery sensors #6

Closed mathias-jakobsen closed 2 years ago

mathias-jakobsen commented 2 years ago

Usually a battery sensor has a dynamic icon based on the current percentage. This is currently not the case with the wavin battery sensors as they have a fixed percentage icon. Is it possible to change this?

ssieb commented 2 years ago

You would have do something special on the HA side. esphome can only send an icon suggestion to it and that can't be changed at runtime.

mathias-jakobsen commented 2 years ago

Wouldn't HA be able to figure out the correct icons, if you only define the device class and omit the icon suggestion?

Line 29 in: https://github.com/heinekmadsen/esphome_components/tree/main/components/wavinAhc9000/climate/__init__.py cv.Optional(CONF_BATTERY_LEVEL): sensor.sensor_schema(UNIT_PERCENT, ICON_PERCENT, 0, DEVICE_CLASS_BATTERY)

to

cv.Optional(CONF_BATTERY_LEVEL): sensor.sensor_schema(unit_of_measurement=UNIT_PERCENT, accuracy_decimals=0, device_class=DEVICE_CLASS_BATTERY)

heinekmadsen commented 2 years ago

Works fine with Wavin Ahc 9000 v2 component