Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mark sensors as diagnostic #86

Merged
merged 4 commits into from
Nov 22, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion custom_components/toyota/binary_sensor.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
"""Binary sensor platform for Toyota integration"""

from homeassistant.components.binary_sensor import (
DEVICE_CLASS_DOOR,
DEVICE_CLASS_LIGHT,
DEVICE_CLASS_PROBLEM,
DEVICE_CLASS_WINDOW,
BinarySensorEntity,
)
from homeassistant.const import ENTITY_CATEGORY_DIAGNOSTIC

from .const import (
DATA_COORDINATOR,
Expand Down Expand Up @@ -133,6 +133,7 @@ class ToyotaHoodBinarySensor(ToyotaBaseEntity, BinarySensorEntity):

_attr_device_class = DEVICE_CLASS_DOOR
_attr_icon = ICON_CAR_DOOR
_attr_entity_category = ENTITY_CATEGORY_DIAGNOSTIC

@property
def extra_state_attributes(self):
Expand All @@ -153,6 +154,7 @@ class ToyotaDoorBinarySensor(ToyotaBaseEntity, BinarySensorEntity):

_attr_device_class = DEVICE_CLASS_DOOR
_attr_icon = ICON_CAR_DOOR
_attr_entity_category = ENTITY_CATEGORY_DIAGNOSTIC

@property
def extra_state_attributes(self):
Expand Down Expand Up @@ -185,6 +187,7 @@ class ToyotaDoorLockBinarySensor(ToyotaBaseEntity, BinarySensorEntity):

_attr_device_class = DEVICE_CLASS_DOOR
_attr_icon = ICON_CAR_DOOR_LOCK
_attr_entity_category = ENTITY_CATEGORY_DIAGNOSTIC

@property
def extra_state_attributes(self):
Expand Down Expand Up @@ -216,6 +219,7 @@ class ToyotaKeyBinarySensor(ToyotaBaseEntity, BinarySensorEntity):
"""Class for key in car binary sensor"""

_attr_icon = ICON_KEY
_attr_entity_category = ENTITY_CATEGORY_DIAGNOSTIC

@property
def extra_state_attributes(self):
Expand All @@ -235,6 +239,7 @@ class ToyotaLightBinarySensor(ToyotaBaseEntity, BinarySensorEntity):

_attr_device_class = DEVICE_CLASS_LIGHT
_attr_icon = ICON_CAR_LIGHTS
_attr_entity_category = ENTITY_CATEGORY_DIAGNOSTIC

@property
def extra_state_attributes(self):
Expand Down Expand Up @@ -266,6 +271,7 @@ class ToyotaOverAllStatusBinarySensor(ToyotaBaseEntity, BinarySensorEntity):
"""Class for the overall warning sensor"""

_attr_device_class = DEVICE_CLASS_PROBLEM
_attr_entity_category = ENTITY_CATEGORY_DIAGNOSTIC
DurgNomis-drol marked this conversation as resolved.
Show resolved Hide resolved

@property
def extra_state_attributes(self):
Expand All @@ -286,6 +292,7 @@ class ToyotaWindowBinarySensor(ToyotaBaseEntity, BinarySensorEntity):
"""Class for Window sensor"""

_attr_device_class = DEVICE_CLASS_WINDOW
_attr_entity_category = ENTITY_CATEGORY_DIAGNOSTIC

@property
def extra_state_attributes(self):
Expand Down Expand Up @@ -320,6 +327,7 @@ class ToyotaFrontDefoggerSensor(ToyotaBaseEntity, BinarySensorEntity):
"""Class for HVAC sensor"""

_attr_icon = ICON_FRONT_DEFOGGER
_attr_entity_category = ENTITY_CATEGORY_DIAGNOSTIC
DurgNomis-drol marked this conversation as resolved.
Show resolved Hide resolved

@property
def is_on(self):
Expand All @@ -332,6 +340,7 @@ class ToyotaRearDefoggerSensor(ToyotaBaseEntity, BinarySensorEntity):
"""Class for HVAC sensor"""

_attr_icon = ICON_REAR_DEFOGGER
_attr_entity_category = ENTITY_CATEGORY_DIAGNOSTIC
DurgNomis-drol marked this conversation as resolved.
Show resolved Hide resolved

@property
def is_on(self):
Expand Down
2 changes: 2 additions & 0 deletions custom_components/toyota/entity.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from datetime import timedelta

from homeassistant.components.sensor import STATE_CLASS_MEASUREMENT, SensorEntity
from homeassistant.const import ENTITY_CATEGORY_DIAGNOSTIC
from homeassistant.helpers.update_coordinator import CoordinatorEntity

from .const import (
Expand Down Expand Up @@ -69,6 +70,7 @@ class StatisticsBaseEntity(ToyotaBaseEntity, SensorEntity):
"""Builds on Toyota base entity"""

_attr_icon = ICON_HISTORY
_attr_entity_category = ENTITY_CATEGORY_DIAGNOSTIC
rfvermut marked this conversation as resolved.
Show resolved Hide resolved

@property
def native_unit_of_measurement(self):
Expand Down
2 changes: 2 additions & 0 deletions custom_components/toyota/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

from homeassistant.const import (
DEVICE_CLASS_TEMPERATURE,
ENTITY_CATEGORY_DIAGNOSTIC,
PERCENTAGE,
STATE_UNAVAILABLE,
STATE_UNKNOWN,
Expand Down Expand Up @@ -88,6 +89,7 @@ class ToyotaCarSensor(ToyotaBaseEntity):
"""Class for car details and numberplate sensor."""

_attr_icon = ICON_CAR
_attr_entity_category = ENTITY_CATEGORY_DIAGNOSTIC

@property
def extra_state_attributes(self):
Expand Down