Package: connectorlocal
connectorlocalPython library for interfacing with Connector ShadesThis library allows you to control Connector Shades.
This library is primarly writen to be used with HomeAssistant but can also be used stand alone.InstallationUse pip:$ pip install connectorlocalRetrieving KeyThe Connector Shades API uses a 16 character key that can be retrieved from the official "Connector Shades" app forIosorAndroid.
Open the app, click the button in the upper left corner to expand the page, then click the setting button in the upper left corner to enter the "Settings page", click the About option to enter the "About page",Please quickly tap this "Connector Shades About" page 5 times, a popup will apear that gives you the key.UsageFor creation of a device you could use the following lines of codes (using a correct IP of the gateway and Key retrieved from the App)fromconnector_localimportConnectorHubconnector=ConnectorHub(ip="192.168.31.100",key="12ab345c-d67e-8f")# If you want to add multiple HUB, Please use & as separatorconnector=ConnectorHub(ip="192.168.31.100&192.168.31.101",key="12ab345c-d67e-8f")When the connector instance is created, you need to actively open the receiving, because the connector is based on local UDP communication.connector.start_receive_data()After opening UDP reception, you need to actively wait for about 3 seconds (it takes a little time to query the device and update the device status), and then query the device listconnector.device_list()Some example code that will print the information of the gateway and all connected blinds:>>> from connector_local import ConnectorHub
>>> connector = ConnectorHub(ip="192.168.31.100", key="12ab345c-d67e-8f")
>>> connector.start_receive_data()
>>> hubs = connector.device_list()
>>> print(hubs)
>>> {'a4cf1216c014': <__main__.Hub object at 0x0000022012E6D610>}If you want to get the sub-device under HUB, you can get it through hub.blinds>>>hub=hubs["a4cf1216c014"]>>>blinds_list=hub.blinds>>>print(blinds_list)>>>{'a4cf1216c014000a':<__main__.OneWayBlindobjectat0x00000235DA92D610>,'a4cf1216c014000d':<__main__.OneWayBlindobjectat0x00000235DA92DA90>,'a4cf1216c014000e':<__main__.TwoWayBlindobjectat0x00000235DA92D6A0>,'a4cf1216c0140015':<__main__.TwoWayBlindobjectat0x00000235DA92D970>,'a4cf1216c0140016':<__main__.TwoWayBlindobjectat0x00000235DA92D760>,'a4cf1216c0140017':<__main__.TwoWayBlindobjectat0x00000235DA92D8E0>}OneWayBlind supports up stop and down,TwoWayBlind supports up stop down and percentage controlblinds=blinds_list["a4cf1216c014000e"]# open blindsblinds.open()# stop blindsblinds.stop()# close blindsblinds.close()# Control blinds to 50% (0% is open, 100% is close)blinds.target_position(percent=50)# Control blinds to 90 degrees (Angle control range is 0 to 180 degrees)blinds.target_angle(angle=90)ConnectorHubmethod / propertyargumentsargument typeexplanationconnector.start_receive_data()//Join UDP multicast and create threads.connector.close_receive_data()//Close receive thread.connector.device_list()//Return the device list.connector.is_connected//Return the connect statusconnector.error_code//If the connection status is False, you need to check the error code.         1000 :connection succeeded        1001: key is wrong                                1002: port is occupiedHubmethod / propertyargumentsargument typeexplanationhub.blinds_list//Return all blinds.hub.hub_version//Return hub version.hub.hub_mac//Return hub mac.hub.devicetype//Return device type.hub.update_blinds()//Update the status of all Two Way Blind under the hubOneWayBlindmethod / propertyargumentsargument typeexplanationblinds.open()//open blindsblinds.close()//close blindsblinds.stop()//stop blindsblinds.mac//return the blinds macblinds.device_type//return the blinds device typeblinds.type//return the blinds typeblinds.wireless_mode//return the blinds wireless modeTwoWayBlindmethod / propertyargumentsargument typeexplanationblinds.open()//open blindsblinds.close()//close blindsblinds.stop()//stop blindsblinds.target_position(percent=100)percentint (0-100)Percentage control.blinds.target_angle(angle = 90)angleint (0-180)Angle control.blinds.mac//return the blinds macblinds.device_type//return the blinds device typeblinds.type//return the blinds typeblinds.wireless_mode//return the blinds wireless modeblinds.update_state()//update the position of the blind.blinds.isClosed//return if the cover is closed or not.blinds.position//return current position of the blinds.Attribute Value Explanationwireless modeexplanation0Uni-direction1Bi-direction2Bi-direction (mechanical limits)3Wi-Fi4Bi-direction(virtual percentage)5Otherstypeexplanation1Roller Blinds2Venetian Blinds3Roman Blinds4Honeycomb Blinds5Shangri-La Blinds6Roller Shutter7Roller Gate8Awning10Day&night Blinds11Dimming Blinds12Curtain13Curtain(Open Left)14Curtain(Open Right)deviceTypeexplanation02000001Wi-Fi Bridge10000000433Mhz radio motor22000000Wi-Fi Curtain22000002Wi-Fi tubular motor22000005Wi-Fi receiver