Skip to content

About

Read-only Home Assistant integration for PatchMon: patch status, security updates and required restarts of your hosts

Topics

Resources

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

PatchMon for Home Assistant

PatchMon for Home Assistant

Release Marketplace (HACS) Validate Tests License: MIT

An unofficial, read-only Home Assistant integration for PatchMon: see the patch status of every host PatchMon monitors (pending and security updates, required restarts, agent check-ins) in Home Assistant.

Sensors of a host in Home Assistant: pending updates, reporting, restart required, security updates and update status

Note

Not affiliated with or endorsed by the PatchMon project.

This integration was written with Claude (AI-assisted) and is reviewed and tested by the maintainer on a live Home Assistant instance.

Features

  • Read-only by design: the integration uses only the official PatchMon Integration API with the host:get permission. It never patches hosts, approves updates or deletes anything.
  • A device per host: pending and security updates, update status, required restarts and agent check-ins, with a link to the host page in PatchMon.
  • Totals on the server device: hosts, hosts with (security) updates, hosts requiring a restart and hosts not reporting.
  • Update entity: lists the packages with updates as release notes.
  • Actions: return the host list, or the package list of one host, to scripts, automations and voice assistants.

Requirements

  • Home Assistant 2026.9.0 or newer
  • PatchMon 2.x server reachable from Home Assistant

Installation

Marketplace (HACS), recommended

Open in the Marketplace (HACS)

  1. Open the link above, or go to Settings → Marketplace and search for PatchMon.
  2. Select Install. If Home Assistant asks for a restart, restart it, then continue with Setup.

On Home Assistant before 2026.11, the link opens the older Marketplace (HACS) from the sidebar: select Download, then restart Home Assistant.

Manual

  1. Copy custom_components/patchmon_hass into /config/custom_components/.
  2. Restart Home Assistant.

Setup

Create an API token in PatchMon

Create a dedicated token for Home Assistant, so you can revoke it on its own:

  1. In PatchMon, open Settings → API integrations → Scoped Credentials and click New Credential.

    Scoped Credentials in the PatchMon settings

  2. Give the token a name and tick only GET under Host Permissions (host:get). Never tick DELETE or any other permission.

  3. Optional: under Allowed IP Addresses, enter the IP address of your Home Assistant.

  4. Click Create Token and copy the token key and secret. PatchMon shows the secret only once.

    New token with only the GET permission

Add the integration

Add integration

  1. Settings → Devices & services → Add integration → PatchMon, or use the button above.

  2. Enter:

    Field Example
    Server address http://192.168.1.10:3000 or https://patchmon.example.com
    Token key / secret from the token you created above
    Verify SSL certificate only applies to https; turn off for a self-signed certificate
    Area optional: new hosts and the server device are placed in this area
    Optional entities one switch each for updates, running kernel, installed kernel and installed packages on every host

The area only applies when a device is added, so devices you move later stay where you put them.

Options (polling interval, host group filter, area, optional entities) are under Configure on the integration entry. The four entities that are disabled by default (updates, running kernel, installed kernel, installed packages) each have a switch there: switching it enables or disables that entity on every host, and new hosts get it as the switch says. Single entities can still be switched by hand afterwards.

If the token is changed or expires, Home Assistant asks for a new one. Reconfigure changes the address, the token or the certificate check without losing anything (leave the secret empty to keep the current one).

Each PatchMon server can be added once. Setup recognises the same server under a second address (IP and name, LAN and reverse proxy) by its hosts and stops; use Reconfigure on the existing entry to switch it to the new address instead.

Devices and entities

The PatchMon server is a device of its own; every host is a device linked to it, with a link to the host page in PatchMon. Hosts added in PatchMon appear by themselves, hosts deleted in PatchMon are removed together with their entities. Only the host list decides that a host is gone: if it is suddenly empty (also right after a restart), nothing is removed. Home Assistant lets you delete a host device yourself only while PatchMon does not list that host (or while the entry is not loaded); the server device cannot be deleted. A deleted host device gets its entities back when PatchMon lists the host again.

Per host

