andig / pimatic-fritz

Pimatic plugin for Fritz!Box SmartHome and FritzDect!200 Node
GNU General Public License v2.0
8 stars 6 forks source link

No values anymore after update #7

Closed leader21 closed 9 years ago

leader21 commented 9 years ago

After the update to ver. 0.2.3 Pimatic doesn't get any values anymore. I'm using the DECT200 with the Actor version no. 3.37. My Fritzbox is a 6360 from Unitymedia with Firmware 6.04 I can switch the outlet on and off with Pimatic without any issue! It's only the values that do not appear.

Gui :

Variables :

Plugin :

    {
      "plugin": "fritz",
      "url": "http://fritz.box",
      "user": "XXX",
      "password": "YYY",
      "interval": 60,
      "loglevel": "debug"
    },

Device :

    {
      "id": "fritzdect200-1",
      "name": "Fritz DECT 200",
      "class": "FritzOutlet",
      "ain": "087610123395",
      "interval": 60
    },

some debug output : Any ideas?

andig commented 9 years ago

For the time being please downgrade to 0.2.2.

mwittig commented 9 years ago

Can you please check if you have the latest Fritz!OS firmware installed - According to what I have found on the AVM website a newer version FRITZ!OS 6.20 or higher should be available.

NB: According to the AVM interface documentation the API is supported since FRITZ!OS 6.00. However, possibly, the early 6.0x versions have some undocumented limitations or bugs.

andig commented 9 years ago

a newer version FRITZ!OS 6.20 or higher should be available.

He is running 6.04 which should be sufficient.

the early 6.0x versions have some undocumented limitations or bugs.

You've mention the code would fallback to the old method (which I didn't check honestly while being on the road). I'm afraid I'll have to roll back unless we can find a better solution.

mwittig commented 9 years ago

Sorry, for the misunderstanding. May be my wording was a bit misleading. Let's wait for reply from @leader21 I think the the Fritz!OS version he is using is outdated - if not or @leader21 is not able to upgrade for other reasons, I am happy to implement a fallback solution.

leader21 commented 9 years ago

Sorry I cannot update the OS myself since this is a special version from my VDSL provider Unitymedia. Therefore I need to stay on the OS until they decide to update it with newer verions of their own. There isn't even an update button, they do it all automatically on remote.

mwittig commented 9 years ago

Too bad, AVM no longer provides offline updates. In the past it was relatively easy to remove the OEM-branding and to use the plain vanilla firmware which typically worked without problems - cable modems may be a different story, however.

For your case I have added the "legacyMode" for now to get you going (see https://github.com/mwittig/pimatic-fritz/blob/master/README.md). Note, however, @andig has not yet accepted my PR.

@andig also suggested to implement an automatic fallback mode which in my opinion is more difficult to implement and needs further investigation, i.e, which failure states can be regarded as "feature not supported". The advantage of the declarative approach (provided with the PR) is its simplicity and robustness.

andig commented 9 years ago

Merged and upped version number, please give it a try. If this doesn't i'll back out the change.

leader21 commented 9 years ago

even if avm would provide any offline firmware updates, i wouldn't be able to bring it into the fbox without any update menu.

updated the plugin to 0.2.4 but still the same issue. sorry to tell you.

mwittig commented 9 years ago

Did you set "legacyMode" = true as described in the README? This will execute the same code for attribute update as v0.2.2

leader21 commented 9 years ago

oha! totally missed that!! will try immediately!

leader21 commented 9 years ago

works!!! sorry, i haven't seen the new option on the readme. i just set the legacy mode to true and all is good :) as you described - no temp readings but i'll wipe them with the xattributeoptions. thanks!!

mwittig commented 9 years ago

OK, great :)

archipita commented 9 years ago

mwittig, I am sorry to append my note here, as the issue is closed, but I have exactly the same problem as leader21 since the last plugin update. I am using a 7390 with OS 06.23 and the plugin release 0.2.4. I have tried both without setting the new legacyMode variable and setting it to false, as in my case the temperature should be available. Previously has worked perfectly for months. Any hint? Thank you.

mwittig commented 9 years ago

Strange, I have the same model with the same firmware!

Can you please send the log (with debug level enabled), Thanks! Does switching works for you? If not, this must be a different problem!

TomLil commented 9 years ago

I have also no values after update, using latest plugin 0.2.4, 7330 with 06.21 firmware. here the debug output (I masked some numbers of the IDs to xxx):

