Skip to content

Rflink group commands#5969

Merged
balloob merged 3 commits into
home-assistant:devfrom
aequitas:rflink_group_commands
Mar 29, 2017
Merged

Rflink group commands#5969
balloob merged 3 commits into
home-assistant:devfrom
aequitas:rflink_group_commands

Conversation

@aequitas
Copy link
Copy Markdown
Contributor

Description: Support for group commands (allon/alloff).

Related issue (if applicable): fixes #5965

@mention-bot
Copy link
Copy Markdown

@aequitas, thanks for your PR! By analyzing the history of the files in this pull request, we identified @fabaff to be a potential reviewer.

@aequitas
Copy link
Copy Markdown
Contributor Author

@Lampy09 can you verify if this works for you?

@aequitas
Copy link
Copy Markdown
Contributor Author

This PR is based on: #5869

@lajuffermans
Copy link
Copy Markdown

Thanks for the quick implementation, I'll test this tonight :)

@lajuffermans
Copy link
Copy Markdown

@aequitas it does 'work', however a group command is more like an alias for Kaku's. For example, the first time you set up a light you assign a regular on/off and (optionally) the group all_on/all_off. So a light in the same range doesn't have to be assigned necessarily to the group button.

In the current implementation you assume all lights in the same range are 'paired' to the group button.

So maybe it's possible to register the group button so people can add them in the configuration as aliases? (or maybe I'm missing something)

@aequitas
Copy link
Copy Markdown
Contributor Author

For my Kaku remote all lights respond when using the group switch. Even if they are not programmed explicitly with the group. Would have to double-check with a reset switch if it is not because of an old programming. But I'm pretty sure this is the expected behaviour.

@lajuffermans
Copy link
Copy Markdown

Maybe a hardware difference? I'm using this remote: https://www.klikaanklikuit.nl/nl/ayct-102-afstandsbediening.html

It's not very clear in the manual but I had to assign/program the receivers I wanted to listen to the group key explicitly. And that's how it works for me know I have 4 receivers:
newkaku_AAAA_1
newkaku_AAAA_2
newkaku_AAAA_3
newkaku_AAAA_4

And only 2 and 3 are programmed to the group key.

@aequitas
Copy link
Copy Markdown
Contributor Author

The manual doesn't state it clearly indeed. I have the same remote (or at least it looks the same) and an older model (wheel type). Will verify the behaviour of those later today or tomorrow. What receivers are you using? Maybe those make a difference?

@lajuffermans
Copy link
Copy Markdown

I use mixed receivers:

However, if I look into a similar remote manual it says:

Door de groeptoets “G” ook aan iedere
ontvanger toe te kennen, kunt u met één druk
op de knop al uw ontvangers (ook dimmers)
tegelijk aan of uitschakelen.

@aequitas
Copy link
Copy Markdown
Contributor Author

The device I used for testing is: http://www.homewizard.nl/media/wysiwyg/handleiding/APA3-1500R%20Gebruiksaanwijzing.pdf

This is sold as 3 switches with one remote. The remote only has an off group button. Which sends out the alloff on the first switch channel. The switches also respond similar on allon alloff commands from other non apa3-1500R remotes.

I'm going to do some more debugging with other receivers and probably make the current implementation configurable and allow responding to group commands as well as normal on/off for devices.

@aequitas
Copy link
Copy Markdown
Contributor Author

Vastly simplified group command support. Behavior of both group mechanisms (explicit register and implicit on first switch channel) can now be enabled by adding an alias. Also added some changes that will potentially solve issues mentioned in #5965

@lajuffermans
Copy link
Copy Markdown

Interesting thing btw, the group switch uses the same 'switch' (id) as switch 1:

DEBUG:rflink.protocol:received data: A;NewKaku;ID=009d1be6;SW DEBUG:rflink.protocol:received data: ITCH=1;CMD=ON; DEBUG:rflink.protocol:got packet: 20;0A;NewKaku;ID=009d1be6;SWITCH=1;CMD=ON; DEBUG:rflink.protocol:decoded packet: {'id': '009d1be6', 'command': 'on', 'node': 'gateway', 'switch': '1', 'protocol': 'newkaku'} DEBUG:rflink.protocol:got event: {'id': 'newkaku_009d1be6_1', 'command': 'on'} newkaku_009d1be6_1 on

DEBUG:rflink.protocol:received data: 20;0B;NewKaku;ID=009d1be DEBUG:rflink.protocol:received data: 6;SWITCH=1;CMD=ALLON; DEBUG:rflink.protocol:got packet: 20;0B;NewKaku;ID=009d1be6;SWITCH=1;CMD=ALLON; DEBUG:rflink.protocol:decoded packet: {'id': '009d1be6', 'command': 'allon', 'node': 'gateway', 'switch': '1', 'protocol': 'newkaku'} DEBUG:rflink.protocol:got event: {'id': 'newkaku_009d1be6_1', 'command': 'allon'} newkaku_009d1be6_1 allon

