Login control - Logout your users via automation

Simple component that adds service that logs out (clear its refresh tokens) specific user. Used as a workaround for https://github.com/home-assistant/home-assistant/issues/30124 .

Example use:

- alias: 'Logout all guests at midnight'
    platform: time
    at: '00:00:00'
    service: token_control.clear_refresh_tokens
      user_id: [YOUR USER ID HERE]

Hi! I put the “login_control” folder under in my “custom_components” and restarted Home Assistant. I do not have a token_control.clear_refresh_tokens service.

Is there something else I’m supposed to do?

EDIT 1 - put “token_control:” in your Home Assistant Config

I get an error when trying to use the service:

"Call-service API error. Error Message: ‘NoneType’ object has no attribute ‘refresh_tokens’ "

Yes, you have to out login_control: in your configuration.

I have answered you on github regarding error messages (just to keep things structured).

Hi, I did:

  • I put the “login_control” folder under in my “custom_components” and restarted Home Assistant.
  • I put “login_control:” in my Home Assistant Config (configuration.yaml).
  • I checked the configuration and got the error: Component error: login_control - Integration “login_control” not found.
    Please am I missing something?
    Thank you!

Integration was missing a version. Please try downloading it again now.

I downloaded it again but the error continues.

I was only able to get it to work when replacing token_control with login_control in init.py and in manifest.json.
I made a Pull Request with the change.

Merged, thanks.