Skip to content

Commit

Permalink
Set flood sensor temperature units (#258)
Browse files Browse the repository at this point in the history
* 257: Set native_value and native_unit_of_measurement for flood sensors
  • Loading branch information
sebr authored Aug 14, 2024
1 parent 9b476b2 commit f48279e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion custom_components/bhyve/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@
"documentation": "https://github.com/sebr/bhyve-home-assistant/blob/main/README.md",
"iot_class": "cloud_push",
"requirements": [],
"version": "3.2.4"
"version": "3.2.5-beta0"
}
13 changes: 7 additions & 6 deletions custom_components/bhyve/sensor.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
"""Support for Orbit BHyve sensors."""

import logging
from datetime import timedelta
import logging

from homeassistant.components.sensor import SensorDeviceClass
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import ATTR_BATTERY_LEVEL
from homeassistant.const import ATTR_BATTERY_LEVEL, SensorStateClass, UnitOfTemperature
from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity import EntityCategory
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from homeassistant.helpers.icon import icon_for_battery_level

from homeassistant.components.sensor import SensorDeviceClass

from . import BHyveDeviceEntity
from .const import (
CONF_CLIENT,
Expand Down Expand Up @@ -343,9 +342,11 @@ def __init__(self, hass, bhyve, device):
)

def _setup(self, device):
self._state = device.get("status", {}).get("temp_f")
self._available = device.get("is_connected", False)
self._unit = "°F"
self._native_value = device.get("status", {}).get("temp_f")
self._native_unit_of_measurement = UnitOfTemperature.FAHRENHEIT
self._state_class = SensorStateClass.MEASUREMENT

self._attrs = {
"location": device.get("location_name"),
"rssi": device.get("status", {}).get("rssi"),
Expand Down

0 comments on commit f48279e

Please sign in to comment.