kbr / fritzconnection

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

Device support mesh method #145

Closed chemelli74 closed 2 years ago

chemelli74 commented 2 years ago

Add a method to know if the device is able to support mesh network of not

cc @mib1185

chemelli74 commented 2 years ago

At @kbr, do you think it can be merged ? Thx in advance,

Simone

chemelli74 commented 2 years ago

@kbr, conflict fixed, ready for merging ;-)

chemelli74 commented 2 years ago

Can we kindly progress with this PR please ?

Thx in advance,

Simone

kbr commented 2 years ago

I suppose to use the more pythonic EAFP-way:

    @property
    def device_supports_mesh(self):
        """
        Return True if the device supports mesh (by checking to be able
        to provide a MeshListPath) otherwise return False.
        """
        try:
            return (
                "X_AVM-DE_GetMeshListPath" 
                in self.fc.services["Hosts1"].actions
            )
        except KeyError:
            return False
chemelli74 commented 2 years ago

Code updated as per latest comment

chemelli74 commented 2 years ago

File should end with an empty line.

Very true, ;-) Would love to add a pre-commit with black and few other things...

Simone

kbr commented 2 years ago

No black after starting a project. This will give a diff-desaster. But running tests via github-integration are in preparation.