Entity Type Notes
Pending updates Sensor
Security updates Sensor
Update status Sensor Up to date, updates pending, security update required
Restart required Binary sensor
Restart reason Sensor Diagnostic; PatchMon's reason while a restart is needed, otherwise unknown
Reporting Binary sensor Off when the agent is overdue or stale (PatchMon's own limits); attribute reporting_state
Last check-in Sensor Diagnostic
Agent version Sensor Diagnostic
Last boot Sensor Diagnostic
Running kernel, installed kernel Sensor Diagnostic, disabled by default
Installed packages Sensor Diagnostic, disabled by default
Updates Update Diagnostic, disabled by default, see below

Diagnostic entities of a host in Home Assistant: agent version, last boot, last check-in, restart reason and the update entity

On the server device

Totals over all hosts. A host is left out of a total while you have disabled the entity of that host the total is based on:

Total Leaves out a host while this entity of the host is disabled
Hosts the host device itself
Hosts with updates, total pending updates Pending updates
Hosts with security updates, total security updates Security updates
Hosts requiring restart Restart required
Hosts not reporting Reporting

A host whose device is disabled counts in no total. For example, if one host always reports a required restart that you do not care about, disable its Restart required and Hosts requiring restart no longer counts it. The totals change as soon as you disable or enable an entity. Hidden entities still count. The actions do not look at disabled entities, see Actions.

The update entity

PatchMon has no version number for a whole host, so the update entity uses labels instead of versions:

Situation Installed version Latest version
No pending updates current current
One pending update current 1 update
Pending updates current 16 updates
Pending updates, some for security current 16 updates (1 security)

Release notes shows the packages with updates (security updates first, at most 50). There is no install button: the integration is read-only. Skip hides only the label shown at that moment: once the number of updates changes, the update shows up again. The update entity is disabled by default so that many hosts do not crowd the update list in the Home Assistant settings; enable it per host if you want it.

Host group filter

With a host group filter, only hosts of the selected groups are added. If a selected group has no hosts in PatchMon any more (deleted or emptied), Home Assistant shows a repair issue and keeps the devices of those hosts as unavailable instead of removing them. Update the filter under Configure.

Actions

All actions only read; none of them changes anything in PatchMon.

Action What it does
patchmon_hass.get_hosts Returns the hosts with their patch status as of the last update, without asking PatchMon. Optional filters: PatchMon server, update status, restart required, reporting.
patchmon_hass.get_packages Reads the packages of one host from PatchMon and returns them, security updates first. Options: only with updates (default on), only security updates, limit (default 50, at most 1000), include descriptions (default off, makes the answer much longer).
patchmon_hass.refresh Reads the host list and the host details from PatchMon now, for all hosts or the selected devices. It does not make the agents report: values only change after their next check-in.

get_hosts returns count and a list hosts. Each host has the name it has in Home Assistant (your own name if you renamed the device), PatchMon's name as patchmon_name, the device ID, the server, the operating system, update status, pending and security updates, whether a restart is required and why, the reporting state, the last check-in and the agent version.

get_hosts always returns what PatchMon reports, also for hosts whose entities you disabled. A host whose Restart required is disabled still has restart_required: true and is returned by the filter restart_required: true. To leave hosts out, filter the answer in your script or automation, by name or by a label on their devices (see Examples).

get_packages returns the host's name and device_id, total (packages matching the options), truncated (more than the limit) and a list packages, each with name, current_version, available_version, needs_update, security_update and, if asked for, description.

How data is updated

  • The host list with the update counters is read every 5 minutes (1 to 60, under Configure).
  • Kernel, restart reason, last boot and agent version are read for a host only when its agent has reported again since, and at least every 6 hours.
  • The package list is read only when you open the release notes of an update entity or call get_packages.
  • PatchMon itself only knows what the agents report, on their own schedule.

Examples

Notify when a host needs security updates:

triggers:
  - trigger: numeric_state
    entity_id: sensor.patchmon_hosts_with_security_updates
    above: 0
actions:
  - action: patchmon_hass.get_hosts
    data:
      update_status: security_required
    response_variable: result
  - action: notify.notify
    data:
      title: Security updates
      message: >
        {{ result.hosts | map(attribute='name') | join(', ') }}

A script for a voice assistant ("Which servers need a restart?"):

sequence:
  - action: patchmon_hass.get_hosts
    data:
      restart_required: true
    response_variable: result
  - stop: done
    response_variable: result

The same script, but leaving out hosts you do not want to hear about. get_hosts returns every host PatchMon reports, so the script removes them from the answer:

sequence:
  - action: patchmon_hass.get_hosts
    data:
      restart_required: true
    response_variable: result
  - variables:
      answer:
        hosts: >
          {{ result.hosts
             | rejectattr('device_id', 'in', label_devices('PatchMon ignore'))
             | list }}
  - stop: done
    response_variable: answer
  • By label (as above): create a label, for example PatchMon ignore, and add it to the device of each host to leave out (Settings → Devices & services → Devices → the host → edit). To leave out another host later, only add the label to its device; the script stays the same.
  • By name: replace the filter line with | rejectattr('name', 'in', ['backup', 'test-vm']). Use the device names as shown in Home Assistant (your own name if you renamed the device).

Troubleshooting

  • Repair "answer from PatchMon not understood": the server answered in a way the integration does not understand, for example because the address points to the web interface behind a proxy or the PatchMon version is not supported yet. Check the address with Reconfigure. The repair goes away by itself once an answer is understood again.
  • "The address redirects to another one": the address answers with a redirect, typically from http:// to https:// or to the login page of a proxy. Redirects are not followed, so the token never goes to another address; enter the address PatchMon answers on directly.
  • Token rejected: Home Assistant asks for a new token (re-authentication). Check that the token is enabled, not expired, has host:get and, if restricted, allows the IP address of Home Assistant.
  • Diagnostics: the integration entry and every device offer Download diagnostics. The server address, the token, host names, IP addresses and machine IDs are removed from the file. Host group names and PatchMon's restart reason text stay in it.
  • Debug logging: enable it on the integration entry, or add custom_components.patchmon_hass: debug under logger: → logs: in configuration.yaml. The log then shows every request to PatchMon (path, HTTP status, duration), how many hosts were listed, which hosts had their details read again and why (no details yet, reported again, older than 6 hours, refresh action), and which devices were added or removed. Host names appear in it. The integration's own messages never contain the server address or the token, but lines from Home Assistant itself show the entry title, which contains the address; check before sharing.

Known limitations

  • Only PatchMon 2.x is supported (tested with 2.1.8).
  • No push yet: changes arrive with the next poll.

Removal

  1. Settings → Devices & services → PatchMon → three-dot menu → Delete. This removes all devices and entities of that server.
  2. Optional: Settings → Marketplace → PatchMon → three-dot menu → Uninstall, then restart Home Assistant.
  3. Delete the API token in PatchMon (Settings → API integrations → Scoped Credentials).

License

MIT

About

Read-only Home Assistant integration for PatchMon: patch status, security updates and required restarts of your hosts

Topics

Resources

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages