starkillerOG / motion-blinds

Python library for interfacing with Motion Blinds
MIT License
23 stars 9 forks source link

Issue Brel Blinds #13

Closed tomzorr closed 3 years ago

tomzorr commented 3 years ago

Hello,

I'm trying to add a Brel Hub what works, but it gives an error on a brel Blind. So it does see the motor.

This is what a get:

Device with mac 'e868e70bd7500008' send an response with unexpected data, please submit an issue at https://github.com/starkillerOG/motion-blinds/issues. Response: '{'msgType': 'ReadDeviceAck', 'mac': 'e868e70bd7500008', 'deviceType': '10000000', 'data': {'type': 1, 'operation': 2, 'wirelessMode': 0}}', Exception: ''RSSI''.

What can i try?

Thanks!

starkillerOG commented 3 years ago

@tomzorr it looks like your blind has wirelessMode 0 = Uni-direction instead of Bi-direction. That means the gateway can talk to the blind, but the blind can not talk back. Therefore the blind is unable to communicate things like RSSI connection, battery level, current position etc.

I will try to find some time to update this library to support Uni-direction blinds. however you schould still be able to control the blinds I think.

The following code schould open a blind:

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.Open()

And this code schould close a blind:

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.Close()

Could you try those?

starkillerOG commented 3 years ago

@tomzorr I just released version 0.5.4 of this library with some fixes for Uni-Direction blinds. Please update to that version and see if everything works as expected.

starkillerOG commented 3 years ago

Please also report back, so I can add Brel-blinds as working in the documentation once all bugs are fixed.

tomzorr commented 3 years ago

Thanks for the reply. I got all the stuff by a friend of my. I let you now so fast as possible and send him this information so he can check if it works.

emiel-qx commented 3 years ago

How to update?

starkillerOG commented 3 years ago

@emiel-qx are you using HomeAssistant or are you using this in a python script?

If you are using this in a python script, run this in command line: pip3 install --upgrade motionblinds

emiel-qx commented 3 years ago

No i'm using HomeAssistant. Reinstall the integration isnt updating to 0.5.4 i think?

starkillerOG commented 3 years ago

No that woun't work.

Please download the HomeAssistant files from here: https://github.com/starkillerOG/home-assistant/tree/Motion_blinds_2 (green button on the top right). Unzip the folder and copy the "motion_blinds" folder from homeassistant/components/motion_blinds/ to your HomeAssistant config folder under custom_components

Then in the motion_blinds folder, open the manifest.json file and add the version tag like this:

{
  "domain": "motion_blinds",
  "name": "Motion Blinds",
  "config_flow": true,
  "documentation": "https://www.home-assistant.io/integrations/motion_blinds",
  "requirements": ["motionblinds==0.5.4"],
  "dependencies": ["network"],
  "codeowners": ["@starkillerOG"],
  "iot_class": "local_push",
  "version": "1.0.0"
}

Then restart homeassistant and it schould work.

emiel-qx commented 3 years ago

Still the same error 2 errors :(

Error setting up entry Motion Blinds Gateway for motion_blinds Traceback (most recent call last): File "/usr/local/lib/python3.9/site-packages/motionblinds/motion_blinds.py", line 768, in _parse_response self._parse_response_common(response) File "/usr/local/lib/python3.9/site-packages/motionblinds/motion_blinds.py", line 761, in _parse_response_common self._RSSI = response["data"]["RSSI"] KeyError: 'RSSI'

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/config_entries.py", line 293, in async_setup result = await component.async_setup_entry(hass, self) # type: ignore File "/usr/src/homeassistant/homeassistant/components/motion_blinds/init.py", line 118, in async_setup_entry if not await connect_gateway_class.async_connect_gateway(host, key): File "/usr/src/homeassistant/homeassistant/components/motion_blinds/gateway.py", line 39, in async_connect_gateway await self._hass.async_add_executor_job(self.update_gateway) File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 52, in run result = self.fn(*self.args, **self.kwargs) File "/usr/src/homeassistant/homeassistant/components/motion_blinds/gateway.py", line 29, in update_gateway blind.Update_from_cache() File "/usr/local/lib/python3.9/site-packages/motionblinds/motion_blinds.py", line 832, in Update_from_cache self._parse_response(response) File "/usr/local/lib/python3.9/site-packages/motionblinds/motion_blinds.py", line 803, in _parse_response raise ParseException("Got an exception while parsing response") from ex motionblinds.motion_blinds.ParseException: Got an exception while parsing response


Device with mac 'e868e70bd750000b' send an response with unexpected data, please submit an issue at https://github.com/starkillerOG/motion-blinds/issues. Response: '{'msgType': 'ReadDeviceAck', 'mac': 'e868e70bd750000b', 'deviceType': '10000000', 'data': {'type': 6, 'operation': 1, 'wirelessMode': 0}}', Exception: ''RSSI''

emiel-qx commented 3 years ago

Wait, i think its not using the custom components folder. Do i need add something to my configuration.yaml? Because the error is given on the files in File "/usr/local/lib/python3.9/site-packages/motionblinds/motion_blinds.py

Something like ;

motion_blinds: IP: ip of hub key: key of hub

starkillerOG commented 3 years ago

looks like it indeed did not use the custom_components file. did you restart HomeAssistant after placing the motion_blinds folder in the custom_components folder? Do you see anything in the top of the log file about "using motion_blinds as a custom component"?

If you have acces to the python virtual enviroment where HomeAssistant is running you can also just use pip3 install --upgrade motionblinds inside that virtual enviroment.

emiel-qx commented 3 years ago

I can't access that because i did use the Homeassistant image in Virtualbox.

tomzorr commented 3 years ago

Hello Startkiller,

i can give you one of my brel motors for testing it out if you want.

starkillerOG commented 3 years ago

@tomzorr that would be greath, it is much easier to test with an actual device. How is the brel motor connected to your network, do you have some hub from brel, or do u use the motion hub? Please send me an e-mail to starkiller.og@gmail.com than we can discuss the details.

starkillerOG commented 3 years ago

@emiel-qx if you have python3 installed on some PC (operating system does not matter, can be windows) you can also just test this python lib directly: use: pip3 install --upgrade motionblinds on the command line of that PC to install this library.

then execute the following python script:

from motionblinds import MotionGateway
m = MotionGateway(ip = "192.168.1.100", key = "12ab345c-d67e-8f")

m.GetDeviceList()
m.Update()

for blind in m.device_list.values():
    blind.Update()
    print(blind)
starkillerOG commented 3 years ago

If you want to give the custom_component a go, I updated this repo: https://github.com/starkillerOG/HA-motion-blinds instructions are here https://github.com/starkillerOG/HA-motion-blinds#how-to-use

That is basically the dev version of HomeAssistant official integration, after a while that code will be merged in the official component (might take a while).

starkillerOG commented 3 years ago

HomeAssistant 2021.11.0 has been released and confirmed to work with Brel Hub and Brel Blinds with uni-direction control. Therefore I am closing this issue.

If you have any other problems or questions, feel free to open it again or make a new issue.