fritzcollectd icon indicating copy to clipboard operation
fritzcollectd copied to clipboard

Does this plugin support fritzdect-200 power consumtion readout?

Open DSDV opened this issue 5 years ago • 15 comments

Hello, i want to use the Fritz Dect 200 to messure my power consumption for diffrent setups. at the moment i plan to use 3 devices. https://en.avm.de/products/fritzdect/fritzdect-200/ does this plugin allow to grab the data of the devices?

with kind regards

PS: sorry for my bad english

DSDV avatar Nov 04 '18 09:11 DSDV

Currently fritzcollectd has only rudimentary support of dect devices. Mainly because I don't have any DECT devices for testing here.

The following values are reported to collectd: multimeter power, multimeter energy, switch state and temperature. Currently they are reported as dect-0 ... dect-X, and it's not optimal to find out which is what.

Also there's currently no support for dect devices in my dashboard on grafana.com. But you can add that easily.

fetzerch avatar Nov 04 '18 13:11 fetzerch

Hm .. that seems to be ok 👍 i only want to show how much energy consumtion each of the dect devices report maybe as graph so you can see where the peek times of powerconsumtion are.

if i donate you a dect 200 would that increase your support for that device?

DSDV avatar Nov 04 '18 18:11 DSDV

I just noticed, the ordering of my devices changed after restart of collectd (dect4 is suddenly dect3). Maybe I will find some time to debug this further, or even implement some kind of name resolution.

conrad784 avatar Sep 02 '19 14:09 conrad784

I have a setup with multiple (>10) DECT200 boxes and they're mixed up on every reboot or restart which is quite annoying because you have to do the identification job again (which id is which box) and (even more important) because history data gets wrong when you correct the id-to-box assignment because in influxdb data is organised by the "1-dectX" id and this id is/might be re-assigned to a different device on restart/reboot. Would be great if that's possible to fix as it renders history data useless.

chris-hoe avatar Feb 26 '20 11:02 chris-hoe

