meichthys / uptime_kuma

Uptime Kuma HACS integration
110 stars 23 forks source link

added summary sensor #64

Closed PhilippMundhenk closed 1 year ago

PhilippMundhenk commented 1 year ago

as discussed in https://github.com/meichthys/uptime_kuma/issues/29 (though much smaller scope)

Summary sensors are possible in Home Assistant, but flexible groups with wildcards require additional custom components, or significant templating. A simple sensor that automatically considers all uptime kuma instances without additional configuration is helpful.

Implementation is simple enough, but yes, maintenance might be required in future. I will support if I can, but I leave the decision to integrate this to @meichthys.

meichthys commented 1 year ago

Thanks @PhilippMundhenk I will take a look at this soon 👍

PhilippMundhenk commented 1 year ago

Take your time! I have to admit it is not the nicest code I have ever written, but it does the job.

I did find a bit more time and also added the attributes suggested in #29, might actually be helpful: grafik

Not sure if I am handling the HA entity management correctly though. My first time working on a custom component. If you have the time, some extra scrutiny would be appreciated, esp. around sensor setup, naming, etc.

PhilippMundhenk commented 1 year ago

Marking this as draft, will have to fix the sensor naming: Currently, only a single UK instance can be configured, as hard-coded sensor naming of sensor.uptimekuma clashes...

meichthys commented 1 year ago

LGTM 👍 Any reason why the _INFO dictionaries include a decimal 0? It seems like the decimal will never change?

alexdelprete commented 1 year ago

This functionality is great. Thank you for implementing it.

PhilippMundhenk commented 1 year ago

LGTM 👍 Any reason why the _INFO dictionaries include a decimal 0? It seems like the decimal will never change?

I think I just copy & paated the existing infos. Tried to keep the same style. No reason from my side.