17:32:18 debug [pimatic-fritz]: [ { identifier: '08761 xxxxxxx', id: '16', functionbitmask: '896', fwversion: '03.37', manufacturer: 'AVM', productname: 'FRITZ!DECT 200', present: '1', name: 'Spitzboden', switch: { state: '0', mode: 'manuell', lock: '0' }, powermeter: { power: '0', energy: '9070' }, temperature: { celsius: '261', offset: '0' } }, { identifier: '08761 xxxxxxx', id: '17', functionbitmask: '896', fwversion: '03.37', manufacturer: 'AVM', productname: 'FRITZ!DECT 200', present: '1', name: 'Aquarium Licht', switch: { state: '1', mode: 'auto', lock: '0' }, powermeter: { power: '23240', energy: '74523' }, temperature: { celsius: '233', offset: '0' } }, { identifier: '08761 xxxxxxx', id: '18', functionbitmask: '896', fwversion: '03.37', manufacturer: 'AVM', productname: 'FRITZ!DECT 200', present: '1', name: 'Flur', switch: { state: '0', mode: 'manuell', lock: '0' }, powermeter: { power: '0', energy: '92612' }, temperature: { celsius: '223', offset: '0' } }, { identifier: '08761 xxxxxxx', id: '19', functionbitmask: '896', fwversion: '03.37', manufacturer: 'AVM', productname: 'FRITZ!DECT 200', present: '1', name: 'Wohnzimmer', switch: { state: '0', mode: 'manuell', lock: '0' }, powermeter: { power: '0', energy: '10106' }, temperature: { celsius: '234', offset: '0' } }, { identifier: '08761 xxxxxxx', id: '20', functionbitmask: '896', fwversion: '03.37', manufacturer: 'AVM', productname: 'FRITZ!DECT 200', present: '1', name: 'Küche', switch: { state: '0', mode: 'manuell', lock: '0' }, powermeter: { power: '0', energy: '3100' }, temperature: { celsius: '230', offset: '0' } }, { identifier: '08761 xxxxxxx', id: '21', functionbitmask: '896', fwversion: '03.37', manufacturer: 'AVM', productname: 'FRITZ!DECT 200', present: '1', name: 'Bad', switch: { state: '0', mode: 'auto', lock: '0' }, powermeter: { power: '0', energy: '12598' }, temperature: { celsius: '234', offset: '0' } }, { identifier: 'xx:xx:xx:xx:xx:xx', id: '20000', functionbitmask: '640', fwversion: '06.20', manufacturer: 'AVM', productname: 'FRITZ!Powerline 546E', present: '1', name: 'Gartenlicht', switch: { state: '0', mode: 'auto', lock: '0' }, powermeter: { power: '0', energy: '8226' } } ] 17:32:17 debug [pimatic-fritz]: 1Spitzboden0manuell00907026101Aquarium Licht1auto0232407452323301Flur0manuell009261222301Wohnzimmer0manuell001010623401Küche0manuell00310023001Bad0auto001259823401Gartenlicht0auto0082261Weihnachten0manuell018,19,20 17:32:16 debug [pimatic-fritz]: getDeviceListInfo http://fritz.box, null, xx:xx:xx:xx:xx:xx 17:32:16 debug [pimatic-fritz]: getDeviceListInfo http://fritz.box, null, 08761xxxxxxx 17:32:16 debug [pimatic-fritz]: getDeviceListInfo http://fritz.box, null, 08761xxxxxxx 17:32:16 debug [pimatic-fritz]: getDeviceListInfo http://fritz.box, null, 08761xxxxxxx 17:32:16 debug [pimatic-fritz]: getDeviceListInfo http://fritz.box, null, 08761xxxxxxx 17:32:16 debug [pimatic-fritz]: getDeviceListInfo http://fritz.box, null, 08761xxxxxxx 17:32:16 debug [pimatic-fritz]: getDeviceListInfo http://fritz.box, null, 08761xxxxxxx

mwittig commented 9 years ago

@TomLil Does switching the plugin on and off work for you? Have you tried to set the 'legacyMode' yet?

andig commented 9 years ago

By https://github.com/andig/pimatic-fritz/pull/9 I've backed out the faulty merge. As long as you don't update to 0.2.5 you're welcome to continue testing/fixing the problems and I'd be happy to accept another PR once we can get confirmation this works. I'll keep this issue open for that purpose.

archipita commented 9 years ago

@mwittig Yes, the switch on/off is working, but the plugin is not reading the initial state correctly (i.e. it starts always with the state off).

Here are the logs of the plugin:

