Closed laarisyko closed 7 months ago
I've tried it with a user just having homautomation-rights and it works fine. Any user can create a FritzConnection
instance (or FritzHomeAutomation
in this case), but the allowed operations are restricted to the user-rights. What you need to know is the ain
of the switch, i.e. you can get all ain
s from the command line (use the latest fritzconnection version 1.13.2):
$ fritzhomeauto -i 192.168.178.1
Then the following script will do the job:
from fritzconnection.lib.fritzhomeauto import FritzHomeAutomation
user = "test_user" # user with just homeautomation rights
password = "the cool password for the test_user"
ain = "11657 0240192" # use the ain of your device here
ip = "192.168.178.1" # normalwise the default ip
fh = FritzHomeAutomation(address=ip, use_cache=True, user=user, password=password)
fh.set_switch(identifier=ain, on=True) # or 'on=False'
Thank you very much! It works. I really don't know what I made wrong in my first attempt. I just used from another code example some lines, maybe I messed something up there.
Thanks for the response.
I have tried your awsome module and it works very well, if I provide the credentials for a user which has also setting rights (admin). However it doesn't work if I try it with a user which just has rights for homeautomation. I have looked into the documentation and it says that user with home automation rights need to login via fritz.box/myfritzx#/ . This works fine and I can control from here all my DECT200 switches. I can extract the SID if I however for example hover the NAS button. I have created the homeautomation link to switch a certain DECT200 with the extracted SID, this works fine.
So my question, how can we get an SID for useres which only have homeautomation rights.
Many thanks for you help already :)