Commit Graph

85 Commits (b539b25682754f9d4abb7ef4361184a7054c52ac)

Author SHA1 Message Date
Sid 82a60fe8ad
Enable Ruff RSE (#113695) 2024-03-18 00:40:38 +01:00
Allen Porter 2789060bbe
Fix local calendar handling of empty recurrence ids (#112745)
* Fix handling of empty recurrence ids

* Revert logging changes
2024-03-08 22:28:04 -05:00
Marc Mueller ff3a801936
Add empty line after module docstring [a-d] (#112697) 2024-03-08 14:51:32 +01:00
Marc Mueller f3594c543d
Use KEY_HASS [a-g] (#112609) 2024-03-07 18:09:20 +01:00
Cody C a1f36c25d4
Remove erroneous reference to Google from Calendar integration (#109089) 2024-01-30 12:34:01 +01:00
Ville Skyttä 24b1e01d71
Update Ruff to 0.1.8, avoid linter/formatter conflicts (#106080)
* Disable Ruff rules that may conflict with the formatter

* Upgrade Ruff to 0.1.8

- https://github.com/astral-sh/ruff/releases/tag/v0.1.7
- https://github.com/astral-sh/ruff/releases/tag/v0.1.8

* Format with Ruff 0.1.8
2023-12-20 23:55:09 +01:00
Kevin Stillhammer 51385dcaab
Deprecate calendar.list_events (#102481)
* deprecate calendar.list_events

* rename events to get_events

* raise issue for use of deprecated service

* Make issue fixable

* Add fix_flow

* Add service translation/yaml
2023-11-19 07:12:43 -08:00
Kevin Stillhammer 06c9719cd6
Support multiple responses for service calls (#96370)
* add supports_response to platform entity services

* support multiple entities in entity_service_call

* support legacy response format for service calls

* revert changes to script/shell_command

* add back test for multiple responses for legacy service

* remove SupportsResponse.ONLY_LEGACY

* Apply suggestion

Co-authored-by: Allen Porter <allen.porter@gmail.com>

* test for entity_id remove None

* revert Apply suggestion

* return EntityServiceResponse from _handle_entity_call

* Use asyncio.gather

* EntityServiceResponse not Optional

* styling

---------

Co-authored-by: Allen Porter <allen.porter@gmail.com>
2023-11-02 18:37:35 -07:00
Allen Porter ce7573c3ad
Fix bug in calendar state transitions (#102083) 2023-10-15 16:59:19 -07:00
Robert Hillis 5087f0056c
Adjust Calendar doc strings and comments (#101655) 2023-10-08 16:16:59 +02:00
Allen Porter 0f4aae4128
Add additional calendar state alarm debugging (#101631) 2023-10-08 14:20:35 +02:00
Allen Porter 579590f7c3
Fix bug in calendar state where alarms due to alarms not scheduled (#101510) 2023-10-06 09:19:21 +02:00
Allen Porter 87ecdfb84f
Clear calendar alarms after scheduling and add debug loggging (#101176) 2023-10-01 15:25:04 +02:00
Erik Montnemery df73850f56
Move definition of attributes excluded from history to entity classes (#100430)
* Move definition of attributes excluded from history to entity classes

* Revert change which should be in a follow-up PR

* Fix sun unrecorded attributes

* Fix input_select unrecorded attributes
2023-09-21 15:02:47 +02:00
Allen Porter 8d9c5a61ec
Update calendar handle state updates at start/end of active/upcoming event (#98037)
* Update calendar handle state updates at start/end of active/upcoming event

* Use async_write_ha_state intercept state updates

Remove unrelated changes and whitespace.

* Revert unnecessary changes

* Move demo calendar to config entries to cleanup event timers

* Fix docs on calendars

* Move method inside from PR feedback
2023-08-25 18:32:20 -07:00
Franck Nijhof 86708b5590
Update ruff to v0.0.280 (#97102) 2023-07-23 22:00:26 +02:00
Allen Porter 26f2fabd85
Fix timezones used in list events (#95804)
* Fix timezones used in list events

* Add additional tests that catch floating vs timezone datetime comparisons
2023-07-05 08:25:03 +02:00
Paul Bottein 4581c36648
Fix datetime parameter validation for list events (#95778) 2023-07-03 15:22:22 -04:00
Allen Porter 2f73be0e50
Ensure that calendar output values are json types (#95797) 2023-07-03 12:05:02 -07:00
Allen Porter 7252c33df8
Limit fields returned for the list events service (#95506)
* Limit fields returned for the list events service

* Update websocket tests and fix bugs in response fields

* Omit 'None' fields in the list events response
2023-06-29 13:25:25 -04:00
Allen Porter b9b5fe6be8
Add service response data for listing calendar events (#94759)
* Add service response data for listing calendar events

Add the capability of response data for for the entity component.

* Rename input arguments and add service description

* Improve list events to be more user friendly

Allow the end date to be determined based on a relative time duration. Make the start time optional and set to "now". Add additional test coverage. Update demo calendar to actually perform date range checks.

* Wrap docstrings properly.

* Increase test coverage

* Update to use new API calls

* Readability improvements

* Wrap docstrings

* Require at least one of end or duration

* Check for multiple entity matches earlier in the request

* Update documentation strings
2023-06-23 23:34:34 -04:00
Ville Skyttä ced67e5800
Import `util.dt` as `dt_util` in `components/[a-d]*` (#93756) 2023-05-30 00:02:06 +03:00
Allen Porter 282d5f4488
Add more detail to invalid rrule calendar error message (#92222)
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2023-04-29 09:57:30 +02:00
Allen Porter 93eac97983
Relax the constraint that events must have a consistent timezone for start/end (#91788) 2023-04-21 10:25:52 -04:00
Allen Porter cf9ada3b0e
Fix all day event coercion logic (#91169) 2023-04-10 12:05:08 -04:00
Allen Porter 14b95ffe3a
Relax calendar event validation to allow existing zero duration events (#91129)
Relax event valudation to allow existing zero duration events
2023-04-10 10:04:42 -04:00
Allen Porter ae41547b73
Update calendar to always request start/end dates in local time rather than UTC (#90386) 2023-03-28 12:25:44 +02:00
Luca Angemi 6d8eaa0bee
Add location field to calendar create_event service supported by Google Calendar and Local Calendar (#90098)
* Update __init__.py

* Update __init__.py

* Update __init__.py

* Update calendar.py

* Update calendar.py

* Update services.yaml

* Update services.yaml

* Update calendar.py

* Update calendar.py

* Update __init__.py

* Update services.yaml

* Update services.yaml

* Update test_calendar.py

* Update test_init.py

* Update test_init.py

* Update test_init.py

* Update test_init.py

* Update __init__.py

* Update const.py

* Address changes to service.yaml

* Address changes to service.yaml

* Update test_calendar.py

* Update test_calendar.py

* Update test_calendar.py

* Update conftest.py

* Update conftest.py

* Update calendar.py

* Update __init__.py
2023-03-25 09:43:49 -07: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
Allen Porter 7ff1265b10
Add service to create calendar events (#85805) 2023-01-25 12:43:50 +01: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
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
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 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
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
Marc Mueller 5048bad050
Use assignment expressions 05 (#57785) 2021-10-17 19:56:00 +02:00