Skip to content

Instantly share code, notes, and snippets.

@GAS85
Created June 20, 2025 14:57
Show Gist options
  • Save GAS85/d80e5fa04b90b6605d89846f657a9510 to your computer and use it in GitHub Desktop.
Save GAS85/d80e5fa04b90b6605d89846f657a9510 to your computer and use it in GitHub Desktop.
Home Assistant, AbuseIPDB and dynamic IP via Fritzbox

How to Get the Rating of Your IP Address from AbuseIPDB with Home Assistant

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.

Prerequisites

  1. Home Assistant server
  2. An IP address sensor — in this example, we use a FritzBox to get the external IP (sensor.fritz_box_7590_ui_external_ip)
  3. Access to configuration.yaml

Update the Script

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..."

Final Notes

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment