Commit graph

189 commits

Author SHA1 Message Date
Franck Nijhof
2a0401366b
Add state translations for all day calendar attribute (#89988) 2023-03-21 07:53:05 -04:00
Allen Porter
43ce6f843c
Update the calendar trigger based on PR feedback (#90017) 2023-03-21 09:21:14 +01:00
Allen Porter
9721ba59b6
Rewrite the calendar trigger to fix potential bugs (#89918)
Update the calander event trigger logic to have more exhaustive coverage. The
trigger will now use a timespan to create an explicit window for considering
upcoming events. The start/end of the time span is now more explicit, rather
than getting it from the alarm time.

The trigger is now broken into composable pieces:
- A timespan object for more explicitly managing the time window
- A function to get events during a time span
- A function to process upcoming events and determine the trigger times

The existing listener is now just responsible for scheduling alarms and glue.

This fixes bug with DST handling where the conversion back and forth between
UTC and timezone ends up dropping events during the jump forward. In practice,
an event was returned from the scanning, but it was never fired by the trigger
because (1) it was filtered out of the interval and (2) the event list was
previously cleared every iteration so it would get dropped.

Future improvements can bake more invariant checking into this structure.
2023-03-19 23:42:12 -04:00
Franck Nijhof
f9919bb7cf
Add pre-defined entity name translations (#89792) 2023-03-16 21:10:20 +01:00
Franck Nijhof
3e89b81e1d
Add state attribute translations for calendars (#89811) 2023-03-16 19:03:23 +01:00
Franck Nijhof
f32b7859b8
Restructure translations for entity components (#89702) 2023-03-16 12:16:08 +01:00
Erik Montnemery
4d3799a9de
Make CalendarEntityFeature an IntFlag (#89733) 2023-03-15 09:22:16 -04:00
Allen Porter
4ddcb14053
Add additional CalendarEvent validation (#89533)
Add additional event validation
2023-03-14 20:27:38 -04:00
Allen Porter
e1e0400b16
Fix local calendar issue with events created with fixed UTC offsets (#88650)
Fix issue with events created with UTC offsets
2023-02-23 13:37:15 -05:00
Albin Médoc
f40b712664
Fix 500 error when getting calendar events (#88276)
* Fix 500 error when getting calendar event

* Add test for calendar dates in wrong order

* Update calendar tests to use f strings
2023-02-22 15:33:43 +01:00
Erik Montnemery
87420e949d
Sort manifests 2 (#87023) 2023-02-08 20:16:39 +01:00
Mark Huson
d2ec63d757
Update example data to define in as a dictionary (#87557) 2023-02-06 19:48:10 +01:00
Franck Nijhof
939eef3b28
Remove translations from Core (#87543)
Co-authored-by: Erik Montnemery <erik@montnemery.com>
2023-02-06 15:06:43 +01:00
Allen Porter
7ff1265b10
Add service to create calendar events (#85805) 2023-01-25 12:43:50 +01:00
Franck Nijhof
cf5fca0464
Code styling tweaks to core entity components (#85460) 2023-01-08 13:40:08 -10:00
Allen Porter
624c93bb38
Add Local calendar edit support (#84141)
* Add update support for calendars and implement in local calendar

* Fix supported feature for update calendar

* Increase test coverage for websocket error cases

* Improve test coverage for update failure cases

* Improve test coverage by sharing code between update and create

* Update homeassistant/components/calendar/__init__.py

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2022-12-27 12:36:43 -08:00
Allen Porter
4819576b62
Tighten validation on calendar create event websocket (#83413) 2022-12-06 13:04:32 -05:00
Allen Porter
532ab12a48
Local calendar integration (#79601) 2022-11-30 21:20:21 +01:00
Allen Porter
9318d833a4
Streamline calendar dataclass API/attribute conversions (#79598)
* Streamline calendar dataclass API/attribute conversions

* Fix attribute conversions
2022-10-21 11:03:25 +02:00
Franck Nijhof
2b27cfdabb
Set system & entity integration types (#79593) 2022-10-04 10:36:42 -04:00
Allen Porter
28809fc7fd
Remove dead code code in calendar (#79450) 2022-10-01 23:07:27 -07:00
epenet
64988521bb
Make use of generic EntityComponent (part 2) (#78494) 2022-09-17 18:18:53 +02:00
Allen Porter
ddf668d1cb
Remove CalendarEventDevice which was deprecated in 2022.5 (#77809) 2022-09-04 22:25:43 -07:00
Marc Mueller
19cf6089d6
Use TriggerActionType [core, a-d] (#76803) 2022-08-15 17:44:12 +02:00
Marc Mueller
70aeaa3c76
Use Callback protocol for AutomationActionType (#76054) 2022-08-09 16:10:26 -04:00
GitHub Action
f11fbf2989 [ci skip] Translation update 2022-08-08 00:22:41 +00:00
Allen Porter
939c33b1dc
Exclude calendar description from recorder (#75375) 2022-07-17 13:31:14 -07:00
Allen Porter
6f9fcdff99
Improve calendar error handling to match best practices (#74891) 2022-07-10 10:04:57 -07:00
epenet
781e4571b2
Add CalendarEntity checks to pylint plugin (#74228)
* Add CalendarEntity checks to pylint plugin

* adjust air_quality ignore

* Mark state property as final
2022-06-30 19:00:34 +02:00
Matej Drobnič
690fb2ae86
Add back description and location to calendar endpoint (#71887) 2022-05-15 20:31:22 +02:00
Allen Porter
285fdeb581
Add calendar trigger offsets (#70963)
* Add support for calendar trigger offsets

* Add offset end test

* Update homeassistant/components/calendar/trigger.py

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>

* Always include offset in trigger data

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2022-04-30 17:21:30 -07:00
Allen Porter
dc7e3a6df6
Fix boundary case in calednar trigger (#70467)
Update calendar trigger scan logic to add a one second boundary due to the
exclusive search. Add a test that reproduced the issue.
2022-04-24 12:52:17 -07:00
Allen Porter
5ffaa70bb6
Add calendar event end trigger (#70372)
* Add calendar event end trigger

* Rename start date to last_endtime

* Rename now to last_endtime
2022-04-22 21:19:35 -07:00
Allen Porter
a2c74b9786
Add initial implementation of a calendar trigger (#68674)
* Add initial implementation of calendar trigger

This is an initial implementation of a calendar trigger, that supports
triggering on calendar start time.

See architecture proposal in:
https://github.com/home-assistant/architecture/discussions/700

* Address reviewer feedback

* Use f-strings for all tests

* Apply suggestions from code review

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>

* Remove logging f-strings, and move to main code

* Remove mypy ignore

* Apply suggestions from code review

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>

* Update calendar triggers to use new calendar data model

* Update tests/components/calendar/test_trigger.py

Co-authored-by: Franck Nijhof <frenck@frenck.nl>

* Rewrite tests using freezegun

Rewrite tests using freezegun and improve edge case handling, and use utc consistently for all alarms.

* Update homeassistant/components/calendar/trigger.py

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>

* Update homeassistant/components/calendar/trigger.py

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>

* Increase test coverage based on pr feedback

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
Co-authored-by: Franck Nijhof <frenck@frenck.nl>
2022-04-21 08:09:50 -07:00
Allen Porter
f99b6004ea
Cleanup calendar APIs and introduce a dataclass for representing events (#68843)
* Introduce data class to hold calendar event data

* Rename CalendarEventDevice to CalendarEntity

* Apply suggestions from code review

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>

* Fix docstring on google calendar api conversion function.

* Update todoist to new calendar enttiy api, tested manually

* Add back old API for a legacy compatibility layer

* Add deprecation warning for old calendar APIs

* Fix deprecation warning

* Fix merge for missing summary #69520

* Add mypy typing for newly introduced classes

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2022-04-10 12:04:07 -07:00
Allen Porter
68d563c630
Remove calendar mypy ignores, now that calendar has full typing (#69051) 2022-04-01 07:46:48 +02:00
Allen Porter
f61c911174
Remove some offset complexity from calendar event (#68724)
Simplify the calendar offset calculations to no longer update the event dictionary
using extra fields. calculate_offset is renamed to extract_offset and the integration
is responsible for overwriting the summary text.

This is in prepration for:
- Improved calendar event typing, removing unnecessary offset_reached field
- Calendar triggers which will remove offsets anyway
2022-03-27 10:02:19 -07:00
Allen Porter
f05a6826de
Add additional type hints for calendar integration (#68660) 2022-03-27 17:08:28 +02:00
GitHub Action
66d757115c [ci skip] Translation update 2022-03-11 00:21:48 +00:00
jan iversen
0d8ff3d724
Add codeowner to internal integrations that are without (#67286) 2022-02-28 09:06:16 +01:00
GitHub Action
ca7d4234e1 [ci skip] Translation update 2022-01-31 00:14:28 +00:00
epenet
946238fb02
Import frontend (#64104)
Co-authored-by: epenet <epenet@users.noreply.github.com>
2022-01-14 10:01:12 +01:00
epenet
9e16f87ddc
Add init type hints [b-c] (#63100)
Co-authored-by: epenet <epenet@users.noreply.github.com>
2022-01-02 17:05:18 +01:00
GitHub Action
f0c9f443d1 [ci skip] Translation update 2021-11-15 00:12:46 +00:00
GitHub Action
4634b65924 [ci skip] Translation update 2021-10-21 00:12:43 +00:00
Marc Mueller
5048bad050
Use assignment expressions 05 (#57785) 2021-10-17 19:56:00 +02:00
Ville Skyttä
cc97502a0c
Use HTTPStatus instead of HTTP_* consts in aiohttp web response statuses (#56541) 2021-10-01 09:27:44 -07:00
GitHub Action
8c5620e74b [ci skip] Translation update 2021-08-02 03:40:04 +00:00
GitHub Action
0c5ce9cac2 [ci skip] Translation update 2021-07-07 00:11:57 +00:00
Franck Nijhof
7947946793
Type entry setup/unload for entity components (#51912) 2021-06-17 10:10:26 +02:00