Commit Graph

95 Commits (3a0e816f1b8173fafc5b5afdcc09fb430284bcd6)

Author SHA1 Message Date
GitHub Action 7df7e33d17 [ci skip] Translation update 2022-05-23 00:25:42 +00: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
Allen Porter b38289ee50
Remove google found_calendar service (#72260)
* Remove google found_calendar service

* Partial revert of yaml changes

* Store calendar id in a local variable
2022-05-21 08:39:41 -07:00
GitHub Action ceb8bb4745 [ci skip] Translation update 2022-05-21 00:22:49 +00:00
Allen Porter 5866bf48da
Bump gcal_sync to 0.9.0 (#72237) 2022-05-20 18:07:02 +02:00
Allen Porter 3526252cfc
Bump gcal-sync to 0.8.1 (#72164) 2022-05-19 08:16:49 -07:00
GitHub Action 3a13ffcf13 [ci skip] Translation update 2022-05-19 00:26:11 +00:00
GitHub Action 37f81b261d [ci skip] Translation update 2022-05-16 00:24:28 +00:00
Allen Porter f2da1fceb2
Bump gcal_sync to 0.8.0 (#71900) 2022-05-15 19:33:46 +02:00
GitHub Action 10624e93c8 [ci skip] Translation update 2022-05-15 00:30:16 +00: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 b97ca8e260
Bump gcal_sync to 0.7.1 to fix calendar API timezone handling (#71173) 2022-05-01 14:20:44 -07:00
Allen Porter c8ea264db8
Bump gcal_sync to 0.7.0 (#71116) 2022-04-30 19:33:30 +03:00
GitHub Action 348016dbbf [ci skip] Translation update 2022-04-29 00:22:21 +00:00
Allen Porter 474087bf7d
Bump gcal_sync 0.6.3 to fix calendar path encoding bug (#70959) 2022-04-27 21:17:25 -07: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 2543f18e70
Fix google calendar timestamp out of range (#69863) 2022-04-11 20:02:22 +02: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 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 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 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
Allen Porter c07100e519
Move Local OAuth http endpoint registration to auth component (#69507) 2022-04-06 22:34:31 -07:00
Allen Porter 3c478c312a
Fix google calendar blocking call, running outside of executor (#68948) 2022-03-31 13:22:33 +02:00
epenet e362871499
Prettify json (strings.json) (#68885) 2022-03-30 10:35:30 +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
Marc Mueller 911b159281
Cleanup after pylint update (#68657) 2022-03-26 00:34:12 +01:00
Allen Porter 7876ffe9e3
Update google calendar integration with a config flow (#68010)
* Convert google calendar to config flow and async

* Call correct exchange method

* Fix async method and reduce unnecessary diffs

* Wording improvements

* Reduce unnecessary diffs

* Run load/update config from executor

* Update homeassistant/components/google/calendar.py

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

* Remove unnecessary updating of unexpected multiple config entries.

* Remove unnecessary unique_id checks

* Improve readability with comments about device code expiration

* Update homeassistant/components/google/calendar.py

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

* Update homeassistant/components/google/calendar.py

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

* Update homeassistant/components/google/api.py

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

* Add comment for when code is none on timeout

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2022-03-15 07:51:02 +01:00
Allen Porter 8adcd10f55
Make google calendar loading API centric, not loading from yaml (#67722)
* Make google calendar loading API centric, not loading from yaml

Update the behavior for google calendar to focus on loading calendars based on the
API and using the yaml configuration to override behavior. The old behavior was
to first load from yaml, then also load from the API, which is atypical.

This is pulled out from a larger change to rewrite calendar using async and config
flows.

Tests needed to be updated to reflect the new API centric behavior, and changing
the API call ordering required changing tests that exercise failures.

* Update to use async_fire_time_changed to invoke updates
2022-03-08 21:56:49 +01:00
Allen Porter 74c339eb7b
Simplify google calendar new calendar tracking (#67772)
* Simplify google calendar new calendar tracking

* Remove application of CONFIG_SCHEMA
2022-03-07 09:44:32 +01:00
Allen Porter a8842d3636
Bump httplib2 to 0.20.4 (#67552) 2022-03-03 15:22:11 -08:00
Allen Porter c456b4c646
Fix google calendar comment typo (#67389) 2022-02-28 18:52:52 +01:00
Allen Porter a375a4e16e
Fix recurring events in google calendar (#67355) 2022-02-27 19:56:24 -08:00
Allen Porter afaaabd2fe
Cleanup google calendar by removing some device abstractions (#67356)
* Remove unnecessary abstraction in google calendar

* Simplify diffs for calendar event filtering
2022-02-27 15:01:54 -08:00
Allen Porter deda9e38e4
Simplify google calendar API interactions (#67319)
* Simplify google calendar APIs and tests

* Simplify authentication logic at startup

* Improve readability of diffs

* Reduce diffs

* Simplify api datetime logic

* Remove duplicate test fixtures added in prior commit

* Remove duplicate event filter calls

* Fix event list argument names

* More improvements found from additional testing

* Remove unnecessary variables in create event call
2022-02-26 16:19:45 -08:00
Allen Porter 1383034df2
Simplify google calendar event filters (#67312)
Simplify google calendar event filtering logic currently copied between two methods.
2022-02-26 15:27:08 -08:00
Allen Porter 0e74184e4f
Simplify google calendar authentication setup (#67314)
Simplify google calendar authentication to combine some of the cases together, and reduce unecessarily checks. Make the
tests share common authentication setup and reduce use of mocks by introducing a fake for holding on to credentials.
This makes future refactoring simpler, so we don't have to care as much about the interactions with the credentials
storage.
2022-02-26 15:17:02 -08:00
Allen Porter 648aa0cae6
Reduce google calendar test flake (#67310) 2022-02-26 13:23:11 -08:00
Allen Porter 1ee4f47f8b
Cleanup google calendar use of hass.data (#67305)
Update google calendar's use of hass.data to follow the best practices of storing
data under hass.data[DOMAIN]. This is in preparation for storing additional
data later, pulled out of a larger cleanup.
2022-02-26 12:30:04 -08:00
Allen Porter 1cc4ae2bdd
Bump googel-api-python-client to 2.3.8 (last updated 2017) (#67298) 2022-02-26 19:47:42 +01:00
Allen Porter f901c61d54
Add myself as code owner for google calendar integration (#67299) 2022-02-26 17:55:46 +01:00
Allen Porter d3374ecd8e
Add type hints for google calendar integration (#65353)
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2022-02-01 17:28:32 +01:00
Allen Porter 88ed2f3b3e
Improve google calendar test coverage to 97% (#65223)
* Improve google calendar test coverage to 97%

* Remove commented out code.

* Remove unnecessary (flaky) checks for token file persistence

* Remove mock code assertions

* Add debug logging to google calendar integration

* Increase alarm time to polling code to reduce flakes

* Setup every test in their own configuration directory

* Mock out filesystem calls to avoid disk dependencies

Update scope checking code to use Storage object rather than text file matching

* Update tests to check entity states when integration is loaded

* Mock out google service in multiple locations

* Update homeassistant/components/google/__init__.py

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

* Update homeassistant/components/google/__init__.py

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

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2022-02-01 03:14:49 +01:00
J. Nick Koston 5b755b74fb
Add loggers to integration manifest.json (#65083) 2022-01-28 13:37:53 -08:00
Marc Mueller 84552d2406
Upgrade oauth2client to 4.1.3 (#64044) 2022-01-13 14:04:52 +01:00
Erik Montnemery 2eab3c8de1
Import persistent notification (part 3) (#63900) 2022-01-11 09:51:16 -08:00