Skip to content

Commit

Permalink
update deprecated syntax
Browse files Browse the repository at this point in the history
Signed-off-by: Travis Glenn Hansen <[email protected]>
  • Loading branch information
travisghansen committed Jan 30, 2023
1 parent 5382f30 commit 978db5e
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 13 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# v0.5.12

Released 2023-01-29

- update deprecated syntax

# v0.5.11

Released 2023-01-23
Expand Down
5 changes: 2 additions & 3 deletions custom_components/pfsense/binary_sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
import logging

from homeassistant.components.binary_sensor import (
DEVICE_CLASS_PROBLEM,
DEVICE_CLASS_UPDATE,
BinarySensorDeviceClass,
BinarySensorEntity,
BinarySensorEntityDescription,
)
Expand Down Expand Up @@ -126,7 +125,7 @@ def is_on(self):

@property
def device_class(self):
return DEVICE_CLASS_PROBLEM
return BinarySensorDeviceClass.PROBLEM

@property
def extra_state_attributes(self):
Expand Down
9 changes: 4 additions & 5 deletions custom_components/pfsense/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@
from typing import Final

from homeassistant.components.sensor import (
DEVICE_CLASS_TEMPERATURE,
DEVICE_CLASS_TIMESTAMP,
STATE_CLASS_MEASUREMENT,
SensorDeviceClass,
SensorEntityDescription,
)
from homeassistant.const import (
Expand Down Expand Up @@ -223,16 +222,16 @@
key="telemetry.system.temp",
name="System Temperature",
native_unit_of_measurement=TEMP_CELSIUS,
device_class=DEVICE_CLASS_TEMPERATURE,
device_class=SensorDeviceClass.TEMPERATURE,
icon="mdi:thermometer",
state_class=STATE_CLASS_MEASUREMENT,
# entity_category=ENTITY_CATEGORY_DIAGNOSTIC,
),
"telemetry.system.boottime": SensorEntityDescription(
key="telemetry.system.boottime",
name="System Boottime",
native_unit_of_measurement=TIME_SECONDS,
device_class=DEVICE_CLASS_TIMESTAMP,
# native_unit_of_measurement=TIME_SECONDS,
device_class=SensorDeviceClass.TIMESTAMP,
icon="mdi:clock-outline",
# entity_category=ENTITY_CATEGORY_DIAGNOSTIC,
),
Expand Down
10 changes: 5 additions & 5 deletions custom_components/pfsense/switch.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import logging

from homeassistant.components.switch import (
DEVICE_CLASS_SWITCH,
SwitchDeviceClass,
SwitchEntity,
SwitchEntityDescription,
)
Expand Down Expand Up @@ -43,7 +43,7 @@ def process_entities_callback(hass, config_entry):
# likely only want very specific rules to manipulate from actions
enabled_default = False
# entity_category = ENTITY_CATEGORY_CONFIG
device_class = DEVICE_CLASS_SWITCH
device_class = SwitchDeviceClass.SWITCH

if "tracker" not in rule.keys():
continue
Expand Down Expand Up @@ -87,7 +87,7 @@ def process_entities_callback(hass, config_entry):
# likely only want very specific rules to manipulate from actions
enabled_default = False
# entity_category = ENTITY_CATEGORY_CONFIG
device_class = DEVICE_CLASS_SWITCH
device_class = SwitchDeviceClass.SWITCH
tracker = dict_get(rule, "created.time")
if tracker is None:
continue
Expand Down Expand Up @@ -122,7 +122,7 @@ def process_entities_callback(hass, config_entry):
# likely only want very specific rules to manipulate from actions
enabled_default = False
# entity_category = ENTITY_CATEGORY_CONFIG
device_class = DEVICE_CLASS_SWITCH
device_class = SwitchDeviceClass.SWITCH
tracker = dict_get(rule, "created.time")
if tracker is None:
continue
Expand Down Expand Up @@ -157,7 +157,7 @@ def process_entities_callback(hass, config_entry):
# likely only want very specific services to manipulate from actions
enabled_default = False
# entity_category = ENTITY_CATEGORY_CONFIG
device_class = DEVICE_CLASS_SWITCH
device_class = SwitchDeviceClass.SWITCH

entity = PfSenseServiceSwitch(
config_entry,
Expand Down

0 comments on commit 978db5e

Please sign in to comment.