Uptime-kuma to home-assistant

Did you enter the above as the url?

No, I entered http://192.168.178.63 and port 3001 in the configuration.

When I open http://192.168.178.63/metrics manually, I get usable data, though.

Hi meichthys,

I’m really struggling getting this installed. I’ve tried adding the custom repo to HACS as usual and nothing happens. I’ve also tried manually downloading the code into the custom components folder - it is listed in the HA log file at startup, but I can’t add the integration.

Any ideas what might be preventing this from being installed?

Thanks

Try using an older HACS version. I’m not familiar with the newest changes since they were merged in from a recent pull request.

Can someone help me to use this data into sensors?

monitor_status{monitor_name="qBittorrent VPN",monitor_type="ping",monitor_url="https://",monitor_hostname="qbittorrent_vpn",monitor_port="null"} 1
monitor_status{monitor_name="Bazarr",monitor_type="ping",monitor_url="https://",monitor_hostname="bazarr",monitor_port="null"} 1

hello is there a way to link uptime kuma to the uptime custom card from hacs please ?
How to monitor servers in Home Assistant - Share your Projects! - Home Assistant Community (home-assistant.io)

would be great to have a simple full tutorial
for une sensor from kuma to uptime custom card for beginners like me, please :slight_smile:

hello impossible to add uptime kuma integration to hacs, because archived repo ?

when i click add in HACS nothing happens, then when i try to add integration
there is no uptime kuma in the list :frowning:

uptime kuma is installed and i have some monitored servers,
but impossible to add sensors into HA :frowning:

@warlordattack Sorry about that. I’ve unarchived it. I had archived the wrong repo :man_facepalming:

2 Likes

now everythig is OK :+1:

1 Like

This might well be a silly question but what’s the difference between this and the one on the add-on store?

The HA add-on is just a dockerized version of Uptime Kuma. Same code.

1 Like

For anyone who has used webhooks to send up/down notifications from Uptime Kuma to HA, could you share some of the POST URL formatting on the Uptime side and then how you passed that to a notification in a HA automation?

I have a very static config running for a few monitored services using a 1:1 mapping between webhook and automation but I assume there has to be a better way by passing data in the POST.

Thanks!

In the 42 minutes since I made that post, it seems that using MQTT may be easier. I did have to build a docker image for Uptime Kuma adding MQTT but that was pretty straightforward.

Uptime Kuma notification config.

I run the Mosquito Broker add-on in HA.

HA Automation is really simple. Listens for the topic as a trigger:

Then fires a notification via push including the payload:
image

And voila!

Note that the docker image build is really simple and taken from a Uptime Kuma Git issue.

FROM louislam/uptime-kuma:latest
RUN apt update
RUN apt --yes install python3
RUN apt-get install python3-setuptools
RUN pip3 install --no-cache --upgrade pip paho-mqtt

You can grab this image here:
https://hub.docker.com/repository/docker/jasonshearer/uptime-kuma-mqtt

Hey All,

I didn’t realise I could use the integration to send an mqtt message out. I’ve configured the alert as below however I’m seeing the error “No output from Apprise” when I try to test the configuration.
Any hints would really be appreciated.

Thanks,
Paul

Paul…did you deploy uptime kuma from the default repo? If so, it does not have a MQTT client. See my note above around how I added MQTT.

hi Jason,
I’m a touch “dumb” when it comes to understanding docker images, but I don’t think my system setup supports them. I’m using HA OS on a Pi 4, don’t run docker. Or maybe I’m just not understanding it correctly.

For those interested in using webhooks, I inspected the contents with of a Kuma webhook with tcpflow -p -c port 80. This is what is sent when a Kuma monitor detects a system is DOWN:

