This guide adds a sensor to Home Assistant that checks whether your IP address has been reported to AbuseIPDB. You'll need to register an account and obtain an API key.
- Home Assistant server
- An IP address sensor — in this example, we use a FritzBox to get the external IP (
sensor.fritz_box_7590_ui_external_ip
) - Access to
configuration.yaml
Add the following to your configuration.yaml
:
sensor:
- platform: rest
name: AbuseIPDB Score
resource_template: "https://api.abuseipdb.com/api/v2/check?ipAddress={{ states('sensor.fritz_box_7590_ui_external_ip') }}&maxAgeInDays=90&verbose=true"
method: GET
headers:
Key: !secret abuseipdb_api_key
Accept: application/json
json_attributes:
- ipAddress
- isPublic
- ipVersion
- isWhitelisted
- abuseConfidenceScore
- countryCode
- usageType
- isp
- domain
- hostnames
- isTor
- totalReports
- numDistinctUsers
- lastReportedAt
value_template: "{{ value_json.data.abuseConfidenceScore }}"
Update your secrets.yaml
with your AbuseIPDB API key:
abuseipdb_api_key: "123abc..."
Whenever the system starts or your IP address changes, the sensor will update with the current abuse confidence score. You can replace sensor.fritz_box_7590_ui_external_ip
with any other sensor that provides a valid IP address.