Integration to integrate with ha-familysafety.
IMPORTANT: Do not use configuration.yaml
to configure this integration as it is not supported
This integration will set up the following platforms.
Platform | Description |
---|---|
Sensor | Screen time specified as a duration sensor measured in minutes for overall account and/or applications |
Sensor | Number of pending requests for a given account |
Switch | Block access to platforms |
This integration will register the following services.
Service | Description |
---|---|
Block App | Blocks a specified application from running |
Unblock App | Allow a specified application to run |
Approve Request* | Approves a pending request |
Deny Request* | Denies a pending request |
- The target entity that you use should be the used screen time sensor that is registered for the account you wish to block an application for.
- Application names must be exactly as seen in the extra state attributes for the used screen time sensor, for example:
- For "LEGO® CITY UNDERCOVER: 0"
- Use "LEGO® CITY UNDERCOVER" (without quotes)
As of 2024.12.0b0, support for pending requests has been added. Each time pending requests are retrieved (so everytime a request is approved/denied or on each update interval) this GUID of the specific request will change, therefore if used in automations, you should retrieve the GUID for use in the service calls by filtering the requests
attribute found under the Pending Requests
sensor.
If you would like to try, enable experimental features in the options flow (after initial configuration). This is found in the Configure collected accounts
menu.
- Using the tool of choice open the directory (folder) for your HA configuration (where you find
configuration.yaml
). - If you do not have a
custom_components
directory (folder) there, you need to create it. - In the
custom_components
directory (folder) create a new folder calledfamily_safety
. - Download all the files from the
custom_components/family_safety/
directory (folder) in this repository. - Place the files you downloaded in the new directory (folder) you created.
- Restart Home Assistant
- In the HA UI go to "Configuration" -> "Integrations" click "+" and search for "Microsoft Family Safety"
IMPORTANT: Make sure you do the following steps after starting the config flow as the response token can expire very quickly
- First authorize a session by navigating to the following URL: https://login.live.com/oauth20_authorize.srf?cobrandid=b5d15d4b-695a-4cd5-93c6-13f551b310df&client_id=000000000004893A&response_type=code&redirect_uri=https%3A%2F%2Flogin.live.com%2Foauth20_desktop.srf&response_mode=query&scope=service%3A%3Afamilymobile.microsoft.com%3A%3AMBI_SSL&lw=1&fl=easi2&login_hint=
- Once logged in you should be taken to a blank page copy the full URL in the address bar (including
https
) - Paste the copied URL into the
OAuth response URL
field in the Home Assistant UI.
From the configuration menu:
-
Additional entities can be configured to create switches to unlblock or block specific applications and also register screen time sensors
- Select "Configure application entities"
- Select required applications from list and press "Submit"
-
You can control what accounts are collected
- Select "Configure collected accounts"
- A list of available accounts to control will appear, check the box next to the name of the account you would like entities for. NOTE: By default no options are selected and therefore all accounts will be collected
If you want to contribute to this please read the Contribution guidelines