Closed ceskyDJ closed 1 year ago
Hi, I found an error in my logs. It looks like everything is working but errors appear in logs. Could you look at it, please?
Probably fine. It might have something to do with a sensor that was setup in homeassistant but later removed from uptimekuma or vice versa.
Yes, it sounds like a possible scenario. Thanks for the fix. I'm sorry, I only looked at my phone. So, could you fix that for cleaner logs, please?
If the case is what I indicated, then you would either need to remove the extra entity from homeassistant or UptimeKuma
How can I find the entity causing those troubles? I don't know, what change could do that. I modify only Uptime Kuma entities. In HA I just moved some sensors to rooms.
@ceskyDJ, @meichthys - noting that the KeyError is triggered by a key value of 3.0, this is likely related to monitors being in maintenance mode - ref. uptime_kuma_api.MonitorStatus. I had the same error occur during my overnight maintenance window, and was able to fix it by adding another entry to SENSORS_INFO in custom_components/uptime_kuma/sensor.py i.e.:
SENSORS_INFO = {
0.0: StatusValue(value="down", icon="mdi:television-off"),
1.0: StatusValue(value="up", icon="mdi:television-shimmer"),
2.0: StatusValue(value="pending", icon="mdi:sync"),
3.0: StatusValue(value="maintenance", icon="mdi:wrench"),
}
Apologies I don't have time to create a PR today but will endeavour to come back to this when I get a chance.
Thanks for this info. This sounds promising since I've never seen this issue but also never used maintenance mode. I'll take a look at it when I get some timeš
@ceskyDJ, @meichthys - noting that the KeyError is triggered by a key value of 3.0, this is likely related to monitors being in maintenance mode - ref. uptime_kuma_api.MonitorStatus. I had the same error occur during my overnight maintenance window, and was able to fix it by adding another entry to SENSORS_INFO in custom_components/uptime_kuma/sensor.py i.e.:
SENSORS_INFO = { 0.0: StatusValue(value="down", icon="mdi:television-off"), 1.0: StatusValue(value="up", icon="mdi:television-shimmer"), 2.0: StatusValue(value="pending", icon="mdi:sync"), 3.0: StatusValue(value="maintenance", icon="mdi:wrench"), }
Apologies I don't have time to create a PR today but will endeavour to come back to this when I get a chance.
Nice work! Thanks a lot for finding the cause of my error.
This error originated from a custom integration.
Logger: homeassistant Source: custom_components/uptime_kuma/sensor.py:73 Integration: Uptime Kuma (documentation, issues) First occurred: June 30, 2023 at 13:47:18 (182 occurrences) Last logged: June 30, 2023 at 14:18:17