I've found a simple solution to the DECT200 devices getting mixed up on restart/reboot: I've changed the query that way that fritzcollect adds the AIN to the name instead of the id. This way the id can change (and will) but the values are always logged to the same series because the AIN is constant. I replaced line 80/81: (ServiceAction('X_AVM-DE_Homeauto:1', 'GetGenericDeviceInfos', 'NewIndex', 'NewIndex', 'dect'), with: (ServiceAction('X_AVM-DE_Homeauto:1', 'GetGenericDeviceInfos', 'NewIndex', 'NewAIN', 'dect'), and the instance names change to something like this "1-dectxxxxx yyyyyy" where xxxxx yyyyyy is the AIN which will never change for a certain DECT200 box.

chris-hoe avatar Feb 26 '20 13:02 chris-hoe

I used 'NewDeviceName' instead of 'NewAIN', this way I can see the device names I have used for the DECT 200 devices.

jum avatar Apr 09 '20 16:04 jum

I've found a simple solution to the DECT200 devices getting mixed up on restart/reboot: I've changed the query that way that fritzcollect adds the AIN to the name instead of the id. This way the id can change (and will) but the values are always logged to the same series because the AIN is constant. I replaced line 80/81: (ServiceAction('X_AVM-DE_Homeauto:1', 'GetGenericDeviceInfos', 'NewIndex', 'NewIndex', 'dect'), with: (ServiceAction('X_AVM-DE_Homeauto:1', 'GetGenericDeviceInfos', 'NewIndex', 'NewAIN', 'dect'), and the instance names change to something like this "1-dectxxxxx yyyyyy" where xxxxx yyyyyy is the AIN which will never change for a certain DECT200 box.

In wich file I have to edit the code or do I need to reinstall collectd and edit the "init.py"?

DennisCor avatar Aug 17 '20 07:08 DennisCor

Just check where fritzcollectd ended up being installed using "pip show fritzcollectd". I used a patch like this for my modification:

diff -u __init__.py.orig __init__.py
--- __init__.py.orig    2020-04-09 17:49:08.000000000 +0200
+++ __init__.py 2020-04-09 18:01:45.000000000 +0200
@@ -78,7 +78,7 @@
           Value('linkdownstreammax', 'bitrate'),
           'NewLayer1UpstreamMaxBitRate': Value('linkupstreammax', 'bitrate')}),
         (ServiceAction('X_AVM-DE_Homeauto:1', 'GetGenericDeviceInfos',
-                       'NewIndex', 'NewIndex', 'dect'),
+                       'NewIndex', 'NewDeviceName', ''),
          {'NewMultimeterPower': Value('power', 'power'),
           'NewMultimeterEnergy': Value('energy', 'power'),
           'NewTemperatureCelsius': Value('temperature', 'temperature'),

jum avatar Aug 17 '20 08:08 jum

Just check where fritzcollectd ended up being installed using "pip show fritzcollectd". I used a patch like this for my modification:

diff -u __init__.py.orig __init__.py
--- __init__.py.orig    2020-04-09 17:49:08.000000000 +0200
+++ __init__.py 2020-04-09 18:01:45.000000000 +0200
@@ -78,7 +78,7 @@
           Value('linkdownstreammax', 'bitrate'),
           'NewLayer1UpstreamMaxBitRate': Value('linkupstreammax', 'bitrate')}),
         (ServiceAction('X_AVM-DE_Homeauto:1', 'GetGenericDeviceInfos',
-                       'NewIndex', 'NewIndex', 'dect'),
+                       'NewIndex', 'NewDeviceName', ''),
          {'NewMultimeterPower': Value('power', 'power'),
           'NewMultimeterEnergy': Value('energy', 'power'),
           'NewTemperatureCelsius': Value('temperature', 'temperature'),

Thanks for your fast response Jum. With "pip show fritzcollectd" I figured out where fritzcollectd is saved. I have no clue how to write a patch. So I changed the "init.py" directly with nano. But now I don't get any Data anymore. Cancel the change don’t bring it back to work, "sudo apt-get update && sudo apt-get -y upgrade" just like that. So unfortunately, I think I have to reinstall my system.

DennisCor avatar Aug 17 '20 12:08 DennisCor

I would say you changed the white space while editing the python code, and python is very sensitive to white space changes (it is part of the language's syntax). I would try to move the backup copy of that file (before you started editing) in place and try again, really obeying python syntax rules. If you do not have any backup of the file from before editing, you will have to use:

pip install --force-reinstall fritzcollectd

To get back a clean install dir.

jum avatar Aug 17 '20 12:08 jum

Now I learned how to make updates with a patch. A Really useful thing, thank you. But with your diff it won't work nevertheless. I think it should be + 'NewIndex', 'NewDeviceName', 'dect'), instead of + 'NewIndex', 'NewDeviceName', ''), ?

I changed it that way and now it continues collecting data. In influx/grafana the instance = 1-NameOfMyDect200 apears. But the values are still saved to instance = 1-dect0 like before !?

And by the way, could someone tell me in wich units the values are ? Energy = W and Power = Wh ? or is it kW ?

DennisCor avatar Aug 19 '20 11:08 DennisCor

Now I learned how to make updates with a patch. A Really useful thing, thank you. But with your diff it won't work nevertheless. I think it should be + 'NewIndex', 'NewDeviceName', 'dect'), instead of + 'NewIndex', 'NewDeviceName', ''), ?

I changed it that way and now it continues collecting data. In influx/grafana the instance = 1-NameOfMyDect200 apears. But the values are still saved to instance = 1-dect0 like before !?

This is exactly the reason why I made that 'dect' string the empty string, I just wanted to use my own chosen name. I have not researched more into the 'NewIndex' thing, as this causes the name to be '1-myName', but this was not really a concern to me as I could easily filter that using a regular expression in Grafana/Influx, where I view my collectd data.

And by the way, could someone tell me in wich units the values are ? Energy = W and Power = Wh ? or is it kW ?

I used in my graphs for power the label W, and it corresponded pretty much to what was going through when I turned on the electric kettle. I did not graph energy, I believed it to be not important for my usage case.

jum avatar Aug 19 '20 11:08 jum

Now I learned how to make updates with a patch. A Really useful thing, thank you. But with your diff it won't work nevertheless. I think it should be + 'NewIndex', 'NewDeviceName', 'dect'), instead of + 'NewIndex', 'NewDeviceName', ''), ? I changed it that way and now it continues collecting data. In influx/grafana the instance = 1-NameOfMyDect200 apears. But the values are still saved to instance = 1-dect0 like before !?

This is exactly the reason why I made that 'dect' string the empty string, I just wanted to use my own chosen name. I have not researched more into the 'NewIndex' thing, as this causes the name to be '1-myName', but this was not really a concern to me as I could easily filter that using a regular expression in Grafana/Influx, where I view my collectd data.

You are right, I forgot to reboot. Now everything works the way I want. Thank you for your help.

DennisCor avatar Aug 19 '20 11:08 DennisCor

Thanks for the patch. I had also the problem, that the dect numbers changes during night when my FritzBox gets a new DSL connection. I'm very happy to have my own assigned names now in Grafana.

Can this change be made officially in github, @fetzerch ?

I monitor temperature, power consumption and switch state in an own Grafana dashboard. I have also plugged in 2 solar modules into a FritzDect200, so I can see how much power they produce.

UweBeckert avatar Dec 31 '20 15:12 UweBeckert

Hi @UweBeckert, I also want to do this. Can you please provide/share your Grafana dashboard :-) Thank you!

tomikais avatar Aug 12 '21 07:08 tomikais