pdreker / fritz_exporter

Prometheus exporter for Fritz!Box home routers
Other
144 stars 32 forks source link

Possible implementation of Smart Home metrics? #224

Closed thedatabaseme closed 9 months ago

thedatabaseme commented 9 months ago

Hi there,

is there any possibility which I'm not aware of, to get Smart Home metrics from FritzBox connected AVM / Dect devices? There should be a TR64 interface for that.

Kind regards Philip

pdreker commented 9 months ago

I just checked and there are indeed some nmetrics from the HomeAutomation function in the TR-064 services. I personally don't use the Fritz! HomeAutomation on my box, so I cannot say for sure, how useful these metrics are, but it should be possible to implement them.

No promises, I have a lot going on at the moment, but I will have a look.

kind regards, Patrick

thedatabaseme commented 9 months ago

I also found this exporter which I use currently in parallel to your exporter. So it's not that urgent really.

Philip

pdreker commented 9 months ago

And through the magic of GitHub CoPilot, I whipped up a quick and dirty implementation 😀

This completely untested aside from me making sure it does not break anything else at first glance. It is currently unreleased, but you may simply run the develop image from docker.io/pdreker/fritz_exporter:develop to try it out. Metrics shpould appear under fritz_ha_* and should simply show everything the box considers to be "enabled and valid".

The code relies on the assumption, that the HA devices are using indices in sequence (so "0, 1, 2, 3, 4, ..." and not "1, 3, 6, 10, ..." to enumerate the devices.

Give it a whirl and provide feedback 😄

kind regards, Patrick

thedatabaseme commented 9 months ago

What is missing as difference to the other mentioned exporter, is the "Window open" state of the thermostats. Also I can't find the battery charge level in the metrics. The rest seems to be fine on first sight.

pdreker commented 9 months ago

I have implemented everything that is available or documented by AVM according to this: https://avm.de/fileadmin/user_upload/Global/Service/Schnittstellen/x_homeauto.pdf

Battery state and window sensors are not mentioned in documented TR-064 API, so I presume, that this information is just not there in TR-064. It seems the other exporter uses an HTTP API, which my exporter does not use, so the amount of information available may differ.

thedatabaseme commented 9 months ago

Ah. Good to know. Thanks then for your quick implementation.

pdreker commented 9 months ago

I will close this issue, as I think I have implemented what I could and I have just released 2.3.0, which includes the new feature.

Thanks for the report!