I would like to get some help to create an Automation to send a notification when this error appears in the logs. It appears on a weekly basis and requires a manual process to reauthorise the integration, so it would be useful to get a prompt to my iPhone when the error appears.
Logger: homeassistant.config_entries
Source: config_entries.py:283
First occurred: 17:02:24 (1 occurrences)
Last logged: 17:02:24
Config entry 'Configuration.yaml' for nest integration could not authenticate: Access token failure: ('invalid_grant: Token has been expired or revoked.', {'error': 'invalid_grant', 'error_description': 'Token has been expired or revoked.'})
Hey, I just happened to see your post when looking for something else, but here’s an example I used to trigger a sensor when my honeywell thermostat started acting up. This will stay on so long as the system isn’t rebooted (or you roll the logs some other way), so you might need to tweak it:
- platform: command_line
command: if grep -i '\[homeassistant.components.honeywell.const\] SomeComfort update failed' /config/home-assistant.log >/dev/null; then echo ON; else echo OFF; fi
name: honeywell_broken
you can test it by running the grep command by itself against your log file and seeing if it returns the error (assuming the error is present in the current log).
Hm… my first thought is that they might have change the error message. Does the grep still return the error when it happens? You can just run it in the console:
grep -i 'nest integration could not authenticate' /config/home-assistant.log
I receive the following response when i run the command:
> 2022-03-04 13:12:38 WARNING (MainThread) [homeassistant.config_entries] Config entry 'Configuration.yaml' for nest integration could not authenticate: Access token failure: ('invalid_grant: Token has been expired or revoked.', {'error': 'invalid_grant', 'error_description': 'Token has been expired or revoked.'})