kbr / fritzconnection

Python-Tool to communicate with the AVM Fritz!Box by the TR-064 protocol and the AHA-HTTP-Interface
MIT License
304 stars 59 forks source link

Cannot get Guest Wifi state - Empty Dict as a response #5

Closed springstan closed 4 years ago

springstan commented 4 years ago

I am using a custom component for Home Assistant called ha-fritzbox-tools. Unfortunately, it cannot get the state of my guest wifi. See this issue for more information.

Ticked the necessary checkboxes in Access Settings in the Home Network Occurred after upgrading to version: 0.8.4 Surprisingly this has worked before with 0.6.5, however I cannot seem to replicate it anymore. Requests version: 2.22.0 Fritzbox model: FritzBox 7560

After entering this:

import fritzconnection as fc
c = fc.FritzConnection(
    address='yourhost',
    port= 49000,
    user='yourusername',
    password='yourpassword'
)
print(c.call_action('WLANConfiguration:3', 'GetInfo'))

the last line returns an empty dict {} which is needed for getting the guest wifi state.

However, the connection is established successfully, since this:

print(c.call_action('Layer3Forwarding:1','GetDefaultConnectionService')['NewDefaultConnectionService'])

returns 1.WANPPPConnection.1

Hope you guys can help me out :)

kbr commented 4 years ago

That's weird because you should get a ServiceError/KeyError in case the service is not available. Are you sure that the guest network is up and running? Actually I have no access to my reference hardware – may be at the weekend.

springstan commented 4 years ago

Yeah I am pretty sure since I can detect it while scanning for nearby networks. Oh okay, thanks for investigating this issue :)

kbr commented 4 years ago

I'm suppose the box reports some error, because neither a ServiceError nor an ActionError gets raised but an empty dict returns. May be the upcoming 1.0 version will report the failure in full detail, as the parser has been rewritten and error handling is vastly enhanced.

mammuth commented 4 years ago

During some debugging, @springstan and @AaronDavidSchneider found out that it's possible to set the state of the guest wifi on the affected setup: c.call_action('WLANConfiguration:3', 'SetEnable', NewEnable=1)

So setting the state works for him, but calling the GetInfo action doesn't work as expected. Just for the record 😊

springstan commented 4 years ago

@kbr just restarted my router and that solved my problem 🙈

kbr commented 4 years ago

@springstan thanks for the info!

springstan commented 4 years ago

@kbr of course!