Skip to content
This repository has been archived by the owner on Jul 1, 2023. It is now read-only.

Commit

Permalink
Add unit of measurement for battery sensor (#18)
Browse files Browse the repository at this point in the history
* Add unit of measurement for battery sensor

* Update sensor.py
  • Loading branch information
mountainsandcode authored Oct 13, 2020
1 parent d52efc5 commit 81fcb23
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion custom_components/fullykiosk/sensor.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""Fully Kiosk Browser sensor."""
import logging

from homeassistant.const import DEVICE_CLASS_BATTERY
from homeassistant.const import DEVICE_CLASS_BATTERY, PERCENTAGE
from homeassistant.helpers.entity import Entity

from .const import DOMAIN, COORDINATOR
Expand Down Expand Up @@ -53,6 +53,12 @@ def device_class(self):
return DEVICE_CLASS_BATTERY
return None

@property
def unit_of_measurement(self):
if self._sensor == "batteryLevel":
return PERCENTAGE
return None

@property
def device_info(self):
return {
Expand Down

0 comments on commit 81fcb23

Please sign in to comment.