Closed mammuth closed 4 years ago
This seems to be indeed a candidate for improvement. The Fritz-interface knows about booleans but represents them as 0 and 1. All parameters are sent and received as strings. For convenience the received values are converted to the corresponding Python-datatypes. For sending all arguments are converted to strings, which does not work for True and False. I will put this on the todo-list.
Regarding the other topic: "WLANConfiguration3" is the correct way for naming services (introduced with 0.8.0). However, the old way to do it like "WLANConfiguration:3" is still supported and will not get deprecated.
With version 1.3.0 call_action() accepts True and False for boolean arguments, additionally to '1' and '0'. So I like to close this. Please feel free to reopen in case of trouble.
Hi, we're using
fritzconnection
over at https://github.com/mammuth/ha-fritzbox-tools (a custom component for Home Assistant). Thanks for providing the library (and moving it forward with updates) 🚀When upgrading from 0.8.4 to 1.2.0 we noticed that argument and return types of action calls don't share the same type anymore.
See the following example:
When dealing with port forwards this produces some more overhead because the
AddPortMapping
action requires the whole dictionary to be passed when you want to turn on/off the port forward. So you would store the response dict ofGetGenericPortMappingEntry
(which has a boolean) and then have to change it to "[0,1]" when using it as an argument for theAddPortMapping
action.While people using
fritzconnection
are surely able to handle this, I think it should be streamlined infritzconnection
itself, so it's easier to use. What's your opinion on this?We also noticed a change in the format of the services dict (
FritzConnection(...)
.services). While it used to be eg.{"WLANConfiguration:3": {...}}
, it's now{"WLANConfiguration3": {...}}
etc.