mirror of
https://github.com/home-assistant/core.git
synced 2025-07-21 20:27:08 +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 os
|
||||
|
||||
from batinfo import Batteries
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.sensor import PLATFORM_SCHEMA
|
||||
@ -72,15 +73,12 @@ class LinuxBatterySensor(Entity):
|
||||
|
||||
def __init__(self, name, battery_id, system):
|
||||
"""Initialize the battery sensor."""
|
||||
import batinfo
|
||||
|
||||
self._battery = batinfo.Batteries()
|
||||
self._battery = Batteries()
|
||||
|
||||
self._name = name
|
||||
self._battery_stat = None
|
||||
self._battery_id = battery_id - 1
|
||||
self._system = system
|
||||
self._unit_of_measurement = "%"
|
||||
|
||||
@property
|
||||
def name(self):
|
||||
@ -100,7 +98,7 @@ class LinuxBatterySensor(Entity):
|
||||
@property
|
||||
def unit_of_measurement(self):
|
||||
"""Return the unit the value is expressed in."""
|
||||
return self._unit_of_measurement
|
||||
return "%"
|
||||
|
||||
@property
|
||||
def device_state_attributes(self):
|
||||
|
Loading…
x
Reference in New Issue
Block a user