Closed JonOve closed 2 years ago
@JonOve do you see any warning/errors related to the motion_blinds integration in the HomeAssistant log?
@JonOve what kind of blind do you have that has the issue?
@JonOve could you run the following pyhton script
(can be done on a PC where python is installed and motionblinds module using pip3 install --upgrade motionblinds
)
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 adjust the IP and Key in the script and post the result here.
@JonOve do you see any warning/errors related to the motion_blinds integration in the HomeAssistant log?
No warnings or errors in the HA log
@JonOve what kind of blind do you have that has the issue?
I have a bi-directional Brel roller blind. Controlled via the Brel hub DD1554.
@JonOve could you run the following pyhton script
(can be done on a PC where python is installed and motionblinds module using
pip3 install --upgrade motionblinds
)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 adjust the IP and Key in the script and post the result here.
This is new for me. Will try yo do so.
@JonOve you can just use a regular windows 10 pc and install python3, then open command line on that PC.
and run the command pip3 install --upgrade motionblinds
Then save the script above as a test.py
file on your computer (using notepad or something).
Then go to command line and run: python3 path/to/the/file/test.py
with the correct path the the test.py file.
You might also need to specify the path to python3 if it has not been added to your path variables of your PC (I think that is a option during install of python3)
If it is a bi-directional roller blind, why can't you set a position of the blind (instead of only open/close/stop)?
Good question. I actually expected it to do so when I bought the motor, but it seems Brel has several types of motors. Also bi-directional motors which cannot be positioned by percentage via the Brel home app. The DD1554 Brel hub can only steer bi-directional blinds which works in my case.
Verstuurd vanaf mijn iPad
Op 17 jan. 2022 om 12:48 heeft starkillerOG @.***> het volgende geschreven:
If it is a bi-directional roller blind, why can't you set a position of the blind (instead of only open/close/stop)?
— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.
@JonOve I will need the output of the script above to see what kind of response the blind gives to identify these types that do not properly report the position.
I was able to install python and run the command pip3 install --upgrade motionblinds succesfull. Then I saved the "pip3 install --upgrade motionblinds" script as a python file named "test.py. Running python3 c:/python/test.py however gives me a syntax error.
@JonOve could you post the syntax error you get?
whant happens if you just run python3
does it actaully open python3?
@starkillerOG
W:\Mijn documenten>python Python 3.10.1 (tags/v3.10.1:2cd268a, Dec 6 2021, 19:10:37) [MSC v.1929 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information.
W:\Mijn documenten>python test.py File "W:\Mijn documenten\test.py", line 1 pip3 install --upgrade motionblinds ^^^^^^^ SyntaxError: invalid syntax
C:>pip3 install --upgrade motionblinds Requirement already satisfied: motionblinds in c:\python\lib\site-packages (0.5.8) Requirement already satisfied: pycryptodomex in c:\python\lib\site-packages (from motionblinds) (3.12.0)
@JonOve alright, do not inlcude the pip3 install --upgrade motionblinds
line in the test.py file.
The only contests of the test.py file schould be:
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)
C:>pip3 install --upgrade motionblinds Requirement already satisfied: motionblinds in c:\python\lib\site-packages (0.5.8) Requirement already satisfied: pycryptodomex in c:\python\lib\site-packages (from motionblinds) (3.12.0)
This is good, that means the motionblinds module has been sucesfully installed.
@starkillerOG
Thank you for your support. Herewith the outcome of the test.py file;
W:\Mijn documenten>python test.py
<MotionGateway ip: 192.168.1.10, mac: d8bfc0c3d1e3, protocol: 0.9, firmware: None, N_devices: 1, status: Working, RSSI: -41 dBm>
Traceback (most recent call last):
File "W:\Mijn documenten\test.py", line 13, in
@JonOve Alright, so we get a socket error when creating the multicast socket. That is quite strange and I would love to figure out how to solve that, but lets first look at the blinds. Could you change the test.py script to:
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)
So change blind.Update()
to blind.Update_trigger()
Besides to go into the socket error could you create a second test script (test2.py) and run it using the following code?:
import socket
import struct
MULTICAST_ADDRESS = '238.0.0.18'
UDP_PORT_RECEIVE = 32101
print("create socket")
udp_socket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM, socket.IPPROTO_UDP)
print("set blocking")
udp_socket.setblocking(True)
print("set REUSEADDR")
udp_socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
print("set IP_MULTICAST_IF")
try:
udp_socket.setsockopt(socket.SOL_IP, socket.IP_MULTICAST_IF, socket.INADDR_ANY)
except:
print("set IP_MULTICAST_IF failed, trying '0.0.0.0'")
try:
udp_socket.setsockopt(socket.SOL_IP, socket.IP_MULTICAST_IF, socket.inet_aton("0.0.0.0"))
except:
print("set IP_MULTICAST_IF failed with '0.0.0.0', trying IPPROTO_IP")
udp_socket.setsockopt(socket.IPPROTO_IP, socket.IP_MULTICAST_IF, socket.INADDR_ANY)
print("set MULTICAST_ADDRESS")
mreq = struct.pack("=4sl", socket.inet_aton(MULTICAST_ADDRESS), socket.INADDR_ANY)
udp_socket.setsockopt(socket.SOL_IP, socket.IP_ADD_MEMBERSHIP, mreq)
print("bind to port")
udp_socket.bind(("", UDP_PORT_RECEIVE))
print("Succes")
That will let me know where the problem is and hopefully how to fix it.
@starkillerOG
Yes, no problem;
W:\Mijn documenten>python test.py <MotionGateway ip: 192.168.1.10, mac: d9bfc0c3d1e3, protocol: 0.9, firmware: None, N_devices: 1, status: Working, RSSI: -40 dBm> <MotionBlind mac: d9bfc0c3d1e30007, type: RollerBlind, status: Closing, position: 0 %, angle: 0.0, limit: NoLimit, battery: 0.0 %, 0.0 V, RSSI: -85 dBm, com: BiDirectionLimits>
W:\Mijn documenten>python test2.py
create socket
set blocking
set REUSEADDR
set IP_MULTICAST_IF
set IP_MULTICAST_IF failed, trying '0.0.0.0'
set IP_MULTICAST_IF failed with '0.0.0.0', trying IPPROTO_IP
set MULTICAST_ADDRESS
Traceback (most recent call last):
File "W:\Mijn documenten\test2.py", line 28, in
@JonOve this is greath.
I see that indeed your blind is reported as BiDirectionLimits
instead of BiDirection
(which my blinds have) so I can indeed see if position is supported.
I would like you to run this test.py script 3 more time:
Please indicate which result belongs to which situation. In that way I can figure out if we can see at least if the blind is fully open/closed.
@JonOve in regards to the socket error, could you change the test2.py file to this and test again:
import socket
import struct
MULTICAST_ADDRESS = '238.0.0.18'
UDP_PORT_RECEIVE = 32101
print("create socket")
udp_socket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM, socket.IPPROTO_UDP)
print("set blocking")
udp_socket.setblocking(True)
print("set REUSEADDR")
udp_socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
print("set IP_MULTICAST_IF using IPPROTO_IP")
udp_socket.setsockopt(socket.IPPROTO_IP, socket.IP_MULTICAST_IF, socket.INADDR_ANY)
print("set MULTICAST_ADDRESS using IPPROTO_IP")
mreq = struct.pack("=4sl", socket.inet_aton(MULTICAST_ADDRESS), socket.INADDR_ANY)
udp_socket.setsockopt(socket.IPPROTO_IP, socket.IP_ADD_MEMBERSHIP, mreq)
print("bind to port")
udp_socket.bind(("", UDP_PORT_RECEIVE))
print("Succes")
@starkillerOG
Yes, no problem; FYI, Updating of the status takes quit some time. Seems to me there is no update in case of halfway.
Closed W:\Mijn documenten>python test_closed.py <MotionGateway ip: 192.168.1.10, mac: d9bfc0c3d1e3, protocol: 0.9, firmware: None, N_devices: 1, status: Working, RSSI: -40 dBm> <MotionBlind mac: d9bfc0c3d1e30007, type: RollerBlind, status: Closing, position: 0 %, angle: 0.0, limit: NoLimit, battery: 0.0 %, 0.0 V, RSSI: -85 dBm, com: BiDirectionLimits>
Open W:\Mijn documenten>python test_open.py <MotionGateway ip: 192.168.1.10, mac: d9bfc0c3d1e3, protocol: 0.9, firmware: None, N_devices: 1, status: Working, RSSI: -41 dBm> <MotionBlind mac: d9bfc0c3d1e30007, type: RollerBlind, status: Opening, position: 0 %, angle: 0.0, limit: NoLimit, battery: 0.0 %, 0.0 V, RSSI: -85 dBm, com: BiDirectionLimits>
Halfway W:\Mijn documenten>python test_halfway.py <MotionGateway ip: 192.168.1.10, mac: d9bfc0c3d1e3, protocol: 0.9, firmware: None, N_devices: 1, status: Working, RSSI: -37 dBm> <MotionBlind mac: d9bfc0c3d1e30007, type: RollerBlind, status: Opening, position: 0 %, angle: 0.0, limit: NoLimit, battery: 0.0 %, 0.0 V, RSSI: -85 dBm, com: BiDirectionLimits>
Test2 W:\Mijn documenten>python test2.py create socket set blocking set REUSEADDR set IP_MULTICAST_IF using IPPROTO_IP set MULTICAST_ADDRESS using IPPROTO_IP bind to port Succes
@JonOve Thank you very much for the testing, I have fixed the socket part. I am still a bit unsure about the open/closed status, the "status" that is shown here i actually just the last command that has been sent to the blind, so that does not represent the open/closed status verry well I think. Could you run the following script one more time for the 3 situations: open/closed/half way:
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():
print(blind._write(blind.QUERY_DATA))
@starkillerOG
No problem at all!
Here the results using the Brel Home app to control the blind. Using the standard remote control, the status remains on "opening" or "closing" Just what is last used in the app.
Closed W:\Mijn documenten>python test_closed.py <MotionGateway ip: 192.168.1.10, mac: d9bfc0c3d1e3, protocol: 0.9, firmware: None, N_devices: 1, status: Working, RSSI: -43 dBm> <MotionBlind mac: d9bfc0c3d1e30007, type: RollerBlind, status: Closing, position: 0 %, angle: 0.0, limit: NoLimit, battery: 0.0 %, 0.0 V, RSSI: -85 dBm, com: BiDirectionLimits>
Halfway W:\Mijn documenten>python test_halfway.py <MotionGateway ip: 192.168.1.10, mac: d9bfc0c3d1e3, protocol: 0.9, firmware: None, N_devices: 1, status: Working, RSSI: -39 dBm> <MotionBlind mac: d9bfc0c3d1e30007, type: RollerBlind, status: Stopped, position: 0 %, angle: 0.0, limit: NoLimit, battery: 0.0 %, 0.0 V, RSSI: -85 dBm, com: BiDirectionLimits>
Open W:\Mijn documenten>python test_open.py <MotionGateway ip: 192.168.1.10, mac: d9bfc0c3d1e3, protocol: 0.9, firmware: None, N_devices: 1, status: Working, RSSI: -39 dBm> <MotionBlind mac: d9bfc0c3d1e30007, type: RollerBlind, status: Opening, position: 0 %, angle: 0.0, limit: NoLimit, battery: 0.0 %, 0.0 V, RSSI: -85 dBm, com: BiDirectionLimits>
@JonOve did you change the test scripts to use the:
print(blind._write(blind.QUERY_DATA))
line?
The output is not what I would expect...
@starkillerOG
So sorry, you are totally right, apologies. Made the changes in the file, but forgot to save them. Please find the correct results;
Closed W:\Mijn documenten>python test_closed.py <MotionGateway ip: 192.168.1.10, mac: d9bfc0c3d1e3, protocol: 0.9, firmware: None, N_devices: 1, status: Working, RSSI: -39 dBm> {'msgType': 'WriteDeviceAck', 'mac': 'd9bfc0c3d1e30007', 'deviceType': '10000000', 'msgID': '20220122141440951', 'data': {'type': 1, 'operation': 0, 'currentPosition': 0, 'currentAngle': 0, 'currentState': 0, 'voltageMode': 0, 'batteryLevel': 0, 'wirelessMode': 2, 'RSSI': -85}}
Halfway W:\Mijn documenten>python test_halfway.py <MotionGateway ip: 192.168.1.10, mac: d9bfc0c3d1e3, protocol: 0.9, firmware: None, N_devices: 1, status: Working, RSSI: -39 dBm> {'msgType': 'WriteDeviceAck', 'mac': 'd9bfc0c3d1e30007', 'deviceType': '10000000', 'msgID': '20220122140836436', 'data': {'type': 1, 'operation': 2, 'currentPosition': 0, 'currentAngle': 0, 'currentState': 0, 'voltageMode': 0, 'batteryLevel': 0, 'wirelessMode': 2, 'RSSI': -85}}
open W:\Mijn documenten>python test_open.py <MotionGateway ip: 192.168.1.10, mac: d9bfc0c3d1e3, protocol: 0.9, firmware: None, N_devices: 1, status: Working, RSSI: -39 dBm> {'msgType': 'WriteDeviceAck', 'mac': 'd9bfc0c3d1e30007', 'deviceType': '10000000', 'msgID': '20220122141001307', 'data': {'type': 1, 'operation': 1, 'currentPosition': 0, 'currentAngle': 0, 'currentState': 0, 'voltageMode': 0, 'batteryLevel': 0, 'wirelessMode': 2, 'RSSI': -85}}
@JonOve thank you very much for all your debuging. Unfortunatly I can now say for sure there is no reliable way to determine if your type of blind is opened or closed, it will only report the last command sent to the blind from the gateway, but if you use a remote or manual controls on the blind (if they are present) the last command of the gateway will not represent the state of the blind.
Therefore HomeAssistant will not be able to show a state (knowing if the blind is open or not).
However in this PR https://github.com/home-assistant/core/pull/64695 that was already merged, your issues will be fixed. The "up" button will no longer be greyed out, and the socket error will be resolved.
Thank you for helping in resolving these bugs (also for other users).
see: https://github.com/home-assistant/core/issues/64685#issuecomment-1019234252 for details about when the fix will be available/how to implement it already.
I will now close this issue since the original problem is fixed. If you experiance any other problems or have other questions, feel free to open this issue again or open a new issue.
Thanks a lot!
Just installed the integration in Home Assistant using the DD-1554 Brel hub. Stop and down functions properly, the "up" button however stays greyed out. The roller blind motor only has up, stop and down function. It does not have a position possibility. When I enable the wait for multicast option, also the stop and down button grey out. In the Brel Home app all 3 functions work fine using the same hub. Any hints or tips that might support me further installing the integration? Many thanks!!
Just read the article in which it says this error should be solved in 2021-11. I am on HA 2021-12-9 running on a Home Assistant Blue.