kesteraernoudt / dobiss

Custom Home Assistant Integration for the Dobiss NXT platform
MIT License
10 stars 2 forks source link

Covers with different opening times #152

Open migueldc73 opened 1 year ago

migueldc73 commented 1 year ago

My covers in Dobiss have different opening times.

2 covers need approx. 25seconds 1 cover in the living room (high window) needs 50seconds

Is there a way to configure different opening times for different cover entities ? And if not, could this be implemented one day ?

many thanks,

kesteraernoudt commented 1 year ago

This is already implemented, but not well documented indeed :).

See https://community.home-assistant.io/t/dobiss-nxt-support/245369/137 as well.

for examlpe, what I have in my customize.yaml file is this:

cover.bureel:
  travelling_time_up: 34
  travelling_time_down: 32
cover.bibliotheek:
  travelling_time_up: 55
  travelling_time_down: 50
cover.dressing:
  travelling_time_up: 33
  travelling_time_down: 33
cover.slk_ouders:
  travelling_time_up: 49
  travelling_time_down: 49
cover.duplex:
  travelling_time_up: 40
  travelling_time_down: 37

You might need to restart home assistant after modifying this file...

migueldc73 commented 1 year ago

Thank you very much, that worked fine for the curtains, but I forgot to mention that I also have 2 pulse operator covers : zwembad en garage.

As the pulse only lasts 1sec, these timed covers obviously don't work. So, I thought I could disable the timed covers features on the garage and zwembad by setting the up and down time to zero, but apparently that does not work. I have : customize:

    cover.gordijnen_keuken:
      travelling_time_up: 37
      travelling_time_down: 35
    cover.gordijnen_groot_raam:
      travelling_time_up: 90
      travelling_time_down: 73
    cover.gordijnen_zithoek:
      travelling_time_up: 37
      travelling_time_down: 35
    cover.garagepoort:
      travelling_time_up: 0
      travelling_time_down: 0
    cover.zwembad:
      travelling_time_up: 0
      travelling_time_down: 0

Is there another way to disable the timed covers only for garagepoort & zwembad ?

I could of course also set the pulse of both covers in Dobiss to the time it takes to open/close, but then the stop button still does not work the way it's supposed to be. Stop is supposed to send another pulse command (either the same or reverse direction) to stop.

kesteraernoudt commented 1 year ago

They are indeed all configured as timed, or all as non-timed.

Could you have a look if you can easily create your cover from the buttons itself using https://www.home-assistant.io/integrations/cover.template/? I think that will be much easier to do than trying to add this to the dobiss integration itself. If it doesn't work, I can have a look...

migueldc73 commented 1 year ago

Well, I already started implementing it differently by setting a delayed off of 3'30" on the Dobiss outputs and using the following automation to send a short trigger to stop the pool cover when HASS expects it to be in a stopped state:

alias: Zwembad - Stop Cover
description: ""
trigger:
  - platform: state
    entity_id:
      - cover.zwembad
    from: opening
    to: unknown
  - platform: state
    entity_id:
      - cover.zwembad
    from: closing
    to: unknown
condition: []
action:
  - choose:
      - conditions:
          - condition: state
            entity_id: binary_sensor.zwembad_inp1_cover_opening
            state: "on"
        sequence:
          - service: cover.open_cover
            data: {}
            target:
              entity_id: cover.zwembad
          - delay:
              hours: 0
              minutes: 0
              seconds: 0
              milliseconds: 500
          - service: cover.stop_cover
            data: {}
            target:
              entity_id: cover.zwembad
      - conditions:
          - condition: state
            entity_id: binary_sensor.zwembad_inp2_cover_closing
            state: "on"
        sequence:
          - service: cover.close_cover
            data: {}
            target:
              entity_id: cover.zwembad
          - delay:
              hours: 0
              minutes: 0
              seconds: 0
              milliseconds: 500
          - service: cover.stop_cover
            data: {}
            target:
              entity_id: cover.zwembad
mode: single

I admit this is far from elegant and it's probably better to use just 1s pulses on the Dobiss and implement a template cover. The thing is I have little experience with templates so far and each time I try to create a template, I don't see it end up in the entities. Guess I need to do some more studying on HA templating...

migueldc73 commented 1 year ago

I dropped the whole automation thing above (dodgy behaviour and far from elegant) and created a proper cover template as you suggested.

Entity cover.zwembad is the Dobiss cover which is controlled by 1sec pulses in Dobiss. I only use this as an input to this new template: cover.pool_cover which is the new cover I use within all my HASS cards

- platform: template
  covers:
    pool_cover:
      device_class: shutter
      friendly_name: "Zwembad Cover"
      unique_id: pool_cover

      value_template: >
        {% if is_state('binary_sensor.zwembad_inp1_cover_opening', 'on') %}
          opening
        {% elif is_state('binary_sensor.zwembad_inp2_cover_closing', 'on') %}
          closing
        {% elif is_state('binary_sensor.zwembad_inp3_cover_open', 'on') %}
          open
        {% elif is_state('binary_sensor.zwembad_inp4_cover_closed', 'on') %}
          closed
        {% else %}
          stopped
        {% endif %}

      position_template: >
        {% if is_state('binary_sensor.zwembad_inp1_cover_opening', 'on') %}
          50
        {% elif is_state('binary_sensor.zwembad_inp2_cover_closing', 'on') %}
          50
        {% elif is_state('binary_sensor.zwembad_inp3_cover_open', 'on') %}
          100
        {% elif is_state('binary_sensor.zwembad_inp4_cover_closed', 'on') %}
          0
        {% else %}
          50
        {% endif %}

      open_cover:
        if:
          - condition: state
            entity_id: binary_sensor.zwembad_inp2_cover_closing
            state: "on"
        then:
          - service: cover.close_cover
            data:
              entity_id: cover.zwembad
          - delay:
              milliseconds: 500    
          - service: cover.open_cover
            data:
              entity_id: cover.zwembad
        else:
          - service: cover.open_cover
            data:
              entity_id: cover.zwembad

      close_cover:
        if:
          - condition: state
            entity_id: binary_sensor.zwembad_inp1_cover_opening
            state: "on"
        then:
          - service: cover.open_cover
            data:
              entity_id: cover.zwembad
          - delay:
              milliseconds: 500    
          - service: cover.close_cover
            data:
              entity_id: cover.zwembad
        else:
          - service: cover.close_cover
            data:
              entity_id: cover.zwembad

      stop_cover:
        choose:
          - conditions:
              - condition: state
                entity_id: binary_sensor.zwembad_inp1_cover_opening
                state: "on"
            sequence:
              - service: cover.open_cover
                data:
                  entity_id: cover.zwembad
          - conditions:
              - condition: state
                entity_id: binary_sensor.zwembad_inp2_cover_closing
                state: "on"
            sequence:
              - service: cover.close_cover
                data:
                  entity_id: cover.zwembad

      icon_template: mdi:pool

The challenge is now to make them timed. I know the time to fully open or close the pool covers is 185secs

I know how to create a timer in automations and use that timer to set the cover template position, but now I am getting more familiar with the cover template, it would be more elegant to implement that timer into the cover template.

Any ideas or suggestions ?

kesteraernoudt commented 1 year ago

Would this be something you can use? https://community.home-assistant.io/t/custom-component-cover-time-based/187654