Giter Site home page Giter Site logo

black-roland / homeassistant-microsoft-todo Goto Github PK

View Code? Open in Web Editor NEW
109.0 7.0 8.0 110 KB

The integration allows you to create tasks in Microsoft To Do from Home Assistant.

License: MIT License

Python 100.00%
homeassistant homeassistant-integration microsoft-todo todo

homeassistant-microsoft-todo's People

Contributors

aetha avatar black-roland avatar dependabot[bot] avatar kariudo avatar ssmorris avatar thebndr avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

homeassistant-microsoft-todo's Issues

Server Error 500 after Auth

I think I've followed all instructions properly, but: Once I click on Link Microsoft To Do account to initiate the link, I sign into MS fine, but then I get:

500 Internal Server Error
Server got itself in trouble

The URL in the browser at that time is
https://MY_DOMAIN/api/microsoft-todo?code=M65....&state=4Y0Z.....

Suggestions?
Thank you ... Really looking forward to this functionality.

Error Handaling Request

I'm getting the following error in the logs after trying to configure. Any ideas?

Logger: aiohttp.server
Source: custom_components/microsoft_todo/calendar.py:171
First occurred: 11:22:56 AM (1 occurrences)
Last logged: 11:22:56 AM

Error handling request
Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/aiohttp/web_protocol.py", line 418, in start
resp = await task
File "/usr/local/lib/python3.7/site-packages/aiohttp/web_app.py", line 458, in _handle
resp = await handler(request)
File "/usr/local/lib/python3.7/site-packages/aiohttp/web_middlewares.py", line 119, in impl
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/real_ip.py", line 39, in real_ip_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 73, in ban_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 127, in auth_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 122, in handle
result = handler(request, **request.match_info)
File "/config/custom_components/microsoft_todo/calendar.py", line 171, in get
code=data.get("code")
File "/usr/local/lib/python3.7/site-packages/requests_oauthlib/oauth2_session.py", line 307, in fetch_token
self._client.parse_request_body_response(r.text, scope=self.scope)
File "/usr/local/lib/python3.7/site-packages/oauthlib/oauth2/rfc6749/clients/base.py", line 421, in parse_request_body_response
self.token = parse_token_response(body, scope=scope)
File "/usr/local/lib/python3.7/site-packages/oauthlib/oauth2/rfc6749/parameters.py", line 431, in parse_token_response
validate_token_parameters(params)
File "/usr/local/lib/python3.7/site-packages/oauthlib/oauth2/rfc6749/parameters.py", line 438, in validate_token_parameters
raise_from_error(params.get('error'), params)
File "/usr/local/lib/python3.7/site-packages/oauthlib/oauth2/rfc6749/errors.py", line 405, in raise_from_error
raise cls(**kwargs)
oauthlib.oauth2.rfc6749.errors.InvalidClientIdError: (invalid_request) AADSTS9002331: Application '93e1e785-2885-4f1f-ab4e-4dd194cc27a5'(Home Assistant) is configured for use by Microsoft Account users only. Please use the /consumers endpoint to serve this request.
Trace ID: 902f662d-4b03-4cfb-93cf-6ee3af240900
Correlation ID: 1220aea5-7bc4-456b-a79c-ca5baf624fb3
Timestamp: 2020-05-08 10:22:56Z

Update the README.md with the latest flow

I have this integration working now but it took me some extra effort.
First I have to fix issue #75 to install it and then I needed some extra steps which where not described or out-dated.

I described my steps here https://community.home-assistant.io/t/microsoft-to-do/139614/40
Because my language settings are not set to English in Azure and Home Assistant I didn't use the exact correct names.

The whole base_url part must now configured in Home Assistant itself.

I also need a trick to finish the registration for my non-https environment.

I hope you can improve the README.md so more people can use this great integration!

No 'version' key in the manifest file

2021-04-04 11:28:53 WARNING (MainThread) [homeassistant.loader] No 'version' key in the manifest file for custom integration 'microsoft_todo'. This will not be allowed in a future version of Home Assistant. Please report this to the maintainer of 'microsoft_todo'

Running 2021.3.4. I consider my work here done ;-)

Installation with HACS custom repository way leads to a Platform error calendar.microsoft_todo - No module named 'emoji' 18:09:19 – Hass.io (ERROR) after reboot of HASS

Hello,

Installation with HACS custom repository way leads to a Platform error calendar.microsoft_todo - No module named 'emoji' 18:09:19 – Hass.io (ERROR) after reboot of HASS

( ERROR )
Logger: homeassistant.components.hassio
Source: components/hassio/__init__.py:269
Integration: Hass.io (documentation, issues)
First occurred: 18:09:19 (1 occurrences)
Last logged: 18:09:19

Platform error calendar.microsoft_todo - No module named 'emoji'

Home Assistant 0.107.7
System HassOS 3.12
Deployment production

