doudz / homeassistant-zigate

zigate component for Home Assistant
MIT License
48 stars 13 forks source link

cover support #44

Closed dcolens closed 5 years ago

dcolens commented 5 years ago

I'm trying to use the Legrand mentioned in https://github.com/doudz/zigate/issues/63 with this module.

my first issue was that the cover module is not listed in the supported platforms: https://github.com/doudz/homeassistant-zigate/blob/802dff6fa1fd7ce886bdfc506315d264cd0b2cc2/zigate/__init__.py#L34-L37 this is pretty easy to fix, so I added it to the list.

Adding this line enables the cover module and a cover device gets created:

2019-04-25 09:38:29 DEBUG (SyncWorker_15) [custom_components.zigate] Add device Legrand Shutter switch with neutral (828f) 0004740000815460
2019-04-25 09:38:30 DEBUG (SyncWorker_7) [custom_components.zigate.cover] Creating cover for device Legrand Shutter switch with neutral (828f) 0004740000815460 1

I'm a bit confused with the fact 2 devices get created: 0004740000815460 and 0004740000815460_1.

0004740000815460_1 seems to be the one I'm interested in, however HA lists it as UNAVAILABLE which it is not. If I press one of the 2 buttons on the switch, I can see the zigate logs on HA debugs so I believe it is connected fine.

sample debugs

2019-04-25 09:42:30 DEBUG (ZiGate-Listen) [zigate] Raw packet received, b'\x01\x81\x02\x12\x02\x10\x02\x1eQ\xca\x82\x8f\x02\x11\x02\x11\x02\x12\x02\x10\x02\x18\x02\x10 \x02\x10\x02\x11dT\x03'
2019-04-25 09:42:30 DEBUG (ZiGate-Event Loop) [zigate] Dispatch ZIGATE_PACKET_RECEIVED
2019-04-25 09:42:30 DEBUG (ZiGate-Decode data) [zigate] Received response 0x8102: b'ca828f01010200080020000164'
2019-04-25 09:42:30 DEBUG (ZiGate-Decode data) [zigate] RESPONSE 0x8102 - Individual Attribute Report : sequence:202, addr:828f, endpoint:1, cluster:258, attribute:8, status:0, data_type:32, size:1, data:100, lqi:84
2019-04-25 09:42:30 DEBUG (ZiGate-Decode data) [zigate] Dispatch ZIGATE_ATTRIBUTE_UPDATED
2019-04-25 09:42:30 DEBUG (ZiGate-Decode data) [custom_components.zigate] Update attribute for device Legrand Shutter switch with neutral (828f) 0004740000815460 {'endpoint': 1, 'cluster': 258, 'addr': '828f', 'attribute': 8, 'data': 100, 'name': 'current_position_lift_percentage', 'value': 100}

I can see the 0004740000815460 device but no actions are available, and because 0004740000815460_1 remains unavailable, I can't really do anything with it.

I tried deleting the devices from HA, deleting the zigate.json and restarting. I'm not too sure how the availability state is computed ? Can you help ?

Note: I'm a new to HA, sorry if I missed something obvious?

doudz commented 5 years ago

Availability is not implemented, maybe it's the problem.

doudz commented 5 years ago

You should have a cover entity cover.zigate_0004740000815460_1 and you should be able to open / close and stop

doudz commented 5 years ago

Any news ?

dcolens commented 5 years ago

aaah, sorry, I forked and patched it I can submit a pull request if you like ?

doudz commented 5 years ago

yes, PR are welcome :)

ozer59 commented 5 years ago

Hello i try to use it with home assistant, you can help me ? thank's

dcolens commented 5 years ago

@ozer59 I submitted a patch (https://github.com/doudz/homeassistant-zigate/pull/51) that makes the Legrand switch work for me, give it a try and let me know!

To test, replace the cover.py file by https://github.com/doudz/homeassistant-zigate/blob/62867856266c8b96ba809081398ceafaf67e3ca1/zigate/cover.py and restart home-assistant.

ozer59 commented 5 years ago

ok it's work for me thank's a lot for return of state is hard to code ? sorry for my poor english

thank's for your work

doudz commented 5 years ago

@ozer59 the Legrand switch doesn't support state