generated from ludeeus/integration_blueprint
-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
97 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,6 +18,7 @@ | |
|
||
## v0.1.26 | ||
- Bump geckolib to 1.0.8 | ||
- Mr.Steam basic support | ||
|
||
## v0.1.25 | ||
- Bump geckolib to 1.0.7 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
"""Number platform for Gecko.""" | ||
|
||
import logging | ||
from typing import TYPE_CHECKING | ||
|
||
from homeassistant.components.number import NumberEntity | ||
from homeassistant.config_entries import ConfigEntry | ||
from homeassistant.core import HomeAssistant | ||
from homeassistant.helpers.entity_platform import AddEntitiesCallback | ||
|
||
from .const import DOMAIN, NUMBER | ||
from .entity import GeckoEntity | ||
|
||
if TYPE_CHECKING: | ||
from .spa_manager import GeckoSpaManager | ||
|
||
_LOGGER = logging.getLogger(__name__) | ||
|
||
|
||
async def async_setup_entry( | ||
hass: HomeAssistant, entry: ConfigEntry, async_add_entities: AddEntitiesCallback | ||
) -> None: | ||
"""Set up number platform.""" | ||
spaman: GeckoSpaManager = hass.data[DOMAIN][entry.entry_id] | ||
numbers: list = [] | ||
if ( | ||
spaman.can_use_facade | ||
and spaman.facade is not None | ||
and spaman.facade.mrsteam.is_available | ||
): | ||
numbers.append( | ||
GeckoNumber(spaman, entry, spaman.facade.mrsteam.user_runtime, None) | ||
) | ||
async_add_entities(numbers) | ||
spaman.platform_loaded(NUMBER) | ||
|
||
|
||
class GeckoNumber(GeckoEntity, NumberEntity): | ||
"""Gecko Date class.""" | ||
|
||
@property | ||
def native_value(self) -> float: | ||
"""Return the native value of the sensor.""" | ||
return self._automation_entity.native_value | ||
|
||
@property | ||
def native_min_value(self) -> float: | ||
"""Get the min value.""" | ||
return self._automation_entity.native_min_value | ||
|
||
@property | ||
def native_max_value(self) -> float: | ||
"""Get the max value.""" | ||
return self._automation_entity.native_max_value | ||
|
||
async def async_set_native_value(self, new_value: float) -> None: | ||
"""Set the value of the number entity.""" | ||
await self._automation_entity.async_set_native_value(new_value) | ||
|
||
@property | ||
def native_unit_of_measurement(self) -> str: | ||
"""Return the unit of measurement.""" | ||
return self._automation_entity.native_unit_of_measurement | ||
|
||
@property | ||
def device_class(self) -> str: | ||
"""Return the device class of the sensor.""" | ||
return "" # self._automation_entity.device_class |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters