Add configuration URL to RainMachine (#57732)

pull/57984/head
Aaron Bach 2021-10-15 21:33:26 -06:00 committed by GitHub
parent 34fee4ba60
commit f13eeee969
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 8 additions and 6 deletions

View File

@ -323,6 +323,7 @@ class RainMachineEntity(CoordinatorEntity):
def __init__(
self,
entry: ConfigEntry,
coordinator: DataUpdateCoordinator,
controller: Controller,
description: EntityDescription,
@ -332,6 +333,7 @@ class RainMachineEntity(CoordinatorEntity):
self._attr_device_info = {
"identifiers": {(DOMAIN, controller.mac)},
"configuration_url": f"https://{entry.data[CONF_IP_ADDRESS]}:{entry.data[CONF_PORT]}",
"connections": {(dr.CONNECTION_NETWORK_MAC, controller.mac)},
"name": str(controller.name),
"manufacturer": "RainMachine",

View File

@ -131,7 +131,7 @@ async def async_setup_entry(
async_add_entities(
[
async_get_sensor(description.api_category)(controller, description)
async_get_sensor(description.api_category)(entry, controller, description)
for description in BINARY_SENSOR_DESCRIPTIONS
]
)

View File

@ -114,7 +114,7 @@ async def async_setup_entry(
async_add_entities(
[
async_get_sensor(description.api_category)(controller, description)
async_get_sensor(description.api_category)(entry, controller, description)
for description in SENSOR_DESCRIPTIONS
]
)

View File

@ -157,9 +157,9 @@ async def async_setup_entry(
entities: list[RainMachineProgram | RainMachineZone] = [
RainMachineProgram(
entry,
programs_coordinator,
controller,
entry,
RainMachineSwitchDescription(
key=f"RainMachineProgram_{uid}", name=program["name"], uid=uid
),
@ -169,9 +169,9 @@ async def async_setup_entry(
entities.extend(
[
RainMachineZone(
entry,
zones_coordinator,
controller,
entry,
RainMachineSwitchDescription(
key=f"RainMachineZone_{uid}", name=zone["name"], uid=uid
),
@ -191,13 +191,13 @@ class RainMachineSwitch(RainMachineEntity, SwitchEntity):
def __init__(
self,
entry: ConfigEntry,
coordinator: DataUpdateCoordinator,
controller: Controller,
entry: ConfigEntry,
description: RainMachineSwitchDescription,
) -> None:
"""Initialize a generic RainMachine switch."""
super().__init__(coordinator, controller, description)
super().__init__(entry, coordinator, controller, description)
self._attr_is_on = False
self._data = coordinator.data[self.entity_description.uid]