- alias: 'Logout all guests at midnight'
trigger:
platform: time
at: '00:00:00'
action:
service: token_control.clear_refresh_tokens
data:
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
EDIT 2
I get an error when trying to use the service:
"Call-service API error. Error Message: ‘NoneType’ object has no attribute ‘refresh_tokens’ "
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!
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.
Thanks.
I’m only just getting off the ground with adding things to Home Assistant.
Any assistance would be greatly appreciated.
re Matejdro / login_control in Github I see
login_control/init.py
login_control/manifest.json
login_control/services.yaml
Do I copy these 3 files to the folder homeassitant/custom_components/login_control
in what file and where do I place the following
alias: ‘Logout all guests at midnight’
trigger:
platform: time
at: ‘00:00:00’
action:
service: token_control.clear_refresh_tokens
data:
user_id: [YOUR USER ID HERE]
Yes, you just copy those 3 files and then add login_control: to your configuration.yaml file.
Then you can use automation editor to create an automation that triggers clear refresh tokens service, no need to create this copy paste yaml automation.
Try finding “token_control.clear_refresh_tokens” in the list. If not, it’s likely that the plugin did not load. Did you restart HA after adding it to the custom components folder? Check Settings → System → logs → full log to see if anything is mentioned there.
thank you,
I completely overlooked [quote=“matejdro, post:12, topic:156930”]
and then add login_control: to your configuration.yaml file
[/quote]
Have now added “Login Control: clear_refresh_tokens”
I had added user_id: “John Schols” to services.yaml and then changed to user_id: ‘John Schols’ and then also user_id: John Schols all hae come up with the same error. HAve I missed something?
Error in log.
Logger: homeassistant.helpers.service
Source: helpers/service.py:561
First occurred: 14:20:06 (1 occurrences)
Last logged: 14:20:06
Unable to parse services.yaml for the login_control integration: expected a dictionary for dictionary value @ data[‘clear_refresh_tokens’][‘fields’][‘user_id’]
this is the text in the services.yaml
clear_refresh_tokens:
fields:
user_id: John Schols
description: User ID (String) of the user that should get refresh tokens cleared
Again, there is so much I don’t know yet. Thanks. However still failing. Is it only in the services.yaml that I need to add the user_id or does it need to be added into
the ‘init’.py also. Is there anything else I need to be adding?
Huh, it should display service data or service parameters somewhere. Otherwise, sorry, it appears that this is only compatible with the YAML automations: Automation YAML - Home Assistant