{
"heartbeat":{"monitorID":7,"status":0,"time":"2022-09-18 21:02:58.073","msg":"ping: <hostname>: Temporary failure in name resolution\n","important":true,"duration":8},
"monitor":{"id":7,"name":"ping-test","url":"https://","method":"GET","hostname":"<hostname>","port":null,"maxretries":0,"weight":2000,"active":1,"type":"ping","interval":20,"retryInterval":20,"resendInterval":0,"keyword":null,"expiryNotification":false,"ignoreTls":false,"upsideDown":false,"maxredirects":10,"accepted_statuscodes":["200-299"],"dns_resolve_type":"A","dns_resolve_server":"1.1.1.1","dns_last_result":null,"pushToken":null,"docker_container":"","docker_host":null,"proxyId":null,"notificationIDList":{"2":true},"tags":[],"mqttUsername":"","mqttPassword":"","mqttTopic":"","mqttSuccessMessage":"","databaseConnectionString":null,"databaseQuery":null,"authMethod":null,"authWorkstation":null,"authDomain":null,"radiusUsername":null,"radiusPassword":null,"radiusCalledStationId":null,"radiusCallingStationId":null,"radiusSecret":null},
"msg":"[ping-test] [.... Down] ping: <hostname>: Temporary failure in name resolution\n"
}

A similar message is sent when the system is detected UP (except that status is set to 1).

For my use case, I have individual sensors for each service that I’m monitoring (requires a bit of boilerplate in Kuma and HA), but this is an example from what my configuration looks like in HA for two services that I’m monitoring in Kuma (I’m monitoring Kuma itself to be able to distinguish between all services being down, and Kuma itself being down)

template:
  - binary_sensor:
      - name: "Kuma Status"
        state: "{{ trigger.json.heartbeat.status }}"
        icon: >
          {% if trigger.json.heartbeat.status == 1 %}
            mdi:check-network-outline 
          {% else %}
            mdi:close-network-outline
          {% endif %}
        device_class: connectivity
    trigger:
      - platform: webhook
        webhook_id: kuma-status
  - binary_sensor:
      - name: "Nextcloud Status"
        state: "{{ trigger.json.heartbeat.status }}"
        icon: >
          {% if trigger.json.heartbeat.status == 1 %}
            mdi:check-network-outline 
          {% else %}
            mdi:close-network-outline
          {% endif %}
        device_class: connectivity
    trigger:
      - platform: webhook
        webhook_id: nextcloud-status
2 Likes

Hello, can You share how You achieve that cards?

I don’t have the same layout as before, but similar.

image

You need to create template sensors, then add them using the button cards in whatever layout you like.

Template Sensors

template:
  - sensor:
      - name: "Up"
        state_class: total
        icon: hass:cloud-upload
        unique_id: uptimekumaup
        state: "{{ states.sensor | selectattr( 'state', '==', 'up' ) | selectattr('attributes.icon', 'defined') | selectattr( 'attributes.icon', '==', 'mdi:television-shimmer' ) | list | length }}"

      - name: "Down"
        state_class: total
        icon: hass:cloud-download
        unique_id: uptimekumadown
        state: "{{ states.sensor | selectattr( 'state', '==', 'down' ) | selectattr('attributes.icon', 'defined') | selectattr( 'attributes.icon', '==', 'mdi:television-off' ) | list | length }}"

      - name: "Paused"
        state_class: total
        icon: hass:cloud
        unique_id: uptimekumapaused
        state: "{{ states.sensor | selectattr( 'state', '==', 'pause' ) | selectattr('attributes.icon', 'defined') | selectattr( 'attributes.icon', '==', 'mdi:television-shimmer' ) | list | length }}"

Cards

type: custom:vertical-stack-in-card
cards:
  - type: markdown
    content: |-
      ![Image](/local/images/uptime_kuma_header_logo3.png)
  - type: horizontal-stack
    cards:
      - show_name: true
        show_icon: true
        type: button
        entity: sensor.up
        show_state: true
        tap_action:
          action: more-info
        hold_action:
          action: none
      - show_name: true
        show_icon: true
        type: button
        entity: sensor.down
        show_state: true
        tap_action:
          action: more-info
        hold_action:
          action: none

This is what it looks like currently

image

2 Likes

Thank You very much. Works great. It’s possible to make visible if some service is down? I mean to display the name of that service?