So how would it even be possible to use the group key as an alias?

@aequitas
Copy link
Copy Markdown
Contributor Author

Correct, but it depends on the remote. I have one remote where there is no other button that uses the 1 switch and another that has the first button also as switch one.

Aliases can be used multiple times for different devices. You can even assign an ID for a device as an alias for another.

@lajuffermans
Copy link
Copy Markdown

So in my situation, how am I able to alias the group switch?

newkaku_009d1be6_1:
  name: Dining
  type: dimmable
newkaku_009d1be6_2:
  name: Corner
  type: dimmable
newkaku_009d1be6_3:
  name: Television
  type: dimmable

The funny thing is, 'television' & 'corner' are the only 2 lights linked to the group switch, which is 'newkaku_009d1be6_1' in my case. Putting 'newkaku_009d1be6_1' as an alias under 'corner' doesn't make sense right? Because if I turn on/off 'dining', it will also turn off 'corner' for example.

Or am I missing something?

@aequitas
Copy link
Copy Markdown
Contributor Author

True, that is one shortcoming I already foresaw. I have some ideas on how to fix this but don't know which one would be best in order to work with all cases but keep configuration simple an logical.

Easiest for now is to not use button '1' ;)

@lajuffermans
Copy link
Copy Markdown

Maybe it's an idea to use 'newkaku_009d1be6' (without switch numbers) as aliases?
So if an allon/alloff event is triggered, check if 'newkaku_009d1be6' is used as alias somewhere, if true turn them on/off. If no aliases are found, turn all lights on/off like you've had implemented before?

(I'm not sure what the possibilities are or what the impact on other devices is ;) )

@andrey-git
Copy link
Copy Markdown
Contributor

Any updates on this PR?

@aequitas
Copy link
Copy Markdown
Contributor Author

I'm gonna come back on this PR in a few days.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

line too long (103 > 79 characters)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing whitespace after ','
line too long (91 > 79 characters)

@aequitas
Copy link
Copy Markdown
Contributor Author

aequitas commented Mar 7, 2017

@Lampy09 i pushed an update. Can you test if this works for you?

config example:

newkaku_009d1be6_2:
  name: Dining
  type: dimmable
  group_aliasses:
    - newkaku_009d1be6_1

@lajuffermans
Copy link
Copy Markdown

It's basically working, however in my situation I still have the individual light (dining) which is also listening to the group command, example of my config:

newkaku_009d1be6_1:
  name: Dining
  type: dimmable
newkaku_009d1be6_2:
  name: Corner
  type: dimmable
  group_aliasses:
    - newkaku_009d1be6_1
newkaku_009d1be6_3:
  name: Television
  type: dimmable
  group_aliasses:
    - newkaku_009d1be6_1

Theoretically the state of 'dining' shouldn't switch on/off when 'newkaku_009d1be6_1' all_on/all_off is sent.

@aequitas
Copy link
Copy Markdown
Contributor Author

aequitas commented Mar 7, 2017

Ah, yes. Let me see how we can fix that.

@lajuffermans
Copy link
Copy Markdown

Installed 0.41.0.dev0 (pip3 install --upgrade git+git://github.com/aequitas/home-assistant@rflink_group_commands)

However I'm unable to send rflink commands from home assistant (state doesn't change, light isn't turned on/off). It's still receiving commands when I use my remote.....

@aequitas
Copy link
Copy Markdown
Contributor Author

@Lampy09 I just updated the branch against the latest upstream. Can you try again? Can you also paste you config?

@lajuffermans
Copy link
Copy Markdown

I think it's related to Home Assistant 0.40.0 and higher. 0.39.3 is working like expected.
I'll try to do some more investigation tomorrow.

@aequitas
Copy link
Copy Markdown
Contributor Author

There is currently a issue with 0.40 maybe its affecting your setup to: #6580

@lajuffermans
Copy link
Copy Markdown

Hi @aequitas, is this testable again? Since #6580 is fixed/released in 0.40.1?

@aequitas
Copy link
Copy Markdown
Contributor Author

Can you try again now?

@lajuffermans
Copy link
Copy Markdown

@aequitas I can confirm it's working like expected 👍

Add 'group_aliasses' config attribute that only respond to group commands.
Add nogroup_aliases that only respond to 'on' 'off' commands.
Allow settings device id group behaviour.
@aequitas aequitas mentioned this pull request Mar 23, 2017
5 tasks
@Spartan-II-117
Copy link
Copy Markdown
Contributor

Is this ready for merge?

@aequitas
Copy link
Copy Markdown
Contributor Author

Yes, ready.

@balloob balloob merged commit e1ed076 into home-assistant:dev Mar 29, 2017
@balloob
Copy link
Copy Markdown
Member

balloob commented Mar 29, 2017

💃 🐬

@fabaff fabaff mentioned this pull request Apr 6, 2017
@home-assistant home-assistant locked and limited conversation to collaborators Jul 17, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Rflink features/bugs

10 participants