Skip to content

Commit

Permalink
Add icons to Teslemetry (home-assistant#112546)
Browse files Browse the repository at this point in the history
  • Loading branch information
Bre77 authored and xeniter committed Mar 13, 2024
1 parent 2d9cb7d commit 30b3eb8
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 50 deletions.
53 changes: 53 additions & 0 deletions homeassistant/components/teslemetry/icons.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,59 @@
}
}
}
},
"sensor": {
"battery_power": {
"default": "mdi:home-battery"
},
"drive_state_active_route_destination": {
"default": "mdi:routes"
},
"drive_state_active_route_minutes_to_arrival": {
"default": "mdi:routes-clock"
},
"drive_state_shift_state": {
"default": "mdi:car-shift-pattern",
"state": {
"d": "mdi:alpha-d",
"n": "mdi:alpha-n",
"p": "mdi:alpha-p",
"r": "mdi:alpha-r"
}
},
"energy_left": {
"default": "mdi:battery"
},
"generator_power": {
"default": "mdi:generator-stationary"
},
"grid_power": {
"default": "mdi:transmission-tower"
},
"grid_services_power": {
"default": "mdi:transmission-tower"
},
"load_power": {
"default": "mdi:power-plug"
},
"solar_power": {
"default": "mdi:solar-power"
},
"total_pack_energy": {
"default": "mdi:battery-high"
},
"vin": {
"default": "mdi:car-electric"
},
"wall_connector_fault_state": {
"default": "mdi:ev-station"
},
"wall_connector_power": {
"default": "mdi:ev-station"
},
"wall_connector_state": {
"default": "mdi:ev-station"
}
}
}
}
14 changes: 0 additions & 14 deletions homeassistant/components/teslemetry/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,6 @@ class TeslemetrySensorEntityDescription(SensorEntityDescription):
),
TeslemetrySensorEntityDescription(
key="drive_state_shift_state",
icon="mdi:car-shift-pattern",
options=["p", "d", "r", "n"],
device_class=SensorDeviceClass.ENUM,
value_fn=lambda x: x.lower() if isinstance(x, str) else x,
Expand Down Expand Up @@ -243,7 +242,6 @@ class TeslemetrySensorEntityDescription(SensorEntityDescription):
),
TeslemetrySensorEntityDescription(
key="drive_state_active_route_destination",
icon="mdi:map-marker",
entity_category=EntityCategory.DIAGNOSTIC,
),
)
Expand All @@ -256,7 +254,6 @@ class TeslemetrySensorEntityDescription(SensorEntityDescription):
suggested_unit_of_measurement=UnitOfPower.KILO_WATT,
suggested_display_precision=2,
device_class=SensorDeviceClass.POWER,
icon="mdi:solar-power",
),
SensorEntityDescription(
key="energy_left",
Expand All @@ -266,7 +263,6 @@ class TeslemetrySensorEntityDescription(SensorEntityDescription):
suggested_display_precision=2,
device_class=SensorDeviceClass.ENERGY_STORAGE,
entity_category=EntityCategory.DIAGNOSTIC,
icon="mdi:battery",
),
SensorEntityDescription(
key="total_pack_energy",
Expand All @@ -276,7 +272,6 @@ class TeslemetrySensorEntityDescription(SensorEntityDescription):
suggested_display_precision=2,
device_class=SensorDeviceClass.ENERGY_STORAGE,
entity_category=EntityCategory.DIAGNOSTIC,
icon="mdi:battery-high",
entity_registry_enabled_default=False,
),
SensorEntityDescription(
Expand All @@ -293,7 +288,6 @@ class TeslemetrySensorEntityDescription(SensorEntityDescription):
suggested_unit_of_measurement=UnitOfPower.KILO_WATT,
suggested_display_precision=2,
device_class=SensorDeviceClass.POWER,
icon="mdi:home-battery",
),
SensorEntityDescription(
key="load_power",
Expand All @@ -302,7 +296,6 @@ class TeslemetrySensorEntityDescription(SensorEntityDescription):
suggested_unit_of_measurement=UnitOfPower.KILO_WATT,
suggested_display_precision=2,
device_class=SensorDeviceClass.POWER,
icon="mdi:power-plug",
),
SensorEntityDescription(
key="grid_power",
Expand All @@ -311,7 +304,6 @@ class TeslemetrySensorEntityDescription(SensorEntityDescription):
suggested_unit_of_measurement=UnitOfPower.KILO_WATT,
suggested_display_precision=2,
device_class=SensorDeviceClass.POWER,
icon="mdi:transmission-tower",
),
SensorEntityDescription(
key="grid_services_power",
Expand All @@ -320,7 +312,6 @@ class TeslemetrySensorEntityDescription(SensorEntityDescription):
suggested_unit_of_measurement=UnitOfPower.KILO_WATT,
suggested_display_precision=2,
device_class=SensorDeviceClass.POWER,
icon="mdi:transmission-tower",
),
SensorEntityDescription(
key="generator_power",
Expand All @@ -329,7 +320,6 @@ class TeslemetrySensorEntityDescription(SensorEntityDescription):
suggested_unit_of_measurement=UnitOfPower.KILO_WATT,
suggested_display_precision=2,
device_class=SensorDeviceClass.POWER,
icon="mdi:generator-stationary",
entity_registry_enabled_default=False,
),
)
Expand All @@ -339,13 +329,11 @@ class TeslemetrySensorEntityDescription(SensorEntityDescription):
key="wall_connector_state",
entity_category=EntityCategory.DIAGNOSTIC,
entity_registry_enabled_default=False,
icon="mdi:ev-station",
),
SensorEntityDescription(
key="wall_connector_fault_state",
entity_category=EntityCategory.DIAGNOSTIC,
entity_registry_enabled_default=False,
icon="mdi:ev-station",
),
SensorEntityDescription(
key="wall_connector_power",
Expand All @@ -354,11 +342,9 @@ class TeslemetrySensorEntityDescription(SensorEntityDescription):
suggested_unit_of_measurement=UnitOfPower.KILO_WATT,
suggested_display_precision=2,
device_class=SensorDeviceClass.POWER,
icon="mdi:ev-station",
),
SensorEntityDescription(
key="vin",
icon="mdi:car-electric",
),
)

Expand Down
Loading

0 comments on commit 30b3eb8

Please sign in to comment.