Closed basssment closed 3 years ago
@basssment it looks like it works. At least you can get the device list.
The states are still None since you have not yet requested a status update.
try running the following python script, that schould actually update the status and print the info of all blinds:
from motionblinds import MotionGateway
m = MotionGateway(ip = "192.168.1.100", key = "12ab345c-d67e-8f")
m.GetDeviceList()
m.Update()
print(m)
for blind in m.device_list.values():
blind.Update()
print(blind)
Please let me know if the script above works or if you need any additionel help. If it works, I will update the documentation of this library and the HomeAssistant component to list Brel blinds as working.
Thanx will try that. Did not have the time to check yet , will report back this week!
Found the time to try your script. Got some info back but also an syntax error. (i'm kind of an noob here... but keep learning :))
this is the result : `>>> m.Update()
print(m) <MotionGateway ip: 192.168.0.x, mac: 600291dc94d2, protocol: 0.9, firmware: A1 .0.1_B0.1.4, N_devices: 4, status: Working, RSSI: -68 dBm> for blind in m.device_list.values(): ... blind.Update() ... print(blind) ... <MotionGateway ip: 192.168.0.1x, mac: 600291dc94d2, protocol: 0.9, firmware: A1 .0.1_B0.1.4, N_devices: 4, status: Working, RSSI: -68 dBm> for blind in m.device_list.values(): ... blind.Update() ... print(blind) ... Timeout of 5.0 sec occurred on 5 attempts while waiting on multicast push from update request, communication between gateway and blind might be bad. Traceback (most recent call last): File "
", line 2, in File "/home/pi/.local/lib/python3.7/site-packages/motionblinds/motion_blinds.py", line 887, in Update mcast_response = self._wait_on_mcast_report(mcast) File "/home/pi/.local/lib/python3.7/site-packages/motionblinds/motion_blinds.py", line 690, in _wait_on_mcast_report mcastdata, (ip, ) = mcast_socket.recvfrom(SOCKET_BUFSIZE) socket.timeout: timed out <MotionGateway ip: 192.168.0.x, mac: 600291dc94d2, protocol: 0.9, firmware: A1 .0.1_B0.1.4, N_devices: 4, status: Working, RSSI: -68 dBm> File " ", line 1 <MotionGateway ip: 192.168.0.x, mac: 600291dc94d2, protocol: 0.9, firmware: A1 .0.1_B0.1.4, N_devices: 4, status: Working, RSSI: -68 dBm> ^ SyntaxError: invalid syntax for blind in m.device_list.values(): File "
", line 1 for blind in m.device_list.values(): ^ SyntaxError: invalid syntax ... blind.Update() File " ", line 1 ... blind.Update() ^ SyntaxError: invalid syntax ... print(blind) File " ", line 1 ... print(blind) ^ SyntaxError: invalid syntax ... Ellipsis `
@basssment alright, we are getting somewhere. the multicast responses do not work properly (yet) but lets first see if we can get the values from the gateway. Please try this script:
from motionblinds import MotionGateway
m = MotionGateway(ip = "192.168.1.100", key = "12ab345c-d67e-8f")
m.GetDeviceList()
m.Update()
print(m)
for blind in m.device_list.values():
blind.Update_trigger()
print(blind)
btw you can save the above code in a test.py file (using a text editor like notepad) and then run it using: python3 test.py
from the command line from the location where you saved the file (first run cd C:\Path\To\The\File
to change the path from where you run the command).
@starkillerOG that seems to work!
pi@Domoticzvm:~$ python3 blind.py <MotionGateway ip: 192.168.0.x, mac: 600291dc94d2, protocol: 0.9, firmware: A1.0.1_B0.1.4, N_devices: 4, status: Working, RSSI: -65 dBm> <MotionBlind mac: 500291dc94d20001, type: RollerBlind, status: Stopped, position: 100 %, angle: 180.0, limit: Limits, battery: 90.0 %, 12.38 V, RSSI: -91 dBm> <MotionBlind mac: 500291dc94d20002, type: RollerBlind, status: Stopped, position: 100 %, angle: 180.0, limit: Limits, battery: 91.0 %, 12.4 V, RSSI: -89 dBm> <MotionBlind mac: 500291dc94d20003, type: RollerBlind, status: Stopped, position: 100 %, angle: 180.0, limit: Limits, battery: 90.0 %, 12.38 V, RSSI: -78 dBm> <MotionBlind mac: 500291dc94d20004, type: RollerBlind, status: Stopped, position: 100 %, angle: 180.0, limit: Limits, battery: 93.0 %, 12.45 V, RSSI: -103 dBm>
@basssment good to hear it is working. I will list the Brel Blinds as supported.
If you are intrested, the following script will open one of your blinds:
from motionblinds import MotionGateway
m = MotionGateway(ip = "192.168.1.100", key = "12ab345c-d67e-8f")
m.GetDeviceList()
m.Update()
blind_1 = list(m.device_list.values())[0]
blind_1.Update()
blind_1.Open()
Instead of blind_1.Open() you can also use blind_1.Close(), blind_1.Stop(), blind_1.Set_position(50) or blind_1.Set_angle(90)
For a full list of commands and properties see: https://github.com/starkillerOG/motion-blinds#gateway-device and https://github.com/starkillerOG/motion-blinds#blind-device
You schould also be able to use the HomeAssistant integration with your Brel blinds: https://www.home-assistant.io/integrations/motion_blinds/
I will close this issue since I think everything schould be working. If you need any additional help, please feel free to ask (reopen this issue, or open a new one).
@starkillerOG tried to close blind one by using your example. Unfortunatly i recieve an time out.
#python3 blind.py Timeout of 5.0 sec occurred on 5 attempts while waiting on multicast push from update request, communication between gateway and blind might be bad. Traceback (most recent call last): File "blind.py", line 6, in <module> blind_1.Update() File "/home/pi/.local/lib/python3.7/site-packages/motionblinds/motion_blinds.py", line 887, in Update mcast_response = self._wait_on_mcast_report(mcast) File "/home/pi/.local/lib/python3.7/site-packages/motionblinds/motion_blinds.py", line 690, in _wait_on_mcast_report mcast_data, (ip, _) = mcast_socket.recvfrom(SOCKET_BUFSIZE) socket.timeout: timed out
When i run the print command i do get the settings:
`#python3 blind2.py <MotionGateway ip: 192.168.0.x, mac: 600291dc94d2, protocol: 0.9, firmware: A1.0.1_B0.1.4, N_devices: 4, status: Working, RSSI: -68 dBm>
<MotionBlind mac: 500291dc94d20001, type: RollerBlind, status: Stopped, position: 0 %, angle: 0.0, limit: Limits, battery: 90.0 %, 12.37 V, RSSI: -88 dBm>
<MotionBlind mac: 500291dc94d20002, type: RollerBlind, status: Stopped, position: 0 %, angle: 0.0, limit: Limits, battery: 92.0 %, 12.42 V, RSSI: -92 dBm>
<MotionBlind mac: 500291dc94d20003, type: RollerBlind, status: Stopped, position: 0 %, angle: 0.0, limit: Limits, battery: 90.0 %, 12.37 V, RSSI: -93 dBm>
<MotionBlind mac: 500291dc94d20004, type: RollerBlind, status: Stopped, position: 0 %, angle: 0.0, limit: Limits, battery: 93.0 %, 12.45 V, RSSI: -106 dBm> `
@basssment sorry I forgot to replace the .Update
with the .Update_trigger
.
This schould work:
from motionblinds import MotionGateway
m = MotionGateway(ip = "192.168.1.100", key = "12ab345c-d67e-8f")
m.GetDeviceList()
m.Update()
blind_1 = list(m.device_list.values())[0]
blind_1.Update_trigger()
blind_1.Open()
@starkillerOG Thanx! should have seen that myselfe ;) works now! Thank you for the great support!!
@starkillerOG small question how do i select the 2nd screen? if i use blind_1 the fist closes or opens but when i select blind_2 the same blind goes down :)
@basssment select a diffrent blind object from the m.device_list
so bassically change the [0] to [1]
script to open the second blind:
from motionblinds import MotionGateway
m = MotionGateway(ip = "192.168.1.100", key = "12ab345c-d67e-8f")
m.GetDeviceList()
m.Update()
blind = list(m.device_list.values())[1]
blind.Update_trigger()
blind.Open()
For your understanding try running this code:
from motionblinds import MotionGateway
m = MotionGateway(ip = "192.168.1.100", key = "12ab345c-d67e-8f")
m.GetDeviceList()
print(m.device_list)
That will print the dictionary containing all connected blinds, with as keys the blind id's.
That dictionarry can be converted to a list using:
blind_dictionary = m.device_list
blind_list = list(blind_dictionary.values())
print(blind_list )
and then we select one of the blinds form that list by index [0] or [1] ....
Do you see how it works?
Thank you Got it! even thoug i do not get a good result on the print output there are not numbered. I played with the settings but blind 1 does not seem to work looks like the connection with the usb hub is not active anymore so cant controll it with the app.. but other blinds work as expected.
Thank you verry much!
Hi Strarkiller,
I found your script and was trying to use it for my blinds. They are brel blinds so am not shure if it works..
I folowed your description and with the "m.GetDeviceList()" i get the following:
m.GetDeviceList() {'500291dc94d20001': <MotionBlind mac: 500291dc94d20001, type: None, status: Non e, position: None %, angle: None, limit: None, battery: None %, None V, RSSI: No ne dBm>, '500291dc94d20002': <MotionBlind mac: 500291dc94d20002, type: None, sta tus: None, position: None %, angle: None, limit: None, battery: None %, None V, RSSI: None dBm>, '500291dc94d20003': <MotionBlind mac: 500291dc94d20003, type: N one, status: None, position: None %, angle: None, limit: None, battery: None %, None V, RSSI: None dBm>, '500291dc94d20004': <MotionBlind mac: 500291dc94d20004, type: None, status: None, position: None %, angle: None, limit: None, battery: None %, None V, RSSI: None dBm>}
does this mean it does not work for my blinds or is something wrong and is it possible to get it to work :)