Home Assistant
On this page
The obacht integration shows each child's screen time in Home Assistant and lets automations pause a child's devices or give extra time. It uses only obacht's public API with a parent API token, so it can do nothing the parent app can't.
What you get
One device per child, with:
| Entity | What |
|---|---|
sensor.<child>_screen_time_today | Minutes counted today; attributes: minutes per category |
sensor.<child>_time_left_today | Minutes left of the daily total (unknown when unlimited); attributes: minutes left per category |
sensor.<child>_active_schedule | The schedule blocking now (bedtime, pause, ...) or none; attribute until |
switch.<child>_pause | On while a pause runs. Turning it on pauses all of the child's devices (60 minutes by default; change it in the integration's options) |
button.<child>_15_more_minutes | Adds 15 minutes to every budget for today |
and on the obacht device sensor.obacht_extra_time_requests: the number of requests waiting
for a parent, with the list (id, child, minutes, category, reason) in the requests attribute.
Per-app times are not copied into Home Assistant; they stay in the parent app.
Actions (services):
| Action | Fields |
|---|---|
obacht.give_extra_time | child (device), minutes, optional category (e.g. games) |
obacht.pause | child, minutes (at most 24 hours) |
obacht.end_pause | child |
obacht.approve_request | request_id, optional minutes (instead of the asked amount) |
obacht.deny_request | request_id |
The integration listens to obacht's live event stream (/api/v1/events), so changes from the
parent app, the children's devices and new requests show up within seconds. It also polls every
minute, since time left goes down without any event.
Install
- In the parent app, open Account → API tokens and create a token named
home-assistant. - Copy
integrations/home-assistant/custom_components/obachtfrom this repository into Home Assistant'sconfig/custom_components/and restart Home Assistant. On NixOS:services.home-assistant.customComponents = [ inputs.obacht.packages.${pkgs.system}.home-assistant-obacht ]; - Settings → Devices & services → Add integration → obacht: enter the server address
(e.g.
https://obacht.example.org) and the token.
If the token is revoked, Home Assistant asks for a new one.
Examples
Pause the kids' devices when dinner is ready:
automation:
- alias: Dinner
triggers:
- trigger: state
entity_id: input_boolean.dinner_ready
to: "on"
actions:
- action: switch.turn_on
target:
entity_id: [switch.anna_pause, switch.ben_pause]
Give 20 minutes when chores are done:
actions:
- action: obacht.give_extra_time
data:
child: <Anna's device id>
minutes: 20
Notify a phone when a child asks for more time:
automation:
- alias: Extra-time request
triggers:
- trigger: state
entity_id: sensor.obacht_extra_time_requests
conditions:
- condition: template
value_template: "{{ trigger.to_state.state | int(0) > trigger.from_state.state | int(0) }}"
actions:
- action: notify.mobile_app_phone
data:
message: >
{% set r = state_attr('sensor.obacht_extra_time_requests', 'requests')[0] %}
{{ r.child }} asks for {{ r.minutes }} more minutes: {{ r.reason }}
Development
The tests run against a fake obacht server with pytest-homeassistant-custom-component:
nix build .#home-assistant-obacht -L # builds the component and runs its tests (CI)
cd integrations/home-assistant && pytest # with pytest-homeassistant-custom-component installed
ruff check and ruff format use the settings in integrations/home-assistant/pyproject.toml.
This page is part of obacht's documentation, licensed under CC BY 4.0. Source on GitHub · CC BY 4.0 · Version: main (976f125)