Pi.Alert: Device Monitoring/ IP address inventory tool

I would like to share a little gem I have recently discovered on GitHub. As soon as I started developing my own ESPHome devices, I realized that my IPv4 home range was getting messy, and keeping up with the changes was becoming challenging. Sadly, Home Assistant doesn’t have a built-in way of managing this. However, I have found a solution: Pi.Alert. It has been my best new friend lately.

You can find Pi.Alert on GitHub at the following link:

Pi.Alert

Pi.Alert scans the devices connected to your WiFi/LAN and alerts you to the connection of unknown devices. It also provides warnings when an “always connected” device disconnects. Additionally, Pi.Alert offers the ability to check the availability of web services.

The setup process is well explained on the website, so I won’t repeat it here.

Pi.Alert provides a very basic API, and the author explains how to integrate it with Home Assistant. You can find instructions on how to do this in the following link:

Pi.Alert API Usage with Home Assistant

I hope someone will find this little piece of software as useful as I did.

7 Likes

Looks to be very handy.

Nice one! :wink: Thanks for sharing!

Hello,
due the changes on 2023.6,

the way to define a command_lines sensor changed

This is the update sensor definition for PiAlert properties

command_line: 
  - sensor:
      name: "PiAlert - Last Scan"
      command: curl -k -X POST -F 'api-key=--todo-api-key-here--' -F 'get=system-status' http://[mypialerthost]/pialert/api/
      scan_interval: 200
      unique_id: pialert.status.lastscan
      value_template: '{{ value_json.Last_Scan }}'

  - sensor:
      name: "PiAlert - All Devices"
      command: curl -k -X POST -F 'api-key=--todo-api-key-here--' -F 'get=system-status' http://[mypialerthost]/pialert/api/
      scan_interval: 200
      unique_id: pialert.status.alldevices
      unit_of_measurement: ""
      value_template: '{{ value_json.All_Devices }}'

  - sensor:
      name: "PiAlert - Online Devices"
      command: curl -k -X POST -F 'api-key=--todo-api-key-here--' -F 'get=system-status' http://[mypialerthost]/pialert/api/
      scan_interval: 200
      unique_id: pialert.status.onlinedevices
      unit_of_measurement: ""
      value_template: '{{ value_json.Online_Devices }}'

  - sensor:
      name: "PiAlert - Offline Devices"
      command: curl -k -X POST -F 'api-key=--todo-api-key-here--' -F 'get=system-status' http://[mypialerthost]/pialert/api/
      scan_interval: 200
      unique_id: pialert.status.offlinedevices
      unit_of_measurement: ""
      value_template: '{{ value_json.Offline_Devices }}'

  - sensor:
      name: "PiAlert - Archived Devices"
      command: curl -k -X POST -F 'api-key=--todo-api-key-here--' -F 'get=system-status' http://[mypialerthost]/pialert/api/
      scan_interval: 200
      unique_id: pialert.status.archiveddevices
      unit_of_measurement: ""
      value_template: '{{ value_json.Archived_Devices }}'

  - sensor:
      name: "PiAlert - New Devices"
      command: curl -k -X POST -F 'api-key=--todo-api-key-here--' -F 'get=system-status' http://[mypialerthost]/pialert/api/
      scan_interval: 200
      unique_id: pialert.status.newdevices
      unit_of_measurement: ""
      value_template: '{{ value_json.New_Devices }}'

  - sensor:
      name: "PiAlert - Scanning"
      command: curl -k -X POST -F 'api-key=--todo-api-key-here--' -F 'get=system-status' http://[mypialerthost]/pialert/api/
      scan_interval: 120
      unique_id: pialert.status.scanning
      value_template: '{{ value_json.Scanning }}'

Also mind that in my case, I had to add an “/pialert/” to the url as the api are not served from the root but from this secondary path

Hello, implement what is described here in my system and it works correctly, but I have a question, would it be possible to have more detailed information on the new devices, directly on HA, or failing that, at least be able to have some information for when detects a new device make an automation, for a notice… THANK YOU!

You will need to go to github (link in the first post) and raise that as a feature request.