Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEATURE REQUEST] Stop a cover that has no state reporting with one click after an open/close command has been sent. (Ikea 1743 Remote / Somfy IO Shutters)) #368

Closed
10bn opened this issue Oct 8, 2021 · 11 comments
Assignees
Labels
enhancement New feature or request

Comments

@10bn
Copy link

10bn commented Oct 8, 2021

Feature Request

Is your feature request related to a problem?

I'm always frustrated that I have to hold_release my cover remotes when I want to stop a cover in a certain position.

Describe the solution / feature you'd like

When ever I press a remote to open/close a cover the app/automation saves the last command and starts a timer for a configurable amount of time e.g the maximum time the cover need's to close. If now in the defined timeframe the same button is pressed again it will default to e.g cover.stop_cover.
The timer is needed if one want's to fully close/open the cover and later on uses a different way to open it, so that on the next use the remote will sent an open / close command again and not cover.stop_cover.

@10bn 10bn added the enhancement New feature or request label Oct 8, 2021
@xaviml
Copy link
Owner

xaviml commented Oct 12, 2021

Hi @jaddel,

Thank you for opening this issue. First of all, if you want to open a cover and stop it, you can either hold (as you mention) or click twice as long it is using the toggle_open and toggle_close predefined actions.

Secondly, you can already achieve this behaviour with the delay action type. For example, you could do the following with the E1743 controller:

example_app:
  module: controllerx
  class: E1743CoverController
  integration: z2m
  controller: sensor.my_controller_action
  mapping:
    "on":
      - open
      - delay: 5 # Wait 5 seconds
      - stop
    "off": [close, {delay: 5}, stop] # You can also abbreviate like this

Obviously, you will need to configure how many seconds you want to wait until it stops after open/close.

Would this suit your needs?

Regards,
Xavi M.

@10bn
Copy link
Author

10bn commented Oct 13, 2021

Secondly, you can already achieve this behaviour with the delay action type. For example, you could do the following with the E1743 controller:

example_app:
  module: controllerx
  class: E1743CoverController
  integration: z2m
  controller: sensor.my_controller_action
  mapping:
    "on":
      - open
      - delay: 5 # Wait 5 seconds
      - stop
    "off": [close, {delay: 5}, stop] # You can also abbreviate like this

Obviously, you will need to configure how many seconds you want to wait until it stops after open/close.

Would this suit your needs?

I think to use toggle_open/close could be a good workaround for now.

For the second example you gave I'm not sure if you got me correct. If I read it right this is a sequence that gets fired once on / off is received.
What I had in mind was that the mapping for e.g on/off changes after the first command is received and reverts back after the timer has run out.

Would that also be possible?

@xaviml
Copy link
Owner

xaviml commented Oct 16, 2021

Hi @jaddel,

Let me see if I understand your use case correctly. You would like to open and close a cover with just a single button controller (or with just one button from one controller with multiple buttons). Then, let's imagine the following scenario:

  • The previous action was to close the cover, and the cover is already not moving.
  • You press the button.
  • The cover opens (because the previous action was to close).
  • While the cover is opening, you press the button, and the cover stops.
  • After the cover stopped, you press the button and the cover closes (because the previous action was to open).
  • You leave the cover open for 3 or 4 hours.
  • You come again and press the button.
  • The cover closes.

Is this sequence correct and what you would like to have? If so, I can help you out with the configuration for such a use case. Also, in this case, there is no need to configure a timing because the covers (normally) have the following states:

  • opened
  • closed
  • opening
  • closing

So, if the state is opening or closing, ControllerX would know if it is moving or not, so it can be stopped.

Regards,
Xavi M.

@10bn
Copy link
Author

10bn commented Oct 16, 2021

Hi @xaviml,

this is kind of what I want, I'm sorry if expressed my self not precise enough. I'll try to describe it better.

Setup:

I'm using the E1743 in combination Somfy IO shutters.
The Somfy Shutters unfortunately don't have any state reporting. I think this information was missing until now...
Here is an example: I just hit close and the cover closed but homeassistant is not updating the state at all.
image

Feature Description:

I tried to build the feature with the automation editor in Home Assistant and it works as expected. I hope this helps to describe the expected behavior.
I still prefer to use controllerx over the automation editor since it's easier to maintain for me and I already used it for almost everything regarding lights or covers.

alias: Office Cover
description: ''
trigger:
  - device_id: 5f8bcda84a5553705c9f7e0cc619848c
    domain: zha
    platform: device
    type: remote_button_short_press
    subtype: turn_on
    id: 'on'
  - device_id: 5f8bcda84a5553705c9f7e0cc619848c
    domain: zha
    platform: device
    type: remote_button_short_press
    subtype: turn_off
    id: 'off'
condition: []
action:
  - choose:
      - conditions:
          - condition: state
            entity_id: input_boolean.cover_helper
            state: 'on'
        sequence:
          - service: cover.stop_cover
            target:
              entity_id: cover.office_shade_2
          - service: input_boolean.turn_off
            target:
              entity_id: input_boolean.cover_helper
      - conditions:
          - condition: state
            entity_id: input_boolean.cover_helper
            state: 'off'
        sequence:
          - choose:
              - conditions:
                  - condition: trigger
                    id: 'on'
                sequence:
                  - service: cover.open_cover
                    target:
                      entity_id: cover.office_shade_2
                  - service: input_boolean.turn_on
                    target:
                      entity_id: input_boolean.cover_helper
              - conditions:
                  - condition: trigger
                    id: 'off'
                sequence:
                  - service: cover.close_cover
                    target:
                      entity_id: cover.office_shade_2
                  - service: input_boolean.turn_on
                    target:
                      entity_id: input_boolean.cover_helper
            default: []
    default: []
  - delay:
      hours: 0
      minutes: 0
      seconds: 30
      milliseconds: 0
  - service: input_boolean.turn_off
    target:
      entity_id: input_boolean.cover_helper
