Skip to content

Commit

Permalink
Merge branch 'master' into valetudo-room-preferences
Browse files Browse the repository at this point in the history
  • Loading branch information
kylegordon committed Jul 11, 2024
2 parents 93d7e5e + 979c2ec commit 6244e13
Show file tree
Hide file tree
Showing 29 changed files with 1,049 additions and 189 deletions.
1 change: 1 addition & 0 deletions .HA_VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2024.5.5
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ secrets.yaml
known_devices.yaml
home-assistant.log
home-assistant_v2.db
.HA_VERSION
.uuid
emulated_hue_ids.json
deconz.conf
Expand Down
4 changes: 2 additions & 2 deletions custom_components/alexa_media/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -624,8 +624,8 @@ async def async_update_data() -> Optional[AlexaEntityData]:
_LOGGER.debug("Loading config entry for %s", component)
config_entry.async_create_task(
hass,
hass.config_entries.async_forward_entry_setup(
config_entry, component
hass.config_entries.async_forward_entry_setups(
config_entry, [component]
)
)
else:
Expand Down
2 changes: 1 addition & 1 deletion custom_components/alexa_media/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
PERCENTAGE,
)

__version__ = "4.10.2"
__version__ = "4.10.3"
PROJECT_URL = "https://github.com/alandtse/alexa_media_player/"
ISSUE_URL = f"{PROJECT_URL}issues"
NOTIFY_URL = f"{PROJECT_URL}wiki/Configuration%3A-Notification-Component#use-the-notifyalexa_media-service"
Expand Down
2 changes: 1 addition & 1 deletion custom_components/alexa_media/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@
"issue_tracker": "https://github.com/alandtse/alexa_media_player/issues",
"loggers": ["alexapy", "authcaptureproxy"],
"requirements": ["alexapy==1.27.10", "packaging>=20.3", "wrapt>=1.14.0"],
"version": "4.10.2"
"version": "4.10.3"
}
4 changes: 2 additions & 2 deletions custom_components/alexa_media/media_player.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,8 @@ async def async_setup_entry(hass, config_entry, async_add_devices):
)
config_entry.async_create_task(
hass,
hass.config_entries.async_forward_entry_setup(
config_entry, component
hass.config_entries.async_forward_entry_setups(
config_entry, [component]
)
)
return True
Expand Down
5 changes: 3 additions & 2 deletions custom_components/mypyllant/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from __future__ import annotations

import logging
from datetime import datetime as dt, timedelta
from datetime import datetime as dt, timedelta, datetime
import voluptuous as vol
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import Platform
Expand Down Expand Up @@ -133,6 +133,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)

async def handle_export(call: ServiceCall) -> ServiceResponse:
_LOGGER.debug("Exporting data with params %s", call.data)
return {
"export": await export.main(
user=username,
Expand Down Expand Up @@ -163,7 +164,7 @@ async def handle_report(call: ServiceCall) -> ServiceResponse:
password=password,
brand=brand,
country=country,
year=call.data.get("year"),
year=int(call.data.get("year", datetime.now().year)),
write_results=False,
)
}
Expand Down
82 changes: 79 additions & 3 deletions custom_components/mypyllant/binary_sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

from . import SystemCoordinator
from .const import DOMAIN
from .utils import EntityList
from .utils import EntityList, ZoneCoordinatorEntity

_LOGGER = logging.getLogger(__name__)

Expand All @@ -39,12 +39,20 @@ async def async_setup_entry(
sensors.append(lambda: ControlOnline(index, coordinator))
sensors.append(lambda: FirmwareUpdateRequired(index, coordinator))
sensors.append(lambda: FirmwareUpdateEnabled(index, coordinator))
for circuit_index, circuit in enumerate(system.circuits):
if system.eebus:
sensors.append(lambda: EebusEnabled(index, coordinator))
sensors.append(lambda: EebusCapable(index, coordinator))
for circuit_index, _ in enumerate(system.circuits):
sensors.append(
lambda: CircuitIsCoolingAllowed(index, circuit_index, coordinator)
)
for zone_index, zone in enumerate(system.zones):
if zone.is_manual_cooling_active is not None:
sensors.append(
lambda: ZoneIsManualCoolingActive(index, zone_index, coordinator)
)

async_add_entities(sensors)
async_add_entities(sensors) # type: ignore


class SystemControlEntity(CoordinatorEntity, BinarySensorEntity):
Expand Down Expand Up @@ -180,6 +188,60 @@ def unique_id(self) -> str:
return f"{DOMAIN}_{self.id_infix}_firmware_update_enabled"


class EebusCapable(SystemControlEntity):
_attr_icon = "mdi:check-network"

def __init__(
self,
system_index: int,
coordinator: SystemCoordinator,
):
super().__init__(system_index, coordinator)

@property
def is_on(self) -> bool | None:
return (
self.system.eebus.get("spine_capable", False)
if self.system.eebus
else False
)

@property
def name(self) -> str:
return f"{self.name_prefix} EEBUS Capable"

@property
def unique_id(self) -> str:
return f"{DOMAIN}_{self.id_infix}_eebus_capable"


class EebusEnabled(SystemControlEntity):
_attr_icon = "mdi:check-network"

def __init__(
self,
system_index: int,
coordinator: SystemCoordinator,
):
super().__init__(system_index, coordinator)

@property
def is_on(self) -> bool | None:
return (
self.system.eebus.get("spine_enabled", False)
if self.system.eebus
else False
)

@property
def name(self) -> str:
return f"{self.name_prefix} EEBUS Enabled"

@property
def unique_id(self) -> str:
return f"{DOMAIN}_{self.id_infix}_eebus_enabled"


class CircuitEntity(CoordinatorEntity, BinarySensorEntity):
def __init__(
self,
Expand Down Expand Up @@ -236,3 +298,17 @@ def name(self) -> str:
@property
def unique_id(self) -> str:
return f"{DOMAIN} {self.id_infix}_cooling_allowed"


class ZoneIsManualCoolingActive(ZoneCoordinatorEntity, BinarySensorEntity):
@property
def is_on(self) -> bool | None:
return self.zone.is_manual_cooling_active

@property
def name(self) -> str:
return f"{self.name_prefix} Manual Cooling Active"

@property
def unique_id(self) -> str:
return f"{DOMAIN} {self.id_infix}_manual_cooling_active"
Loading

0 comments on commit 6244e13

Please sign in to comment.