image

image

Not all lists are being found

It is all working great for my lists Tasks, Chores, Costco.
But beyond those three, I'm getting errors as seen below:

  • No list with the name Hardware.
  • No list with the name LEC Items.
  • No list with the name Grocery.

Is there any way to view (debug log), what list names MS is providing you?

Tnx

2019-12-15 16:13:00 ERROR (SyncWorker_8) [custom_components.microsoft_todo.calendar] No list with the name Hardware. 
2019-12-15 16:13:00 ERROR (MainThread) [homeassistant.core] Error doing job: Exception in callback _chain_future.<locals>._set_state(<Future pendi...bac7f3550>()]>, <Future at 0x...StopIteration>) at /usr/local/lib/python3.7/asyncio/futures.py:342
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/asyncio/events.py", line 88, in _run
    self._context.run(self._callback, *self._args)
  File "/usr/local/lib/python3.7/asyncio/futures.py", line 344, in _set_state
    _copy_future_state(other, future)
  File "/usr/local/lib/python3.7/asyncio/futures.py", line 320, in _copy_future_state
    dest.set_exception(exception)
TypeError: StopIteration interacts badly with generators and cannot be raised into a Future
2019-12-15 16:13:27 ERROR (SyncWorker_11) [homeassistant.core] Error doing job: Task was destroyed but it is pending!
2019-12-15 16:14:06 ERROR (SyncWorker_7) [custom_components.microsoft_todo.calendar] No list with the name LEC Items. 
2019-12-15 16:14:06 ERROR (MainThread) [homeassistant.core] Error doing job: Exception in callback _chain_future.<locals>._set_state(<Future pendi...bac620810>()]>, <Future at 0x...StopIteration>) at /usr/local/lib/python3.7/asyncio/futures.py:342
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/asyncio/events.py", line 88, in _run
    self._context.run(self._callback, *self._args)
  File "/usr/local/lib/python3.7/asyncio/futures.py", line 344, in _set_state
    _copy_future_state(other, future)
  File "/usr/local/lib/python3.7/asyncio/futures.py", line 320, in _copy_future_state
    dest.set_exception(exception)
TypeError: StopIteration interacts badly with generators and cannot be raised into a Future
2019-12-15 16:14:39 ERROR (SyncWorker_9) [custom_components.microsoft_todo.calendar] No list with the name Grocery. 
2019-12-15 16:14:39 ERROR (MainThread) [homeassistant.core] Error doing job: Exception in callback _chain_future.<locals>._set_state(<Future pendi...bb0614c10>()]>, <Future at 0x...StopIteration>) at /usr/local/lib/python3.7/asyncio/futures.py:342
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/asyncio/events.py", line 88, in _run
    self._context.run(self._callback, *self._args)
  File "/usr/local/lib/python3.7/asyncio/futures.py", line 344, in _set_state
    _copy_future_state(other, future)
  File "/usr/local/lib/python3.7/asyncio/futures.py", line 320, in _copy_future_state
    dest.set_exception(exception)
TypeError: StopIteration interacts badly with generators and cannot be raised into a Future

Feature Request: Account without lists as calendars

Hi,
it would be cool to have the option to disable the lists as calendars. In my case I'd like to add my wifes account as second account, so I can put tasks with reminders for her in her lists, but I don't need her to-do lists to show up in HA.

Can't authenticate with MS graph API

I've set the redirect URI on an App Registration to be the same as defined in;

homeassistant:
    external_url: https://assistant.mydomain.net/
    internal_url: https://192.168.0.22/

However, on authenticating, I get: "No code returned from Microsoft Graph Auth API" when I'm redirected to:

https://assistant.mydomain.net/api/microsoft-todo?error=invalid_request&error_description=The%20request%20is%20not%20valid%20for%20the%20application%27s%20%27userAudience%27%20configuration.%20In%20order%20to%20use%20/common/%20endpoint%2c%20the%20application%20must%20not%20be%20configured%20with%20%27Consumer%27%20as%20the%20user%20audience.%20The%20userAudience%20should%20be%20configured%20with%20%27All%27%20to%20use%20/common/%20endpoint.&state=QoxE5asfcGxz8gdJ4B5k01gqb6hdvW

There is a link to https://www.home-assistant.io/integrations/http/#base_url on README.md - but I think that configuration is gone now ? It's not mentioned anywhere on that http integration page.

Server error

As described in #73 the "redirect URI" needs to be https instead of http. So I added as redirect URI in azure my https address (which has an invalid cert)

I added "https://192.168.0.88:8123/api/microsoft-todo" in my case.

Then I put the clientId and clientSecret in my configuration.yaml. restarted. then got a new configuration request in notifications. Here the problem starts.

The link contains the redirect_ui parameter which is http. A error will be thrown by azure because it does not match the one I added in azure (https). So i chaged the parameter to https.

