Uptime-kuma to home-assistant

Yes. That’s right. Are there other statuses that can be reported? It’s been a while since I developed this. At the time i thought there were only on and off statuses reported by UptimeKuma.

Yes, Paused and Unknown.

1 Like

Ok, neat. Right now the integration only exposes a binary sensor, so it’s just on and off, but contributions are definitely welcome!

1 Like

I’ll take it as is, I have nothing to offer, pure noob, thanks for sharing.

could you share the code? thanks

type: logbook
title: History Stats
hours_to_show: 12
entities:
  - sensor1
  - sensor2
  - etc...

I’ve added the custom integration via HACS but don’t really see any information on how to set it up.

So, something went wrong earlier this morning, and not all monitors were being reported to HA, they all came back after reloading the integration, nothing in logs as well.

image

Go to, Configuration > Devices and Service > Add Integration (bottom right), then search for uptime kuma.

All outlined in the repo GitHub - meichthys/uptime_kuma: Uptime Kuma HACS integration

Hmm, it’s not there.

I already tried to re-install the HACS integration itself.
Of course I have rebooted after the installation. It’s showing no errors.
Something must be missing.

Yet another re-install and the update to 2022.6.6 (the update took care of the reboot) suddenly made the integration appear.

Very weird.

For unknown reasons I do not see any entities, though. Yes, I know they are not shown directly. But even when searching for them in the developers section, I do not find any.

hmm …

Dieser Fehler wurde von einer benutzerdefinierten Integration verursacht

Logger: aiohttp.server
Source: custom_components/uptime_kuma/config_flow.py:55
Integration: Uptime Kuma
First occurred: 13:19:59 (2 occurrences)
Last logged: 13:20:12

Error handling request
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/uptime_kuma_monitor.py", line 30, in update
    response = requests.get(
  File "/usr/local/lib/python3.9/site-packages/requests/api.py", line 75, in get
    return request('get', url, params=params, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/requests/api.py", line 61, in request
    return session.request(method=method, url=url, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/requests/sessions.py", line 529, in request
    resp = self.send(prep, **send_kwargs)
  File "/usr/local/lib/python3.9/site-packages/requests/sessions.py", line 639, in send
    adapter = self.get_adapter(url=request.url)
  File "/usr/local/lib/python3.9/site-packages/requests/sessions.py", line 732, in get_adapter
    raise InvalidSchema("No connection adapters were found for {!r}".format(url))
requests.exceptions.InvalidSchema: No connection adapters were found for '192.168.178.63:3001/metrics'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/aiohttp/web_protocol.py", line 435, in _handle_request
    resp = await request_handler(request)
  File "/usr/local/lib/python3.9/site-packages/aiohttp/web_app.py", line 504, in _handle
    resp = await handler(request)
  File "/usr/local/lib/python3.9/site-packages/aiohttp/web_middlewares.py", line 117, in impl
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 60, in security_filter_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 100, in forwarded_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 28, in request_context_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 79, in ban_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 220, in auth_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 137, in handle
    result = await result
  File "/usr/src/homeassistant/homeassistant/components/config/config_entries.py", line 205, in post
    return await super().post(request, flow_id)
  File "/usr/src/homeassistant/homeassistant/components/http/data_validator.py", line 62, in wrapper
    result = await method(view, request, *args, **kwargs)
  File "/usr/src/homeassistant/homeassistant/helpers/data_entry_flow.py", line 109, in post
    result = await self._flow_mgr.async_configure(flow_id, data)
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 260, in async_configure
    result = await self._async_handle_step(
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 335, in _async_handle_step
    result: FlowResult = await getattr(flow, method)(user_input)
  File "/config/custom_components/uptime_kuma/config_flow.py", line 55, in async_step_user
    utkm = await self.hass.async_add_executor_job(
  File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/local/lib/python3.9/site-packages/uptime_kuma_monitor.py", line 26, in __init__
    self.update()
  File "/usr/local/lib/python3.9/site-packages/uptime_kuma_monitor.py", line 41, in update
    raise UptimeKumaError(
uptime_kuma_monitor.UptimeKumaError: Could not fetch Uptime Kuma metrics: No connection adapters were found for '192.168.178.63:3001/metrics'

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