openwebnet / openwebnet-android

OpenWebNet Android client for My Home BTicino and Legrand home automation system
https://openwebnet.xyz
MIT License
34 stars 21 forks source link

[AUTOMATION] Support for General / Area / Group #65

Closed niqdev closed 5 years ago

niqdev commented 7 years ago

Handle groups

bozzy-gh commented 7 years ago

I agree. Like in the Lighting function, general, area and group would be helpful also for Automation.

niqdev commented 7 years ago

[Hacktoberfest] Please contact me to have more info about this issue, any help would be very appreciated. Thanks

niqdev commented 5 years ago

@bozzy-gh I'm currently looking into this and I would like to close the issues marked as priority ASAP If I release this feature in beta testing, would you be able to test it for me? Do you have also a bus interface for light and automation? Thanks

bozzy-gh commented 5 years ago

Yes I can test it. And no, unfortunately I don't have bus interfaces, my system is all on one master bus. Tell me when you'll release the beta, I'll back to you with my test results ASAP.

niqdev commented 5 years ago

Awesome, thanks a lot for the support! Today I've already upgraded the library and I need to finish the integration with the app. I'll come back to you as soon as it's ready. Thanks

niqdev commented 5 years ago

@bozzy-gh I've just released version 3.3.0 in beta testing which adds the support for automation and bus. Looking forward for your feedback, thanks!

bozzy-gh commented 5 years ago

Here I am. Tested lighting and automation group, area and general functions. Issued commands generally work (see note on automation below), so the main purpose is achieved.

My observations:

1 - buttons in the same ambient don't automatically reflect state changes when other buttons are used, i.e. when switching ON a group, point-to-point lights (or automations) in the same ambient don't show the correct state, unless you manually refresh the page.

2 - while in lighting I see that a group button is only shown ON when all the lights in that group are ON, in automation I noticed inconsistent behaviour, e.g. I set up a group of 2 roll-up shutters, then activated only one and the group button (after page refresh) showed the same state as the single moving shutter, even if the other one was stopped; then I tried activating only the other shutter and this time the group button was OFF... it seems that the group button reacts to only one of the group members; also if I set one shutter to go up and the other to go down, the group button always shows the state of one shutter.

3 - this is quite strange: talking about general buttons, while in lighting a switch ON or OFF command is issued instantly, in automation it freezes for about 2 seconds before issuing the command... this only happens to general, while area and group commands are issued almost instantly.

4 - there's a noticeable delay when opening pages containing group/area/general buttons.

I have a suggestion that could improve on points 1 and 4, and generally on the whole app performance, but I think it would require quite a lot of work... there should be some sort of state memory (a local DB or something) between the pages, so that a light status is read only once and kept in memory, so further needs to get its value wouldn't require to ask the system and wait for a response. This would be quite effecive for group/area/general buttons. I have a question related to this topic: are you using a "monitoring session" to read responses from MyHOME system, or do you relay on the responses returned after a command is issued?

niqdev commented 5 years ago

I've responded inline, thanks a lot for your feedback!

1 - buttons in the same ambient don't automatically reflect state changes when other buttons are used, i.e. when switching ON a group, point-to-point lights (or automations) in the same ambient don't show the correct state, unless you manually refresh the page.

This is by design/choice, you actually need to refresh the list to get the current value. It's hard to keep state in sync since you could switch on a light from another device or manually. The app is not listening for any event

2 - while in lighting I see that a group button is only shown ON when all the lights in that group are ON, in automation I noticed inconsistent behaviour, e.g. I set up a group of 2 roll-up shutters, then activated only one and the group button (after page refresh) showed the same state as the single moving shutter, even if the other one was stopped; then I tried activating only the other shutter and this time the group button was OFF... it seems that the group button reacts to only one of the group members; also if I set one shutter to go up and the other to go down, the group button always shows the state of one shutter.

This might require further investigation, but I would need a full dump with netcat of all the requests/responses in order understand how it actually works and if there is any issues. Unfortunately from what I've seen, gateway responses are not very reliables for how the protocol works, there is no rest/http endpoint unfortunately

3 - this is quite strange: talking about general buttons, while in lighting a switch ON or OFF command is issued instantly, in automation it freezes for about 2 seconds before issuing the command... this only happens to general, while area and group commands are issued almost instantly

This is good to know, thanks for reporting this, although I'm not sure I can do much about it for now. Does the app freeze/crash or it just takes ages to finish load the cards?

4 - there's a noticeable delay when opening pages containing group/area/general buttons.

Good to knows

are you using a "monitoring session" to read responses from MyHOME system, or do you relay on the responses returned after a command is issued?

No every time all the commands are issued, even if they are run in parallel, until all the responses are received the list is not shown. It was initially done to make it easier, one solution would be to always show all the cards and a loader where the actions are, but this would require a lot of changes and it's out of scope for now

niqdev commented 5 years ago

I will close the issue, since the feature has been implemented, but feel free to re-open it or open other issues related to it