19:50:15.980 [pimatic] info: Loading plugin: "pimatic-fritz" (0.2.4)
...
19:50:32.174 [pimatic-fritz] debug: getSwitchList http://192.168.100.1, null, [object Object]
...
19:50:36.392 [pimatic-fritz] debug: getDeviceListInfo http://192.168.100.1, null, 0876101xxxxx
...
19:51:18.642 [pimatic-fritz] warn: Re-establishing session at http://192.168.100.1
...
19:51:20.606 [pimatic-fritz] info: Device AINs: 0876101xxxxx
19:51:21.102 [pimatic-fritz] debug: <devicelist version="1"><device identifier="08761 08xxxxx" id="16" functionbitmask="1280" fwversion="03.56" manufacturer="AVM" productname="FRITZ!DECT Repeater 100"><present>1</present><name>FRITZ!DECT Rep 100 #1</name><temperature><celsius>250</celsius><offset>0</offset></temperature></device><device identifier="08761 01xxxxx" id="17" functionbitmask="896" fwversion="03.37" manufacturer="AVM" productname="FRITZ!DECT 200"><present>1</present><name>Steckdose Aquarium</name><switch><state>1</state><mode>auto</mode><lock>0</lock></switch><powermeter><power>31320</power><energy>65649</energy></powermeter><temperature><celsius>260</celsius><offset>0</offset></temperature></device></devicelist>
19:51:21.275 [pimatic-fritz] debug: [ { identifier: '08761 08xxxxx',
19:51:21.275 [pimatic-fritz] debug:>    id: '16',
19:51:21.275 [pimatic-fritz] debug:>    functionbitmask: '1280',
19:51:21.275 [pimatic-fritz] debug:>    fwversion: '03.56',
19:51:21.275 [pimatic-fritz] debug:>    manufacturer: 'AVM',
19:51:21.275 [pimatic-fritz] debug:>    productname: 'FRITZ!DECT Repeater 100',
19:51:21.275 [pimatic-fritz] debug:>    present: '1',
19:51:21.275 [pimatic-fritz] debug:>    name: 'FRITZ!DECT Rep 100 #1',
19:51:21.275 [pimatic-fritz] debug:>    temperature: { celsius: '250', offset: '0' } },
19:51:21.275 [pimatic-fritz] debug:>  { identifier: '08761 01xxxxx',
19:51:21.275 [pimatic-fritz] debug:>    id: '17',
19:51:21.275 [pimatic-fritz] debug:>    functionbitmask: '896',
19:51:21.275 [pimatic-fritz] debug:>    fwversion: '03.37',
19:51:21.275 [pimatic-fritz] debug:>    manufacturer: 'AVM',
19:51:21.275 [pimatic-fritz] debug:>    productname: 'FRITZ!DECT 200',
19:51:21.275 [pimatic-fritz] debug:>    present: '1',
19:51:21.275 [pimatic-fritz] debug:>    name: 'Steckdose Aquarium',
19:51:21.275 [pimatic-fritz] debug:>    switch: { state: '1', mode: 'auto', lock: '0' },
19:51:21.275 [pimatic-fritz] debug:>    powermeter: { power: '31320', energy: '65649' },
19:51:21.275 [pimatic-fritz] debug:>    temperature: { celsius: '260', offset: '0' } } ]
...

I can keep the 0.2.4 for the time being and support you making some tests if you want (in the evening CET :)).

mwittig commented 9 years ago

Thank you @archipita I'll keep you posted as soon as I have a fix to trial.

@TomLil would be great if you also can help with testing a fix as soon as it'll be available :)

mwittig commented 9 years ago

@archipita and @TomLil could you please test https://github.com/mwittig/pimatic-fritz ?

Assuming you're running pimatic on raspberry pi you can install the fork as follows:

To roll back official version later on

archipita commented 9 years ago

@mwittig Yep, I am running pimatic on a Raspberry PI :)

Just tested with the procedure you have suggested... it seems to be working now!

pimatic-fritz

It says however that it is the release 0.2.2

