mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 05:07:41 +00:00
Move imports in linux_battery component (#27789)
This commit is contained in:
parent
35e0acf0a5
commit
9f71384524
@ -2,6 +2,7 @@
|
|||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
|
|
||||||
|
from batinfo import Batteries
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.components.sensor import PLATFORM_SCHEMA
|
from homeassistant.components.sensor import PLATFORM_SCHEMA
|
||||||
@ -72,15 +73,12 @@ class LinuxBatterySensor(Entity):
|
|||||||
|
|
||||||
def __init__(self, name, battery_id, system):
|
def __init__(self, name, battery_id, system):
|
||||||
"""Initialize the battery sensor."""
|
"""Initialize the battery sensor."""
|
||||||
import batinfo
|
self._battery = Batteries()
|
||||||
|
|
||||||
self._battery = batinfo.Batteries()
|
|
||||||
|
|
||||||
self._name = name
|
self._name = name
|
||||||
self._battery_stat = None
|
self._battery_stat = None
|
||||||
self._battery_id = battery_id - 1
|
self._battery_id = battery_id - 1
|
||||||
self._system = system
|
self._system = system
|
||||||
self._unit_of_measurement = "%"
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def name(self):
|
def name(self):
|
||||||
@ -100,7 +98,7 @@ class LinuxBatterySensor(Entity):
|
|||||||
@property
|
@property
|
||||||
def unit_of_measurement(self):
|
def unit_of_measurement(self):
|
||||||
"""Return the unit the value is expressed in."""
|
"""Return the unit the value is expressed in."""
|
||||||
return self._unit_of_measurement
|
return "%"
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def device_state_attributes(self):
|
def device_state_attributes(self):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user