Homematic icon map / upper case on services (#6178)
* Set upper on service / add sensor icon mapper * Add more icons * fix id
This commit is contained in:
1 parent
89807f24ad
commit
b725eaf67f
2 files changed
+30
-15
No files matched your search
@@ -40,7 +40,17 @@ HM_UNIT_HA_CAST = {
|
||||
"SUNSHINEDURATION": "#",
|
||||
"AIR_PRESSURE": "hPa",
|
||||
"FREQUENCY": "Hz",
|
||||
"VALUE": "#"
|
||||
"VALUE": "#",
|
||||
}
|
||||
|
||||
HM_ICON_HA_CAST = {
|
||||
"WIND_SPEED": 'mdi:weather-windy',
|
||||
"HUMIDITY": 'mdi:water-percent',
|
||||
"TEMPERATURE": 'mdi:thermometer',
|
||||
"LUX": 'mdi:weather-sunny',
|
||||
"BRIGHTNESS": 'mdi:invert-colors',
|
||||
"POWER": 'mdi:flash-red-eye',
|
||||
"CURRENT": "mdi:flash-red-eye",
|
||||
}
|
||||
|
||||
|
||||
@@ -77,6 +87,11 @@ class HMSensor(HMDevice):
|
||||
"""Return the unit of measurement of this entity, if any."""
|
||||
return HM_UNIT_HA_CAST.get(self._state, None)
|
||||
|
||||
@property
|
||||
def icon(self):
|
||||
"""Return the icon to use in the frontend, if any."""
|
||||
return HM_ICON_HA_CAST.get(self._state, None)
|
||||
|
||||
def _init_data_struct(self):
|
||||
"""Generate a data dict (self._data) from hm metadata."""
|
||||
# Add state to data dict
|
||||
|
||||
Reference in new issue
Block a user