20:11:50.305 [pimatic] info: Loading plugin: "pimatic-fritz" (0.2.2)
...
20:12:09.117 [pimatic-fritz] debug: getSwitchList http://192.168.100.1, null, [object Object]
...
20:12:10.807 [pimatic-fritz] warn: Re-establishing session at http://192.168.100.1
...
20:12:13.849 [pimatic-fritz] debug: getDeviceListInfo http://192.168.100.1, null, 0876101xxxxx
...
20:12:57.265 [pimatic-fritz] warn: Re-establishing session at http://192.168.100.1
...
20:12:59.552 [pimatic-fritz] info: Device AINs: 0876101xxxxx
20:12:59.940 [pimatic-fritz] debug: <devicelist version="1"><device identifier="08761 08xxxxx" id="16" functionbitmask="1280" fwversion="03.56" manufacturer="AVM" productname="FRITZ!DECT Repeater 100"> <present>1</present><name>FRITZ!DECT Rep 100 #1</name><temperature><celsius>254</celsius><offset>0</offset></temperature></device><device identifier="08761 01xxxxx" id="17" functionbitmask="896" fwversion="03.37" manufacturer="AVM" productname="FRITZ!DECT 200"><present>1</present><name>Steckdose Aquarium</name><switch><state>1</state><mode>auto</mode><lock>0</lock></switch><powermeter><power>31610</power><energy>66033</energy></powermeter><temperature><celsius>266</celsius><offset>0</offset></temperature></device></devicelist>
20:13:00.105 [pimatic-fritz] debug: { identifier: '08761 01xxxxx',
20:13:00.105 [pimatic-fritz] debug:>  id: '17',
20:13:00.105 [pimatic-fritz] debug:>  functionbitmask: '896',
20:13:00.105 [pimatic-fritz] debug:>  fwversion: '03.37',
20:13:00.105 [pimatic-fritz] debug:>  manufacturer: 'AVM',
20:13:00.105 [pimatic-fritz] debug:>  productname: 'FRITZ!DECT 200',
20:13:00.105 [pimatic-fritz] debug:>  present: '1',
20:13:00.105 [pimatic-fritz] debug:>  name: 'Steckdose Aquarium',
20:13:00.105 [pimatic-fritz] debug:>  switch: { state: '1', mode: 'auto', lock: '0' },
20:13:00.105 [pimatic-fritz] debug:>  powermeter: { power: '31610', energy: '66033' },
20:13:00.105 [pimatic-fritz] debug:>  temperature: { celsius: '266', offset: '0' } }
20:13:13.883 [pimatic-fritz] debug: getDeviceListInfo http://192.168.100.1, 524e5239fdxxxxx, 0876101xxxxx
20:13:14.200 [pimatic-fritz] debug: <devicelist version="1"><device identifier="08761 08xxxxx" id="16" functionbitmask="1280" fwversion="03.56" manufacturer="AVM" productname="FRITZ!DECT Repeater 100"><present>1</present><name>FRITZ!DECT Rep 100 #1</name><temperature><celsius>254</celsius><offset>0</offset></temperature></device><device identifier="08761 01xxxxx" id="17" functionbitmask="896" fwversion="03.37" manufacturer="AVM" productname="FRITZ!DECT 200"><present>1</present><name>Steckdose Aquarium</name><switch><state>1</state><mode>auto</mode><lock>0</lock></switch><powermeter><power>31610</power><energy>66033</energy></powermeter><temperature><celsius>266</celsius><offset>0</offset></temperature></device></devicelist>
20:13:14.272 [pimatic-fritz] debug: { identifier: '08761 01xxxxx',
20:13:14.272 [pimatic-fritz] debug:>  id: '17',
20:13:14.272 [pimatic-fritz] debug:>  functionbitmask: '896',
20:13:14.272 [pimatic-fritz] debug:>  fwversion: '03.37',
20:13:14.272 [pimatic-fritz] debug:>  manufacturer: 'AVM',
20:13:14.272 [pimatic-fritz] debug:>  productname: 'FRITZ!DECT 200',
20:13:14.272 [pimatic-fritz] debug:>  present: '1',
20:13:14.272 [pimatic-fritz] debug:>  name: 'Steckdose Aquarium',
20:13:14.272 [pimatic-fritz] debug:>  switch: { state: '1', mode: 'auto', lock: '0' },
20:13:14.272 [pimatic-fritz] debug:>  powermeter: { power: '31610', energy: '66033' },
20:13:14.272 [pimatic-fritz] debug:>  temperature: { celsius: '266', offset: '0' } }
...
20:14:13.901 [pimatic-fritz] debug: getDeviceListInfo http://192.168.100.1, 524e5239fdxxxxx, 0876101xxxxx
20:14:14.216 [pimatic-fritz] debug: <devicelist version="1"><device identifier="08761 08xxxxx" id="16" functionbitmask="1280" fwversion="03.56" manufacturer="AVM" productname="FRITZ!DECT Repeater 100"><present>1</present><name>FRITZ!DECT Rep 100 #1</name><temperature><celsius>254</celsius><offset>0</offset></temperature></device><device identifier="08761 01xxxxx" id="17" functionbitmask="896" fwversion="03.37" manufacturer="AVM" productname="FRITZ!DECT 200"><present>1</present><name>Steckdose Aquarium</name><switch><state>1</state><mode>auto</mode><lock>0</lock></switch><powermeter><power>31610</power><energy>66033</energy></powermeter><temperature><celsius>266</celsius><offset>0</offset></temperature></device></devicelist>
20:14:14.282 [pimatic-fritz] debug: { identifier: '08761 01xxxxx',
20:14:14.282 [pimatic-fritz] debug:>  id: '17',
20:14:14.282 [pimatic-fritz] debug:>  functionbitmask: '896',
20:14:14.282 [pimatic-fritz] debug:>  fwversion: '03.37',
20:14:14.282 [pimatic-fritz] debug:>  manufacturer: 'AVM',
20:14:14.282 [pimatic-fritz] debug:>  productname: 'FRITZ!DECT 200',
20:14:14.282 [pimatic-fritz] debug:>  present: '1',
20:14:14.282 [pimatic-fritz] debug:>  name: 'Steckdose Aquarium',
20:14:14.282 [pimatic-fritz] debug:>  switch: { state: '1', mode: 'auto', lock: '0' },
20:14:14.282 [pimatic-fritz] debug:>  powermeter: { power: '31610', energy: '66033' },
20:14:14.282 [pimatic-fritz] debug:>  temperature: { celsius: '266', offset: '0' } }```
mwittig commented 9 years ago

@archipita Sounds great! Thank you very much for trying! There is a PR for this already in the loop, but as @andig pointed out it is not in sync with latest changes he did on master. So, I'll prepare a new PR tomorrow.

archipita commented 9 years ago

@mwittig Just checked again to be sure... it is OK: it reports the current status correctly (switched off) and still the overall power consumption and the current temperature.

pimatic-fritz 2

archipita commented 9 years ago

@mwittig I have just installed the official release 0.2.5 (removed the clone before) and the plugin seems not to be fully OK: the temperature it is not displayed anymore (was OK in the test version).

pimatic-fritz_3

I have found also this in the logs:

13:16:56.982 [pimatic-fritz] error: Cannot access ttp://192.168.100.1/webservices/homeautoswitch.lua?0=0&sid=b29e554822xxxxx&switchcmd=getswitchlist: undefined
...
13:16:58.060 [pimatic-fritz] debug: getSwitchPower http://192.168.100.1, dec6c9b38c0xxxxx, 0876101xxxxx
...

I cannot see anymore the logs of the received data. Can it be that I do not have a clean version or that something went wrong with the merge back? The config.json file hasn't changed.

mwittig commented 9 years ago

@archipita actually, v0.2.5 is a roll-back to the code base of v0.2.2 which did not support temperature readings. Hopefully, @andig will publish a new version soon. EDIT: OK, this may be confusing as my code you tested also showed v0.2.2. This is, because I started development based on v0.2.2 and only the maintainer will bump the version number when a new version of the npm package gets released.

Regarding the error message in the log, this looks strange as the scheme name of the URL misses the first character! Do you get this error message repeatedly?

archipita commented 9 years ago

@mwittig I made some further tests in the mean while: in general the plugin behaves correctly, beside the point on the missing temperature (which would be nice to get back :)), the logs not showing the details (not really an error) and the error message. This error message is however coming out only once at the (re)start, not by every polling. Maybe it is a matter of re-initialization. If I put the link in a browser I get a meaningful XML answer.

12:44:16.911 [pimatic-fritz] error: Cannot access http://192.168.100.1/login_sid.lua?username=admin&response=9a4ec6f4-b78662691220f1846fb35de762xxxxx: undefined

Honestly I do not know why in that log the missing h occurred. Unfortunately it has been overwritten and I do not have the file anymore.

andig commented 8 years ago

beside the point on the missing temperature (which would be nice to get back :))

I've added a temperaturesensor to the plugin that will be able to read temps of both switches and thermostats.

archipita commented 8 years ago

@andig this sounds very good! Is there a description for it? I could not find the info on the plugin site. I have installed the 0.3.1 and cannot see that part.

andig commented 8 years ago

Is there a description for it? I could not find the info on the plugin site.

Look here: https://github.com/andig/pimatic-fritz/blob/master/device-config-schema.coffee#L60 The description is not quite right. As it uses the getDeviceListInfo api it will work for thermostats as well as outlets.