Commit Graph

74 Commits (1a4cac95a13bb3faf658ffc795642c58c5e31d63)

Author SHA1 Message Date
Allen Porter 6b6f115d7e
Fix handling of empty google_calendars.yaml file (#84909)
fixes undefined
2022-12-31 11:50:56 +01:00
Allen Porter 2049993941
Check google calendar API scope to determine if write access is enabled (#84749)
* Check google calendar API scope to determine if write access is enabled

* Add API scope for calendar service for creating events
2022-12-29 11:00:31 +01:00
Allen Porter f9779d3e97
Bump gcal-sync to 4.1.0 (#84474)
* Bump gcal-sync to 4.1.0

* Update test with UNTIL improvements
2022-12-22 23:28:12 -05:00
Allen Porter d41fe01736
Don't allow google calendar create/delete for yaml/search calendars (#83604)
* Update tests/components/google/test_calendar.py

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

* Don't allow google calendar create/delete for yaml/search calendars

* Revert incorrect docstring update

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2022-12-21 07:36:37 -08:00
Allen Porter 4e1b399efd
Fix google calendar recurrence rule create and view (#84330)
* Fix bug in google calendar recurrence rule handling

* Convert multiline ternary operator expressions to if block
2022-12-21 07:36:20 -08:00
Allen Porter 1ac7f5f013
Make google calendar fail louder on invalid google_calendars.yaml (#83668)
* Make google calendar fail louder on invalid google_calendars.yaml

* Update homeassistant/components/google/__init__.py

Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>

* Update homeassistant/components/google/__init__.py

Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
2022-12-10 09:26:28 -08:00
Allen Porter 5d1ca73a34
Add create and delete for Google Calendar events (#83034)
* Add Google Calendar create/delete support

Includes editing for recurring events

* Fix default calendar access role

* Formatting improvements

* Address other details that have changed due to local sync

* Update tests/components/google/test_calendar.py

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

* Update tests/components/google/test_calendar.py

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

* Update tests/components/google/test_calendar.py

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

* Increase test coverage

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2022-12-01 21:39:58 +01:00
Allen Porter e6d1a4a422
Revert google calendar back to old API for free/busy readers (#81894)
* Revert google calendar back to old API for free/busy readers

* Update homeassistant/components/google/calendar.py

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

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2022-11-10 08:31:28 -08:00
Allen Porter f34de5072a
Bump gcal_sync to 4.0.1 to fix Google Calendar config flow (#81873)
Bump gcal_sync to 4.0.1

This reverts test chagnes from PR #81562 that were actually incorrect given
the calendar "get" API returns less information that the "CalendarList" api.
2022-11-09 19:34:31 -08:00
Allen Porter 0941ed076c
Cleanup unnecessary google calendar test fixtures (#81876) 2022-11-09 20:59:00 +01:00
Allen Porter 2ad1d31119
Bump gcal_sync to 4.0.0 (#81562)
* Bump gcal_sync to 2.2.4

* Bump gcal sync to 4.0.0

* Add Calendar accessRole fields which are now required
2022-11-05 17:06:34 -07:00
Allen Porter ba8fd6b01e
Google calendar test cleanup, avoiding dupe config entry setup (#81256) 2022-10-30 23:07:10 +01:00
Allen Porter 0e2bea038d
Update Google Calendar to synchronize calendar events efficiently (#80925)
* Sync google calendar and serve from local storage

Update to use new gcal_sync APIs
Update google calendar filter logic
Remove storage on config entry removal
Make timeline queries timezone aware
Do not block startup while syncing

* Minor readability tweaks

* Remove unnecessary args to async_add_entities

* Change how task is created on startup

* Update homeassistant/components/google/calendar.py

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

* Revert min time between updates

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2022-10-26 07:57:49 -07:00
Allen Porter e71bd2c20b
Fix google calendar test to match API behavior (#80436) 2022-10-16 14:45:57 -04:00
Allen Porter a7f33535c7
Fix google calendar event transparency filter (#80438) 2022-10-16 14:45:27 -04:00
Allen Porter 8280b8422c
Remove google calendar configuration.yaml deprecated in 2022.6 (#77814) 2022-09-05 21:12:38 +02:00
Allen Porter ca5065a627
Improve google calendar config flow timeout error messages (#75364) 2022-07-18 11:44:51 +02:00
Franck Nijhof af2feb3d40
Update pyupgrade to v2.37.1 (#74989) 2022-07-11 16:54:01 +02:00
Allen Porter f4e61eff18
Add update coordinator for google calendar (#74690)
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2022-07-10 21:24:52 -07:00
Allen Porter 6f9fcdff99
Improve calendar error handling to match best practices (#74891) 2022-07-10 10:04:57 -07:00
Allen Porter 08d8304a52
Migrate google calendar to new entity naming (#74727)
* Migrate google calendar to new entity naming

* Update homeassistant/components/google/calendar.py

Co-authored-by: epenet <6771947+epenet@users.noreply.github.com>

Co-authored-by: epenet <6771947+epenet@users.noreply.github.com>
2022-07-08 07:59:50 -07:00
Allen Porter 561c9a77d8
Add google calendar service proper exception handling (#74686) 2022-07-07 20:50:19 -07:00
Allen Porter a4c6cd2fbe
Cleanup Google Calendar unused test fixtures (#74353) 2022-07-03 17:05:38 +02:00
Allen Porter 02d1676301
Fix unexpected exception in Google Calendar OAuth exchange (#73963) 2022-06-28 13:29:11 -07:00
Allen Porter d399815bea
Allow multiple google calendar config entries (#73715)
* Support multiple config entries at once

* Add test coverage for multiple config entries

* Add support for multiple config entries to google config flow

* Clear hass.data when unloading config entry

* Make google config flow defensive against reuse of the same account

* Assign existing google config entries a unique id

* Migrate entities to new unique id format

* Support muliple accounts per oauth client id

* Fix mypy typing errors

* Hard fail to keep state consistent, removing graceful degredation

* Remove invalid entity regsitry entries
2022-06-21 06:42:41 -07:00
Allen Porter ea21a36e52
Remove default use of google calendars yaml file in tests (#73621)
Remove default use of
 google_calendars.yaml in tests
2022-06-17 09:04:41 +02:00
Allen Porter 91cd61804e
Deprecate google calendar add_event service, replaced with entity service (#72473)
* Deprecate google calendar add_event service, replaced with entity service

* Fix inconsistencies and bugs in input validation

* Update validation rules and exceptions

* Resolve merge conflicts
2022-06-09 16:08:08 +02:00
Allen Porter 9d933e732b
Remove google scan_for_calendars service and simplify platform setup (#73010)
* Remove google scan_for_calendars service and simplify platform setup

* Update invalid calendar yaml test
2022-06-03 21:56:53 -07:00
Allen Porter bdc41bf22a
Fix google calendar bug where expired tokens are not refreshed (#72994) 2022-06-03 16:33:12 -07:00
Allen Porter e7e48cd9f6
Defer google calendar integration reload to a task to avoid races of reload during setup (#72608) 2022-05-28 20:28:22 -07:00
Allen Porter a598cdfeb3
Don't import google calendar user pref for disabling new entities (#72652) 2022-05-28 12:51:40 -07:00
Allen Porter 71bc650ac7
Stop updating google_calendars.yaml if it does not already exist (#72340)
* Stop updating google_calendars.yaml if it does not already exist

* Add additional test coverage to make CI pass

* Add test for no updates to google_calendar.yaml

* Add parameter to test for expecting write calls

* Missing call argument

* Remove conditional and replace with inline assert
2022-05-25 08:59:27 +02:00
Allen Porter e6ffae8bd3
Deprecate google calendar configuration.yaml (#72288)
* Deprecate google calendar configuration.yaml

* Remove unused translations

* Enable strict type checking and address pr feedback

* Move default hass.data init to `async_setup`
2022-05-22 14:29:11 -07:00
Allen Porter 3f8c896cb2
Set user friendly name for Google Calendar config entry (#72243)
* Set user friendly name for Google Calendar config entry

* Add a new auth implementation for use during the config flow
2022-05-21 20:22:27 +02:00
Franck Nijhof 9d377aabdb
Fix Google tests (#72158) 2022-05-19 14:11:29 +02:00
Allen Porter 26ee289be3
Add return code to integration application credentials in config flow (#71986)
* Add return code to integration application credentials in config flow

* Update google tests to use new return code

* Update spotify test for no auth configured

* Add translation for oauth2_missing_credentials

* Add new return code to yolink

* Update homeassistant/strings.json

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

Co-authored-by: Franck Nijhof <frenck@frenck.nl>
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2022-05-18 06:30:57 -07:00
Allen Porter 355445db2d
Add application credentials platform for google calendar integration (#71808)
* Add google application_credentials platform

* Further simplify custom auth implementation overrides

* Add test coverage in application_credentials

* Simplify wording in a comment

* Remove unused imports accidentally left from merge

* Wrap lines that are too long for style guide

* Move application credential loading to only where it is needed

* Leave CLIENT_ID and CLIENT_SECRET as required.
2022-05-14 10:27:47 -07:00
Allen Porter 32e4046435
Prepare google calendar integration for Application Credentials (#71748)
* Prepare google calendar integration for Application Credentials

Update google calendar integration to have fewer dependencies on
yaml configuration data to prepare for supporting application
credentials, which means setup can happen without configuration.yaml
at all. This pre-factoring will allow the following PR adding
application credentials support to be more focused.

* Add test coverage for device auth checks
2022-05-13 04:33:52 +02:00
Allen Porter 8a13c6744a
Bump gcal_sync to 0.6.2 and switch to google calendar async iterator api (#70616)
* Switch to google calendar async iterator api

* Update homeassistant/components/google/calendar.py

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

* Add test coverage for paging through results

* Bump gcal_sync to 0.6.1

* Bump gcal-sync 0.6.2

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2022-04-27 07:22:15 -07:00
Allen Porter 0e0c0ce22b
Move google calendar integration to aiohttp (#70173)
* Use new aiohttp based google client library in gcal_sync.

* Use base url in tests for shorter string

* Remove unnecessary line of code

* Jump to gcal-sync-0.4.1

* Update tests/components/google/conftest.py

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

* Update to gcal_sync 0.5.0 incorporating PR feedback

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2022-04-20 20:18:24 -07:00
Allen Porter 36bb947cdf
Fix bug in google calendar offset calculation (#70024)
Move the offset reached computation outside of the update method so that it is
computed when state updates occur rather than when data refreshes happen (which
are throttled and happen at most every 15 minutes).

Issue #69892
2022-04-13 19:04:59 -07:00
Allen Porter a063f55c82
Handle expired credentials in reauth in google calendar initialization (#69772)
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2022-04-09 23:01:48 -07:00
Allen Porter d76fb2d891
Remove unnecessary async from test fixtures (#69722) 2022-04-09 08:33:24 +02:00
Allen Porter 06d2aeec6b
Refresh google calendar tokens with invalid expiration times (#69679)
* Refresh google calendar tokens with invalid expiration times

* Update tests/components/google/conftest.py

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

* Remove unnecessary async methods in functions being touched already

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2022-04-08 20:27:58 -07:00
Allen Porter d54cb49f32
Remove "XXX" from calendar tests and implement real test (#69677)
* Remove "XXX" from calendar tests and implement real test

Remove a placeholder that was accidentally commited in the
calendar tests, and replace with a real test.

* Remove stale comment
2022-04-08 18:46:51 +03:00
Allen Porter 1cce0a5744
Fix bugs calendar oauth token date handling (#69641) 2022-04-07 21:53:30 -07:00
Allen Porter 10a1b1f734
Gracefully handle empty summary in google calendar (#69520)
Gracefully handle empty summary in google calendar matching the old behavior
before some code cleanup.
2022-04-07 08:26:07 +02:00
epenet 053c4428a9
Prettify json (component test fixtures) (#68892) 2022-03-30 11:37:17 +02:00
Allen Porter 609c6ef5d4
Add test coverage for google calendar event response format (#68767)
Add test coverage for the calendar event response format as I am about to do some
refactoring and simplification. Notably, each calendar implementation uses a slightly different
API response, and this is codifying that.
2022-03-28 18:05:02 +02:00
Erik Montnemery cf4033b1bc
Simplify time zone setting in tests (#68330)
* Simplify timezone setting in tests

* Fix typo

* Adjust caldav tests

* Adjust input_datetime tests

* Adjust time_date tests

* Adjust tod tests

* Adjust helper tests

* Adjust recorder tests

* Adjust risco tests

* Adjust aemet tests

* Adjust flux tests

* Adjust forecast_solar tests

* Revert unnecessary change in forecast_solar test

* Adjust climacell tests

* Adjust google tests

* Adjust sensor tests

* Adjust sonarr tests

* Adjust template tests

* Adjust zodiac tests

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2022-03-20 10:25:15 +01:00