HTTP
The HTTP integration is the web server of Home Assistant. It can ban an IP address after too many failed logins: set login_attempts_threshold under http in your configuration, and an address that gets the login wrong that many times is refused from then on. Home Assistant writes every ban to ip_bans.yaml in your configuration folder.
Lifting a ban again takes editing that file and restarting Home Assistant. Often it is your own phone that got banned, after a password change. Spook adds an action that lists the bans, and one that lifts a ban right away, no file editing and no restart.
Both need IP banning on in Home Assistant. It is, unless you set ip_ban_enabled: false under http in your configuration. With it off, Home Assistant keeps no bans, and both actions say so.
Actions
Spook adds two actions to the HTTP integration. You find them wherever you add an action, marked with a 👻. Both are for administrators only: who gets in is not up to everybody in your home.
List IP bans
Lists the IP addresses Home Assistant has banned, with when each was banned. The oldest ban comes first.
How to use it
- Open the automation or script that needs the list, and select Add action.
- Search for bans, and select HTTP: List IP bans 👻.
- Under Response variable, give the list a name, like
bans. The steps after this one can use it. - Select Save.
Just want to see who is banned? Try this action opens it in your Home Assistant, ready to run once. The list shows up below the action.
| Action properties | |
|---|---|
| Action | HTTP: List IP bans 👻 |
| Action name | http.list_bans |
| Action targets | No targets |
| Action response | Yes, the banned addresses and when each was banned |
| Spook's influence | Newly added action |
| Tools | Try this action |
This action takes no data.
The response:
| Attribute | Type | Description |
|---|---|---|
bans | list | The bans, the oldest first. |
bans[].ip_address | string | The banned IP address. |
bans[].banned_at | string | When it was banned, in UTC, like 2026-12-01T09:30:00+00:00. |
These are the bans Home Assistant is holding right now. A ban you add to ip_bans.yaml by hand only counts after a restart, so it is not listed before that. An entry in that file Home Assistant cannot read is not listed either: Home Assistant skips it, and so does the ban.
Send yourself the list of banned addresses:
- action: http.list_bans
response_variable: banned
- action: notify.persistent_notification
data:
title: Banned IP addresses
message: >-
{% for ban in banned.bans %}
{{ ban.ip_address }} since {{ ban.banned_at }}
{% else %}
Nobody is banned.
{% endfor %}
Unban IP address
Lifts the ban on one or more IP addresses. Right away: the next request from that address is let in, without a restart. Spook also takes the ban out of ip_bans.yaml, so it stays lifted after a restart.
The failed logins Home Assistant counted for that address are forgotten too. Otherwise one more typo would ban it again straight away.
An address that is not banned is skipped, not an error. Ask for the response to see which addresses were actually unbanned: an address missing from it was not banned, or has a typo in it.
How to use it
- Open the automation or script that should lift the ban, and select Add action.
- Search for unban, and select HTTP: Unban IP address 👻.
- Under IP address, enter the addresses to unban.
- Select Save.
Locked out your own phone? Try this action from a device that is not banned. It opens the action in your Home Assistant, ready to run once.
| Action properties | |
|---|---|
| Action | HTTP: Unban IP address 👻 |
| Action name | http.unban_ip |
| Action targets | No targets |
| Action response | Optional, the addresses that were unbanned |
| Spook's influence | Newly added action |
| Tools | Try this action |
| Action data parameters | |||
|---|---|---|---|
| Attribute | Type | Required | Default / Example |
ip_address | string | list of strings | Yes | 203.0.113.7 |
The response:
| Attribute | Type | Description |
|---|---|---|
unbanned | list of strings | The addresses that were banned and no longer are, in the order you gave. |
Both IPv4 and IPv6 addresses work. Something that is not an IP address is refused before anything is unbanned. An IPv6 address matches however it is written, so 2001:db8::1 lifts a ban written as 2001:DB8:0::1, and the response writes it the short way.
Lift the ban on two addresses, and check which ones were banned:
- action: http.unban_ip
data:
ip_address:
- 203.0.113.7
- "2001:db8::1"
response_variable: result
- action: notify.persistent_notification
data:
message: "Unbanned: {{ result.unbanned | join(', ') or 'nothing' }}"
- Spook writes
ip_bans.yamlanew when it takes a ban out. Every other ban in it stays, but comments in the file do not. - An unban writes back every ban Home Assistant still holds. A ban you took out of the file by hand, without a restart since, comes back in it. Lift it with this action instead.
- The file is only written when a ban was in it. Unbanning an address that is not in the file leaves the file alone, comments included.
- If the file cannot be written, the ban is still lifted, until the next restart. The action fails with an error that says so.
Missing something here?
An action, an entity or a repair this integration should have? Say so. Stuck, or found a bug? There is help.