I then got the notification that a new app want to connect to my account which I accepted. Then azure redircts to

https://192.168.0.88:8123/api/microsoft-todo?code=xxx&state=yyy

which does not work because I do not have a SSL certificate. So I changed to url back to http. Then I got a "500 Internal Server Error
Server got itself in trouble" page.

What can I do?

I am not alone. Please see: https://community.home-assistant.io/t/microsoft-to-do/139614/36

No list with the name xxx.

For weeks I've been needing to investigate why I'm no longer seeing any calendar entities from this component. HA Core 2022.6.7 and now 2022.7.
I removed and readded this component.
No entities are being hidden. Not sure where to continue looking.
Is this just me?

2022-07-08 11:39:12 ERROR (SyncWorker_4) [custom_components.microsoft_todo.calendar] No list with the name Tasks.

Edit: Adding:
(BTW: HA no longer wants base_url specified in the config.)

After reading #45 I recreated my Azure app using:

  • Accounts in any organizational directory (Any Azure AD directory - Multitenant) and personal Microsoft accounts (e.g. Skype, Xbox)

Eventually received the new configuration request in notifications, completed that: (Microsoft To Do has been successfully authorized! You can close this window now!), but could not close that OK button. Restarted HA. No errors in the log until I call microsoft_todo: new_task

2022-07-08 13:19:21 ERROR (SyncWorker_15) [custom_components.microsoft_todo.calendar] No list with the name Tasks. 
2022-07-08 13:19:21 ERROR (MainThread) [homeassistant] Error doing job: Exception in callback _chain_future.<locals>._set_state(<Future pendi...ask_wakeup()]>, <Future at 0x...StopIteration>) at /usr/local/lib/python3.10/asyncio/futures.py:378

guess we have a python 3 issue, too, with 2022.7.

Detected use of deprecated `base_url` property, use `homeassistant.helpers.network.get_url` method instead

Hi there,
since 0.110.0 I believe the change from base_url to internal_url and external_url are likely causing this issue.

Detected use of deprecated `base_url` property, use `homeassistant.helpers.network.get_url` method instead. Please report issue to the custom component author for microsoft_todo using this method at custom_components/microsoft_todo/calendar.py, line 89: callback_url = f"{hass.config.api.base_url}{AUTH_CALLBACK_PATH}"

Display ToDos as list

I'm looking for a possibility to show the item entries of the to-do calendar in a simple list.
Didn't find one so far, any advice?

device_state_attributes error at startup

I've been experiencing this intermittently for the past few weeks or so. Not recalling if it started with 2021.11 or .12, but it looks similar to this issue. Hopefully it's straight forward. Thank you

Logger: homeassistant.helpers.entity
Source: helpers/entity.py:549
First occurred: 3:48:05 AM (14 occurrences)
Last logged: 3:48:06 AM

Entity calendar.home_assistant (<class 'custom_components.microsoft_todo.calendar.MSToDoListDevice'>) implements device_state_attributes. Please report it to the custom component author.
Entity calendar.home_rapairs (<class 'custom_components.microsoft_todo.calendar.MSToDoListDevice'>) implements device_state_attributes. Please report it to the custom component author.
Entity calendar.improvement_ideas (<class 'custom_components.microsoft_todo.calendar.MSToDoListDevice'>) implements device_state_attributes. Please report it to the custom component author.
Entity calendar.leaving_tasks (<class 'custom_components.microsoft_todo.calendar.MSToDoListDevice'>) implements device_state_attributes. Please report it to the custom component author.
Entity calendar.lec_items (<class 'custom_components.microsoft_todo.calendar.MSToDoListDevice'>) implements device_state_attributes. Please report it to the custom component author.

InvalidGrantError after changing Microsoft account password

After changing your Microsoft account password, the following call stack appears in the home assistant logs on each startup, and todo data fails to load. Pull request for fix incoming shortly.

Source: custom_components/microsoft_todo/outlook_tasks_api.py:95
Integration: Calendar (documentation, issues)
First occurred: July 27, 2021, 9:01:47 PM (1 occurrences)
Last logged: July 27, 2021, 9:01:47 PM

