Bump aioautomower to 2024.9.1 (#126315)

pull/126319/head
Thomas55555 2024-09-20 12:40:16 +02:00 committed by GitHub
parent cd95c133af
commit f93bcbaa84
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 30 additions and 20 deletions

View File

@ -3,6 +3,8 @@
from datetime import datetime from datetime import datetime
import logging import logging
from aioautomower.model import make_name_string
from homeassistant.components.calendar import CalendarEntity, CalendarEvent from homeassistant.components.calendar import CalendarEntity, CalendarEvent
from homeassistant.core import HomeAssistant from homeassistant.core import HomeAssistant
from homeassistant.exceptions import HomeAssistantError from homeassistant.exceptions import HomeAssistantError
@ -54,8 +56,13 @@ class AutomowerCalendarEntity(AutomowerBaseEntity, CalendarEntity):
_LOGGER.debug("program_event %s", program_event) _LOGGER.debug("program_event %s", program_event)
if not program_event: if not program_event:
return None return None
work_area_name = None
if self.mower_attributes.work_area_dict and program_event.work_area_id:
work_area_name = self.mower_attributes.work_area_dict[
program_event.work_area_id
]
return CalendarEvent( return CalendarEvent(
summary=program_event.schedule_name, summary=make_name_string(work_area_name, program_event.schedule_no),
start=program_event.start.replace(tzinfo=dt_util.DEFAULT_TIME_ZONE), start=program_event.start.replace(tzinfo=dt_util.DEFAULT_TIME_ZONE),
end=program_event.end.replace(tzinfo=dt_util.DEFAULT_TIME_ZONE), end=program_event.end.replace(tzinfo=dt_util.DEFAULT_TIME_ZONE),
rrule=program_event.rrule_str, rrule=program_event.rrule_str,
@ -75,12 +82,19 @@ class AutomowerCalendarEntity(AutomowerBaseEntity, CalendarEntity):
start_date, start_date,
end_date, end_date,
) )
return [ calendar_events = []
CalendarEvent( for program_event in cursor:
summary=program_event.schedule_name, work_area_name = None
start=program_event.start.replace(tzinfo=start_date.tzinfo), if self.mower_attributes.work_area_dict and program_event.work_area_id:
end=program_event.end.replace(tzinfo=start_date.tzinfo), work_area_name = self.mower_attributes.work_area_dict[
rrule=program_event.rrule_str, program_event.work_area_id
]
calendar_events.append(
CalendarEvent(
summary=make_name_string(work_area_name, program_event.schedule_no),
start=program_event.start.replace(tzinfo=start_date.tzinfo),
end=program_event.end.replace(tzinfo=start_date.tzinfo),
rrule=program_event.rrule_str,
)
) )
for program_event in cursor return calendar_events
]

View File

@ -7,5 +7,5 @@
"documentation": "https://www.home-assistant.io/integrations/husqvarna_automower", "documentation": "https://www.home-assistant.io/integrations/husqvarna_automower",
"iot_class": "cloud_push", "iot_class": "cloud_push",
"loggers": ["aioautomower"], "loggers": ["aioautomower"],
"requirements": ["aioautomower==2024.9.0"] "requirements": ["aioautomower==2024.9.1"]
} }

View File

@ -198,7 +198,7 @@ aioaseko==1.0.0
aioasuswrt==1.4.0 aioasuswrt==1.4.0
# homeassistant.components.husqvarna_automower # homeassistant.components.husqvarna_automower
aioautomower==2024.9.0 aioautomower==2024.9.1
# homeassistant.components.azure_devops # homeassistant.components.azure_devops
aioazuredevops==2.2.1 aioazuredevops==2.2.1

View File

@ -186,7 +186,7 @@ aioaseko==1.0.0
aioasuswrt==1.4.0 aioasuswrt==1.4.0
# homeassistant.components.husqvarna_automower # homeassistant.components.husqvarna_automower
aioautomower==2024.9.0 aioautomower==2024.9.1
# homeassistant.components.azure_devops # homeassistant.components.azure_devops
aioazuredevops==2.2.1 aioazuredevops==2.2.1

View File

@ -16,8 +16,7 @@
'thursday': False, 'thursday': False,
'tuesday': False, 'tuesday': False,
'wednesday': True, 'wednesday': True,
'work_area_id': 123456, 'workAreaId': 123456,
'work_area_name': 'Front lawn',
}), }),
dict({ dict({
'duration': 480, 'duration': 480,
@ -29,8 +28,7 @@
'thursday': True, 'thursday': True,
'tuesday': True, 'tuesday': True,
'wednesday': False, 'wednesday': False,
'work_area_id': 123456, 'workAreaId': 123456,
'work_area_name': 'Front lawn',
}), }),
dict({ dict({
'duration': 480, 'duration': 480,
@ -42,8 +40,7 @@
'thursday': True, 'thursday': True,
'tuesday': True, 'tuesday': True,
'wednesday': False, 'wednesday': False,
'work_area_id': 654321, 'workAreaId': 654321,
'work_area_name': 'Back lawn',
}), }),
dict({ dict({
'duration': 480, 'duration': 480,
@ -55,8 +52,7 @@
'thursday': True, 'thursday': True,
'tuesday': True, 'tuesday': True,
'wednesday': False, 'wednesday': False,
'work_area_id': 654321, 'workAreaId': 654321,
'work_area_name': 'Back lawn',
}), }),
]), ]),
}), }),