planbnet / livisi_unofficial

Unofficial fork of the home assistant livisi integration without dependencies on the abandoned aiolivisi lib
Apache License 2.0
36 stars 4 forks source link

Shutters #10

Closed Gerrett84 closed 1 year ago

Gerrett84 commented 1 year ago

Checklist

Is your feature request related to a problem? Please describe.

It would be great if you could add the shutter control. I would make myself available as a tester and test and carry out everything that is necessary ;-). I'd open a PR for it myself and add the code, but that's beyond my skills . If not, you still have my biggest thanks for continuing here without Livisi :-)

Describe the solution you'd like

Shutters Controll

Describe alternatives you've considered

I can't think of an alternative here

Additional context

I don't think it's necessary.

planbnet commented 1 year ago

I cannot do this - I don't even have window shutters (so even if I had access to the Livisi devices I couldn't test it), but I'd be happy to accept a PR from someone else (or backport changes from the official Livisi integration if they were implemented there).

acidburn78 commented 1 year ago

I think I will get roller shutter's next week. So I could do a PR in the next week's

ThMFlive commented 1 year ago

I get the additional roller shutter's today. So next week you can start.

ThMFlive commented 1 year ago

@acidburn78 I have the devices. Markus, please answer my mails to get them.

Gerrett84 commented 1 year ago

@acidburn78 Did you get it to work? :-)

planbnet commented 1 year ago

Inspired by https://github.com/home-assistant/core/pull/101701#issuecomment-1752865585 I added experimental and untested support in commit 529953f - maybe someone will test it before I release a new version?

Gerrett84 commented 1 year ago

Inspired by home-assistant/core#101701 (comment) I added experimental and untested support in commit 529953f - maybe someone will test it before I release a new version?

Awesome, I'll test it and report back

Gerrett84 commented 1 year ago

It doesn't fully work yet. It is possible to move the shutter up and down. Stopping also works. Unfortunately, the current position feedback is still missing Screenshot_20231015-200403

planbnet commented 1 year ago

Does the inital positioning (i.e. when starting HA) work? If not, then probably the code of the PR in the official repo doesn't work neither... If it does: I've added debug code that outputs the correct property type. If you could update to the latest code, retry and send me the debug output, I should be able to fix it.

Gerrett84 commented 1 year ago

No, the initial positioning doesn't Work.

2023-10-16 19:25:49.754 WARNING (MainThread) [homeassistant.helpers.entity] Entity None (<class 'custom_components.livisi.cover.LivisiShutter'>) is implicitly using device name by not setting its name. Instead, the name should be set to None, please create a bug report at https://github.com/planbnet/livisi_unofficial/issues 2023-10-16 19:25:49.988 ERROR (MainThread) [homeassistant.components.cover] Error adding entities for domain cover with platform livisi Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 507, in async_add_entities await asyncio.gather(*tasks) File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 752, in _async_add_entity await entity.add_to_platform_finish() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1056, in add_to_platform_finish await self.async_added_to_hass() File "/config/custom_components/livisi/cover.py", line 151, in async_added_to_hass response = await self.coordinator.async_get_device_state( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ AttributeError: 'LivisiDataUpdateCoordinator' object has no attribute 'async_get_device_state' 2023-10-16 19:25:50.041 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 507, in async_add_entities await asyncio.gather(*tasks) File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 752, in _async_add_entity await entity.add_to_platform_finish() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1056, in add_to_platform_finish await self.async_added_to_hass() File "/config/custom_components/livisi/cover.py", line 151, in async_added_to_hass response = await self.coordinator.async_get_device_state( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ AttributeError: 'LivisiDataUpdateCoordinator' object has no attribute 'async_get_device_state'

planbnet commented 1 year ago

Initial positioning should work now... Please check if that (and updating the state when already running) works now

Gerrett84 commented 1 year ago

Still doesn't work. But I can now also control the shutter with the dimmer. However, the position is still “unknown”

planbnet commented 1 year ago

I've added a debug commit that logs all incoming messages as an error (so they will appear without any changes to your logging settings).

Would you install the latest commit, start HASS and change the Shutter state a few times (move up, down, etc)? You could also switch a few other devices (dimmer and anything that also might not yet be supported) so I have a log of all those messages that i cannot reproduce with my hardware...

Gerrett84 commented 1 year ago

Looks like commit c848c06 solved the problem. Everything works now. Good job ! The dimmer has now been working since your last commit. Otherwise I don't have any other devices ;-)

` 2023-10-16 19:25:49.754 WARNING (MainThread) [homeassistant.helpers.entity] Entity None (<class 'custom_components.livisi.cover.LivisiShutter'>) is implicitly using device name by not setting its name. Instead, the name should be set to None, please create a bug report at https://github.com/planbnet/livisi_unofficial/issues

Dieser Fehler wurde von einer benutzerdefinierten Integration verursacht

Logger: custom_components.livisi Source: custom_components/livisi/livisi_websocket.py:65 Integration: Livisi Unofficial (documentation, issues) First occurred: 19:31:35 (78 occurrences) Last logged: 19:39:00

{"type": "StateChanged","namespace": "CosipDevices.RWE","desc": "/desc/device/ISR2.RWE/1.0/capability/RollerShutterActuator/event/StateChanged","source": "/capability/e53073c4f2f043c1b5adfed068a1095e","timestamp": "2023-10-17T17:36:13.866045Z","properties": {"shutterLevel": 0},"context": {"details": {}}} {"type": "StateChanged","namespace": "CosipDevices.RWE","desc": "/desc/device/ISR2.RWE/1.0/capability/RollerShutterActuator/event/StateChanged","source": "/capability/e53073c4f2f043c1b5adfed068a1095e","timestamp": "2023-10-17T17:36:19.364630Z","properties": {"shutterLevel": 3},"context": {"details": {}}} {"type": "StateChanged","namespace": "CosipDevices.RWE","desc": "/desc/device/ISR2.RWE/1.0/capability/RollerShutterActuator/event/StateChanged","source": "/capability/e53073c4f2f043c1b5adfed068a1095e","timestamp": "2023-10-17T17:36:23.216996Z","properties": {"shutterLevel": 0},"context": {"details": {}}} {"type": "StateChanged","namespace": "CosipDevices.RWE","desc": "/desc/device/WMD.RWE/1.0/capability/MotionDetectionSensor/event/StateChanged","source": "/capability/63ade31d06b140cdbedb04cf96872b87","timestamp": "2023-10-17T17:36:33.440274Z","properties": {"motionDetectedCount": 168},"context": {"details": {}}} {"type": "MotionDetected","namespace": "CosipDevices.RWE","desc": "/desc/device/WMD.RWE/1.0/capability/MotionDetectionSensor/event/MotionDetected","source": "/capability/63ade31d06b140cdbedb04cf96872b87","timestamp": "2023-10-17T17:36:33.442654Z","properties": {"luminance": 14},"context": {"details": {}}}`

planbnet commented 1 year ago

Thanks @Gerrett84 - I've released 1.7.0

ThMFlive commented 1 year ago

Thanks to @planbnet and @Gerrett84 for this update. It works very well. Very good job!

I think all the devices are now integrated.

MGODOIT commented 1 year ago

Thanks you @planbnet and @Gerrett84 ! I'm very happy with it. Great Job!!

Uli112Winsen commented 1 year ago

Thank you @planbnet and @Gerrett84 ! I'm very happy with it. Great Job !!