Error while setting up microsoft_todo platform for calendar
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/requests_oauthlib/oauth2_session.py", line 477, in request
    url, headers, data = self._client.add_token(
  File "/usr/local/lib/python3.9/site-packages/oauthlib/oauth2/rfc6749/clients/base.py", line 198, in add_token
    raise TokenExpiredError()
oauthlib.oauth2.rfc6749.errors.TokenExpiredError: (token_expired) 

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 250, in _async_setup_platform
    await asyncio.shield(task)
  File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 52, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/microsoft_todo/calendar.py", line 127, in setup_platform
    todo_lists = tasks_api.get_lists()["value"]
  File "/config/custom_components/microsoft_todo/outlook_tasks_api.py", line 95, in get_lists
    res = self.client.get(uri, params=query_params)
  File "/usr/local/lib/python3.9/site-packages/requests/sessions.py", line 555, in get
    return self.request('GET', url, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/requests_oauthlib/oauth2_session.py", line 496, in request
    token = self.refresh_token(
  File "/usr/local/lib/python3.9/site-packages/requests_oauthlib/oauth2_session.py", line 446, in refresh_token
    self.token = self._client.parse_request_body_response(r.text, scope=self.scope)
  File "/usr/local/lib/python3.9/site-packages/oauthlib/oauth2/rfc6749/clients/base.py", line 429, in parse_request_body_response
    self.token = parse_token_response(body, scope=scope)
  File "/usr/local/lib/python3.9/site-packages/oauthlib/oauth2/rfc6749/parameters.py", line 425, in parse_token_response
    validate_token_parameters(params)
  File "/usr/local/lib/python3.9/site-packages/oauthlib/oauth2/rfc6749/parameters.py", line 432, in validate_token_parameters
    raise_from_error(params.get('error'), params)
  File "/usr/local/lib/python3.9/site-packages/oauthlib/oauth2/rfc6749/errors.py", line 402, in raise_from_error
    raise cls(**kwargs)
oauthlib.oauth2.rfc6749.errors.InvalidGrantError: (invalid_grant) AADSTS70000: The request was denied because one or more scopes requested are unauthorized or expired. The user must first sign in and grant the client application access to the requested scope.

Feature Request: Additional hidden JSON

Hi, i was looking into how this custom_component works and was checking how already established components work.

When looking at the official shopping_list component, we can see that all the different tasks (including the ID) is saved in a hidden .json file in the config directory. The same way the token is handled by this component.

It would be great if this component could do the same. In this way, it should also be possible to remove a task (since we know the ID) from both the HA list, and also the cloud.
On top, may it be possible to use the same UI as currently possible for the shopping list where each item can individually be ticked (completed) and shown?

Currently looking into learning enough so I could help with the PRs... but from my latest progress it might still be a while until i can be of actual help...

Server Error 500

500 Internal Server Error
Server got itself in trouble

log:
2021-03-17 20:03:40 WARNING (MainThread) [homeassistant.util.async_] Detected I/O inside the event loop. This is causing stability issues. Please report issue to the custom component author for microsoft_todo doing I/O at custom_components/microsoft_todo/calendar.py, line 170: token = self.oauth.fetch_token(
2021-03-17 20:03:40 ERROR (MainThread) [aiohttp.server] Error handling request
Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/aiohttp/web_protocol.py", line 422, in _handle_request
resp = await self._request_handler(request)
File "/usr/local/lib/python3.8/site-packages/aiohttp/web_app.py", line 499, in _handle
resp = await handler(request)
File "/usr/local/lib/python3.8/site-packages/aiohttp/web_middlewares.py", line 119, in impl
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 56, in security_filter_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 18, in request_context_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 72, in ban_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 129, in auth_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 126, in handle
result = handler(request, **request.match_info)
File "/config/custom_components/microsoft_todo/calendar.py", line 170, in get
token = self.oauth.fetch_token(
File "/usr/local/lib/python3.8/site-packages/requests_oauthlib/oauth2_session.py", line 360, in fetch_token
self._client.parse_request_body_response(r.text, scope=self.scope)
File "/usr/local/lib/python3.8/site-packages/oauthlib/oauth2/rfc6749/clients/base.py", line 421, in parse_request_body_response
self.token = parse_token_response(body, scope=scope)
File "/usr/local/lib/python3.8/site-packages/oauthlib/oauth2/rfc6749/parameters.py", line 431, in parse_token_response
validate_token_parameters(params)
File "/usr/local/lib/python3.8/site-packages/oauthlib/oauth2/rfc6749/parameters.py", line 438, in validate_token_parameters
raise_from_error(params.get('error'), params)
File "/usr/local/lib/python3.8/site-packages/oauthlib/oauth2/rfc6749/errors.py", line 405, in raise_from_error
raise cls(**kwargs)
oauthlib.oauth2.rfc6749.errors.InvalidClientError: (invalid_client) AADSTS7000215: Invalid client secret is provided.
Trace ID: 5e70887e-b5eb-41ac-afb4-e2797dc21a00
Correlation ID: 19cf23c7-cb73-400c-97a3-c3cb900ac1aa
Timestamp: 2021-03-17 19:03:40Z

Thank you.
:)

Request task list / taskfolders / ...

Hi,
today I tried messing around with you amzing code. I wanted to see if I can get a taskfolders list. My idea was to change the endpoint to the URI listed in the docs and remove the not needed subject etc:

def test(self, subject=None, list_id=None, note=None, due_date=None, reminder_date_time=None):
    uri = self.api_endpoint + "/beta/me/taskfolders"
        
    try:
        # self.logger.debug("Create task request: %s", task_req)
        res = self.client.post(uri)
        res.raise_for_status()
        self.logger.debug("Create task response: %s", res.json())
    except HTTPError as e:
        self.logger.error("Unable to create task: %s. Response: %s", e, res.json())

    return res

But sadly this didn't work. The server responded with this error:
Write requests (excluding DELETE) must contain the Content-Type header declaration.
I also tried to change the request to self.client.get(uri), because in the docs there's a "GET" before the request URI - but then the auth didn't work anymore :(

Can you help me with what I have to change to tell the server that I don't want to write anything?

To do plugin authentication token errors

Hello,

Recently to do plugin started with the errors below:

2020-09-27 18:24:25 ERROR (MainThread) [homeassistant.components.calendar] Error while setting up microsoft_todo platform for calendar
Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/requests_oauthlib/oauth2_session.py", line 394, in request
url, headers, data = self._client.add_token(url,
File "/usr/local/lib/python3.8/site-packages/oauthlib/oauth2/rfc6749/clients/base.py", line 198, in add_token
raise TokenExpiredError()
oauthlib.oauth2.rfc6749.errors.TokenExpiredError: (token_expired)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 193, in _async_setup_platform
await asyncio.shield(task)
File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)
File "/config/custom_components/microsoft_todo/calendar.py", line 127, in setup_platform
todo_lists = tasks_api.get_lists()["value"]
File "/config/custom_components/microsoft_todo/outlook_tasks_api.py", line 95, in get_lists
res = self.client.get(uri, params=query_params)
File "/usr/local/lib/python3.8/site-packages/requests/sessions.py", line 543, in get
return self.request('GET', url, **kwargs)
File "/usr/local/lib/python3.8/site-packages/requests_oauthlib/oauth2_session.py", line 407, in request
token = self.refresh_token(
File "/usr/local/lib/python3.8/site-packages/requests_oauthlib/oauth2_session.py", line 374, in refresh_token
self.token = self._client.parse_request_body_response(r.text, scope=self.scope)
File "/usr/local/lib/python3.8/site-packages/oauthlib/oauth2/rfc6749/clients/base.py", line 421, in parse_request_body_response
self.token = parse_token_response(body, scope=scope)
File "/usr/local/lib/python3.8/site-packages/oauthlib/oauth2/rfc6749/parameters.py", line 431, in parse_token_response
validate_token_parameters(params)
File "/usr/local/lib/python3.8/site-packages/oauthlib/oauth2/rfc6749/parameters.py", line 438, in validate_token_parameters
raise_from_error(params.get('error'), params)
File "/usr/local/lib/python3.8/site-packages/oauthlib/oauth2/rfc6749/errors.py", line 405, in raise_from_error
raise cls(**kwargs)
oauthlib.oauth2.rfc6749.errors.InvalidGrantError: (invalid_grant) AADSTS70000: The provided value for the input parameter 'refresh_token' or 'assertion' is not valid. The token was issued for a different client id
Trace ID: VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV
Correlation ID: VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV
Timestamp: 2020-09-27 17:24:23Z

Any idea?

Thank you.

Failed request flooding

After my Home Assistant has been running for about an hour, automatic attempts to sync my to-do lists are failing, and immediately retried. This is resulting in a constant flood of requests, I’m seeing up to 7 per second. This doesn’t seem to stop as long as it’s running. Here’s one of them.

2021-04-17 08:41:30 ERROR (SyncWorker_15) [custom_components.microsoft_todo.calendar] Unable to get tasks: 401 Client Error: Unauthorized for url: https://graph.microsoft.com/beta/me/outlook/taskFolders/xxx/tasks?%24filter=status+ne+%27completed%27&%24top=100. Response: {'error': {'code': 'InvalidAuthenticationToken', 'message': 'Unable to initialize RPS', 'innerError': {'date': '2021-04-16T22:41:30', 'request-id': 'xxx', 'client-request-id': 'xxx'}}}
2021-04-17 08:41:30 ERROR (MainThread) [homeassistant.helpers.entity] Update for calendar.tasks fails
Traceback (most recent call last):
File "/opt/homeassistant/lib/python3.8/site-packages/homeassistant/helpers/entity.py", line 292, in async_update_ha_state
await self.async_device_update()
File "/opt/homeassistant/lib/python3.8/site-packages/homeassistant/helpers/entity.py", line 490, in async_device_update
raise exc
File "/usr/lib/python3.8/concurrent/futures/thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)
File "/opt/homeassistant/lib/python3.8/site-packages/homeassistant/util/__init__.py", line 278, in wrapper
result = method(*args, **kwargs)
File "/home/ha-arcana/.homeassistant/custom_components/microsoft_todo/calendar.py", line 234, in update
tasks_res = self._tasks_api.get_uncompleted_tasks(self._list_id)
File "/home/ha-arcana/.homeassistant/custom_components/microsoft_todo/outlook_tasks_api.py", line 65, in get_uncompleted_tasks
res.raise_for_status()
File "/opt/homeassistant/lib/python3.8/site-packages/requests/models.py", line 943, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 401 Client Error: Unauthorized for url: https://graph.microsoft.com/beta/me/outlook/taskFolders/xxx/tasks?%24filter=status+ne+%27completed%27&%24top=100

Perhaps maybe the large number of lists I have (27) could be causing some kind of rate limiting, or race condition. Really got no idea though.

Change time of sync

Is it possible to change the time of syncing between the cloud?
Since now it is only syncing when my HA instance restarts.

Token refresh issue

This morning, HA reported my google calendar token expired, so I deleted that file and REauthenticated it into Calendar.
(Edit: Typo fix)

Now I'm receiving a similar error with microsoft_todo:

2020-12-12 05:39:05 ERROR (MainThread) [homeassistant.components.calendar] Error while setting up microsoft_todo platform for calendar Traceback (most recent call last): File "/usr/local/lib/python3.8/site-packages/requests_oauthlib/oauth2_session.py", line 477, in request url, headers, data = self._client.add_token( File "/usr/local/lib/python3.8/site-packages/oauthlib/oauth2/rfc6749/clients/base.py", line 198, in add_token raise TokenExpiredError() oauthlib.oauth2.rfc6749.errors.TokenExpiredError: (token_expired)

Ok, so I Uninstalled/Installed this from the store again, renaming-off my .ms_todo_auth.json and Clicked the button to configure Microsoft To Do.

That completes, sends what appears to be a proper callback URL to my server with: /api/microsoft-todo?code=xxx&state=yyy

but then the browser shows:

500 Internal Server Error
Server got itself in trouble

The HA log then shows:

oauthlib.oauth2.rfc6749.errors.InvalidClientIdError: (invalid_request) AADSTS90023: Public clients can't send a client secret.
Trace ID: 6caea922-afac-4668-a0bf-c1bdef539700
Correlation ID: 9914964d-2f74-4616-9ed6-5108dc91ff61

Related?
Anyone else?

Thanks.

My Config:
`System Health

Home Assistant Core Integration

version: 0.118.5
installation_type: Home Assistant Container
dev: false
hassio: false
docker: true
virtualenv: false
python_version: 3.8.6
os_name: Linux
os_version: 4.19.107-Unraid
arch: x86_64
timezone: America/Los_Angeles

Home Assistant Cloud

logged_in: false
can_reach_cert_server: ok
can_reach_cloud_auth: ok
can_reach_cloud: ok

Lovelace

dashboards: 1
mode: storage
views: 6
resources: 18`

Can't Authenticate

Hi, sorry for creating this issue but instruction in your manual deos not work for me. I do exactly what you showed(URL with localhost and I get):
image

No code returned from Microsoft Graph Auth API

I was able to follow the setup, unfortunately after I entered all the needed details on my config, the notification configuration request leads me to a site where I get the following message: "No code returned from Microsoft Graph Auth API". What is wrong?

Server error 500: scope has changed

Running into issues authorising the app. My redirect_url is a Nabu Casa url (HTTPS).

Logs:

Logger: aiohttp.server
Source: custom_components/microsoft_todo/calendar.py:166
Integration: microsoft_todo (documentation)
First occurred: 11:48:44 (1 occurrences)
Last logged: 11:48:44

Error handling request
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/aiohttp/web_protocol.py", line 435, in _handle_request
    resp = await request_handler(request)
  File "/usr/local/lib/python3.10/site-packages/aiohttp/web_app.py", line 504, in _handle
    resp = await handler(request)
  File "/usr/local/lib/python3.10/site-packages/aiohttp/web_middlewares.py", line 117, in impl
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 60, in security_filter_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 94, in forwarded_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 28, in request_context_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 82, in ban_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 236, in auth_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 136, in handle
    result = await result
  File "/config/custom_components/microsoft_todo/calendar.py", line 185, in get
    token = await hass.async_add_executor_job(self.get_token, data.get("code"))
  File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/microsoft_todo/calendar.py", line 166, in get_token
    return self.oauth.fetch_token(
  File "/usr/local/lib/python3.10/site-packages/requests_oauthlib/oauth2_session.py", line 366, in fetch_token
    self._client.parse_request_body_response(r.text, scope=self.scope)
  File "/usr/local/lib/python3.10/site-packages/oauthlib/oauth2/rfc6749/clients/base.py", line 448, in parse_request_body_response
    self.token = parse_token_response(body, scope=scope)
  File "/usr/local/lib/python3.10/site-packages/oauthlib/oauth2/rfc6749/parameters.py", line 441, in parse_token_response
    validate_token_parameters(params)
  File "/usr/local/lib/python3.10/site-packages/oauthlib/oauth2/rfc6749/parameters.py", line 471, in validate_token_parameters
    raise w
Warning: Scope has changed from "Tasks.ReadWrite Tasks.ReadWrite.Shared" to "email profile Tasks.ReadWrite Tasks.ReadWrite.Shared openid".

Screenshot how it looks like

Can someone show me how this integration can look like in home assistant?

  1. Can I see all the todo lists?
  2. Can I show just a single one?
  3. How does a finished tasked looked like?

I'm looking how I can make a digital kitchen dashboard with multiple todo lists on it.

Error creating a task with due_date

Is anyone seeing an error trying to create a task using the due_date option?

service: microsoft_todo.new_task
data: {
"subject": "test",
"list_name": "Tasks",
"due_date": "2021-07-22"
}

2021-07-22 07:14:24 ERROR (MainThread) [homeassistant.helpers.script.websocket_api_script] websocket_api script: Error executing script. Unexpected error for call_service at pos 1: 'zoneinfo.ZoneInfo' object has no attribute 'zone'
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 371, in _async_step
    await getattr(self, handler)()
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 571, in _async_call_service_step
    await service_task
  File "/usr/src/homeassistant/homeassistant/core.py", line 1491, in async_call
    task.result()
  File "/usr/src/homeassistant/homeassistant/core.py", line 1530, in _execute_service
    await self._hass.async_add_executor_job(handler.job.target, service_call)
  File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 52, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/microsoft_todo/calendar.py", line 140, in handle_new_task
    tasks_api.create_task(subject, list_id, note, due_date, reminder_date_time)
  File "/config/custom_components/microsoft_todo/outlook_tasks_api.py", line 34, in create_task
    "timeZone": self.timezone.zone
AttributeError: 'zoneinfo.ZoneInfo' object has no attribute 'zone'

Microsoft To Do, version: 1.0.3

Home Assistant version core-2021.7.3
installation_type Home Assistant Container
dev false
hassio false
docker true
virtualenv false
python_version 3.9.5
os_name Linux
os_version 5.10.28-Unraid
arch x86_64
timezone America/Los_Angeles

2022.5. - CalendarEventDevice is deprecated

After upgrading to HA version 2022.5, I am getting the warning below. Not sure if this needs looked into or not.

Logger: homeassistant.components.calendar
Source: components/calendar/init.py:197
Integration: Calendar (documentation, issues)
First occurred: 3:13:10 PM (1 occurrences)
Last logged: 3:13:10 PM

CalendarEventDevice is deprecated, modify MSToDoListDevice to extend CalendarEntity

Use list_name without emojis

In MS ToDo you can add emojis to list names. If you want to add a task to such a list, you have to add it to list_name. This can look like this:
🍔List Name
or with more 'complex' emojis even like this:
👨\u200d💼List Name (it's this one: 👨‍💼)
Is it possible to ignore the emojis when filtering for the right list?

And another question which is not worth to open another issue, because I think I know the answer: Is it right that it is not possible to access "My Day" via the API at the moment?

Feature Request: Supress ToDo Lists from HA Calendar

With the new Calendar pane in HA, I'm perhaps realizing just now that all my ToDo lists are represented across calendar entities. Maybe these were all there before, but I'm just seeing them now in the new Calendar view.

Is there any way to suppress these? Or, do you need them in order to execute your functions?

Thanks. I don't know what I'd do without this component!

Cannot authenticate | duckdns | native client suggestion

Hi,

I have tried to configure this addon for few days now. When trying to configure it tries to authenticate via link including Raspberry local IP hence I receive error:

invalid_request: The provided value for the input parameter 'redirect_uri' is not valid. The expected value is a URI which matches a redirect URI registered for this client application.

When I manually change uri to url and IP to my duckdns domain I am able to push it through to authorize on Azure side. It even returns to my HA instance but still it seems to not receive token hence following error:

Unable to create task: 401 Client Error: Unauthorized for url: https://graph.microsoft.com/beta/me/outlook/tasks. Response: {'error': {'code': 'InvalidAuthenticationToken', 'message': 'Access token is empty.', 'innerError': {'date': '2020-10-14T19:30:02', 'request-id': 'some_id', 'client-request-id': 'id_same_as_the_other_one'}}}

Would it be able to incorporate alternative auth method similar to what following Office 365 addon uses? Authentication with this method was pretty straight forward there.

https://github.com/PTST/O365-HomeAssistant

FR: Show todo tasks in a simple, sorted, list

I only use Microsoft To-do's web interface to build plain and simple todo lists, and since I can't prioritise them (as I could in Wunderlist) in the tool I've named them according to "<1-5> - <task name".

I would like to be able to show this in a simple card in HASS to show what's the most important task(s) to start with in a project (I have multiple projects like this).

Is it possible to implement?

2022.3.0: Requirements for microsoft_todo not found: ['emoji==0.6.1'].

Heads up. 2022.3.0 update pops:

Platform error calendar.microsoft_todo - Requirements for microsoft_todo not found: ['emoji==0.6.1'].

After seeing this in the log, too:

2022-03-02 14:30:31 ERROR (SyncWorker_2) [homeassistant.util.package] Unable to install package emoji==0.6.1: 
ERROR: Could not find a version that satisfies the requirement emoji==0.6.1 
(from versions: 0.1.0, 0.2, 0.2.1, 0.3.0, 0.3.2, 0.3.3, 0.3.4, 0.3.5, 0.3.6, 0.3.8, 0.3.9, 0.4.0, 0.4.5, 
0.5.0, 0.5.1, 0.5.2, 0.5.3, 0.5.4, 0.6.0, 1.0.0, 1.0.1, 1.1.0, 1.2.0, 1.4.0, 1.4.1, 1.4.2, 1.5.0, 1.6.0, 1.6.1, 1.6.3)
ERROR: No matching distribution found for emoji==0.6.1

I modified the manifest file to change 0.6.1 to 0.6.0, and it looks like it's working for now.
Not familiar with this; could this be something they missed in this new Core Docker container?

Tnx

System Health

version core-2022.3.0
installation_type Home Assistant Container
dev false
hassio false
docker true
user root
virtualenv false
python_version 3.9.9
os_name Linux
os_version 5.10.28-Unraid
arch x86_64
timezone America/Los_Angeles
Home Assistant Community Store
GitHub API ok
GitHub Content ok
GitHub Web ok
GitHub API Calls Remaining 4821
Installed Version 1.23.0
Stage running
Available Repositories 1011
Downloaded Repositories 30
Home Assistant Cloud
logged_in false
can_reach_cert_server ok
can_reach_cloud_auth ok
can_reach_cloud ok
Lovelace
dashboards 2
resources 21
views 8
mode storage

Server Error 500 after Auth

After installation it says I AUTHORIZED SUCCESSFULLY and I click the Link Microsoft To Do account.
In a new window microsoft authentification appears and I return to my HA Servers URL https://[YOUR HOME ASSISTANT URL:PORT]/api/microsoft-todo?code=M57ca82ef-3f6b-15e7-cebc-c1113d8ccee2&state=jHbj90TAlDJRylAPPbU6z6uDbquF95 with the following error message:

500 Internal Server Error
Server got itself in trouble

The error log shows the following:

Log Details (ERROR)
Logger: aiohttp.server
Source: custom_components/microsoft_todo/calendar.py:171
First occurred: 9:57:16 AM (1 occurrences)
Last logged: 9:57:16 AM

Error handling request
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/aiohttp/web_protocol.py", line 418, in start
    resp = await task
  File "/usr/local/lib/python3.7/site-packages/aiohttp/web_app.py", line 458, in _handle
    resp = await handler(request)
  File "/usr/local/lib/python3.7/site-packages/aiohttp/web_middlewares.py", line 119, in impl
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/real_ip.py", line 39, in real_ip_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 72, in ban_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 127, in auth_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 120, in handle
    result = handler(request, **request.match_info)
  File "/config/custom_components/microsoft_todo/calendar.py", line 171, in get
    code=data.get("code")
  File "/usr/local/lib/python3.7/site-packages/requests_oauthlib/oauth2_session.py", line 307, in fetch_token
    self._client.parse_request_body_response(r.text, scope=self.scope)
  File "/usr/local/lib/python3.7/site-packages/oauthlib/oauth2/rfc6749/clients/base.py", line 421, in parse_request_body_response
    self.token = parse_token_response(body, scope=scope)
  File "/usr/local/lib/python3.7/site-packages/oauthlib/oauth2/rfc6749/parameters.py", line 431, in parse_token_response
    validate_token_parameters(params)
  File "/usr/local/lib/python3.7/site-packages/oauthlib/oauth2/rfc6749/parameters.py", line 438, in validate_token_parameters
    raise_from_error(params.get('error'), params)
  File "/usr/local/lib/python3.7/site-packages/oauthlib/oauth2/rfc6749/errors.py", line 405, in raise_from_error
    raise cls(**kwargs)
oauthlib.oauth2.rfc6749.errors.InvalidClientIdError: (invalid_request) AADSTS50194: Application '896612c0-2d90-48f2-9293-eac27fd19aed'(Home Assistant) is not configured as a multi-tenant application. Usage of the /common endpoint is not supported for such applications created after '10/15/2018'. Use a tenant-specific endpoint or configure the application to be multi-tenant.
Trace ID: 969e2502-0d1a-4370-8578-d9859b4e4400
Correlation ID: a67b4821-b646-48a4-b535-4af72309a9e5
Timestamp: 2020-05-01 07:57:16Z

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.