mode: restart

Implementation Example:

office_shade2:
  module: controllerx
  class: E1743StatelessCoverController
  controller: 68:0a:e2:ff:fe:81:32:4d
  integration: zha
  cover_duration: 30s # The time duration the cover needs to full open or close.
  cover: cover.office_shade_2

I hope this describes it well enough. :)

Br. Jaddel

@xaviml
Copy link
Owner

xaviml commented Oct 28, 2021

Hi @jaddel,

I now understand better the problem you are having. It seems to be a very specific use case and it is what you can achieve out of the box with toggle_open and toggle_close if the cover would have the opening and closing state as other covers do. This is the ControllerX equivalent configuration to achieve the same as the HA automation you showed above:

office_shade2_when_moving:
  module: controllerx
  class: E1743CoverController
  controller: 68:0a:e2:ff:fe:81:32:4d
  integration: zha
  cover: cover.office_shade_2
  mapping:
    "on": stop
    "off": stop
  constrain_input_boolean: input_boolean.cover_helper,off

office_shade2_when_not_moving:
  module: controllerx
  class: E1743CoverController
  controller: 68:0a:e2:ff:fe:81:32:4d
  integration: zha
  cover: cover.office_shade_2
  mode: restart
  mapping:
    "on": 
      - open
      - service: input_boolean.turn_on
        entity_id: input_boolean.cover_helper
      - delay: 30
      - service: input_boolean.turn_off
        entity_id: input_boolean.cover_helper
    "off":
      - close
      - service: input_boolean.turn_on
        entity_id: input_boolean.cover_helper
      - delay: 30
      - service: input_boolean.turn_off
        entity_id: input_boolean.cover_helper
  constrain_input_boolean: input_boolean.cover_helper,on

It is important to keep the cover_helper since ControllerX is stateless and it needs a way to keep the state you are tracking.

I am not going to discard your idea of the timer for covers that do not have the opening and closing states. So I will keep this issue open to add this feature to ControllerX.

Regards,
Xavi M.

@10bn
Copy link
Author

10bn commented Oct 29, 2021

Many thanks for the given example. It helps a lot!

I am not going to discard your idea of the timer for covers that do not have the opening and closing states. So I will keep this issue open to add this feature to ControllerX.

This sound great!
I very much appreciate your efforts to improve this charm of software continually.

xaviml added a commit that referenced this issue Oct 29, 2021
Duration of the cover to open and/or close in seconds, so `toggle_open` and `toggle_close` can stop the cover if the cover is still moving. This is recommended to be used when the cover does not report `opening` and `closing` states, otherwise it is not necessary.

related to #368
@xaviml
Copy link
Owner

xaviml commented Oct 29, 2021

Hi @jaddel,

I just added the cover_duration attribute, so you can now try the following configuration:

office_shade2:
  module: controllerx
  class: E1743CoverController
  controller: 68:0a:e2:ff:fe:81:32:4d
  integration: zha
  cover_duration: 30 # The time duration the cover needs to full open or close.
  cover: cover.office_shade_2

The description of the attribute is:

Duration of the cover to open and/or close in seconds, so `toggle_open` and `toggle_close` can stop the cover if the cover is still moving. This is recommended to be used when the cover does not report `opening` and `closing` states, otherwise, it is not necessary.

By default, the attribute is not considered unless is specified for use cases like yours.

Now if you press the "on" or "off" button while the timer of cover_duration is on, the cover will stop. The timer starts every time you press "on" or "off", so with "open" and "close" actions.

I released v4.17.0b1, so you can try the above config in that ControllerX version.

Let me know if this works for you.

Regards,
Xavi M.

@10bn 10bn changed the title [FEATURE REQUEST] Stop a cover with one click after an open/close command has been sent. (Ikea 1743 Remote) [FEATURE REQUEST] Stop a cover that has no state reporting with one click after an open/close command has been sent. (Ikea 1743 Remote / Somfy IO Shutters)) Oct 30, 2021
@10bn
Copy link
Author

10bn commented Oct 30, 2021

I just tried this configuration but it's not doing anything.

Version: v.4.17.0b1

living_room_shade:
  module: controllerx
  class: E1743CoverController
  controller: 58:8e:81:ff:fe:30:4a:ff
  integration: zha
  cover_duration: 30
  cover: cover.living_room_shades

What is strange that I have this in the logs even though there is no app configured with that name at the moment.

2021-10-30 22:00:19.311749 INFO AppDaemon: Initializing app office_shade2 using class E1743StatelessCoverController from module controllerx
2021-10-30 22:00:19.313432 WARNING AppDaemon: Unable to find class E1743StatelessCoverController in module controllerx - 'office_shade2' is not initialized

@10bn
Copy link
Author

10bn commented Oct 30, 2021

I just double checked the remote via zha_event in the developer section.
For some reason it wasn't working.

I'll check it again with a working remote and report back.

@xaviml
Copy link
Owner

xaviml commented Oct 30, 2021

Hi @jaddel,

It looks like the appdaemon logs do not match that configuration. The app is called living_room_shade, and there is no E1743StatelessCoverController class.

Regards,
Xavi M.

@10bn
Copy link
Author

10bn commented Oct 31, 2021

Hi @jaddel,

It looks like the appdaemon logs do not match that configuration. The app is called living_room_shade, and there is no E1743StatelessCoverController class.

Regards, Xavi M.

yes I know, but I still had that entry in the logs which did't make any sense since it wasn't configured.
Anyhow... :)

Today I restarted the host and now everything works as expected.

Thank you very much for adding this!

@10bn 10bn closed this as completed Oct 31, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants