Enable/disable a user or view via service

My circumstances are such that I want to provide access to a view with a camera stream to a family member during certain days/hours for them to be able to monitor their child while they are under the care of another family member at my house. However, I only want them to have this access during the days/hours that they’re child is there, and remove access during other hours. If I could disable their user or the one view I’ve given them access to via a service, I could write an automation to take care of this, but I have so far failed to find anything in home assistant to do this.

Is anyone aware of a service or other way of doing this?

Thanks in advance.

Hi,

Have you found a solution for you problem?
I am looking for something similar.

I still have not. Being able to automate enabling/disabling a user would be huge, but I still am not aware of how to do this, or if it’s even possible at this point.

Its been a while.

Any luck/News in this?

@jolerius I haven’t discovered how to do this if at all possible, no. I also haven’t really explored it much since shortly after asking the question.

If spook installed

service: homeassistant.disable_entity
data:
  entity_id:
    - person.francis

view I don’t know.

@francisp , have you tried this? It doesn’t seem to enable/disable users and their ability to log in or not for me. I ran the homeassistant.disable_entity (and enable_entity) for the person. entity and was sill able to log in. The active log in the User dialog was still switched on as well.

If I manually turn the “Active” switch off in the User dialog - I get the expected behavior. When they try to log in, they see:

image

Error: Login blocked: User is not active
image

I’d love to be able to perform this action via a service/action call.