homekit-infused icon indicating copy to clipboard operation
homekit-infused copied to clipboard

[Bug] Button card "type: cover": Erratic initial position and label when using "cover_control: tilt_position"

Open veitw opened this issue 2 years ago • 3 comments

Hi,

I am on release 2022.4.1 and tried to add my blinds with tilt control to HKI, example:

        - title: Fenster
          columns: 4
          entities:
            - name: Jalousie rechts
              entity: cover.schlafzimmer_beschattung_rechts
              type: cover
              cover_control: tilt_position
              label: '[[[ return entity.attributes.current_tilt_position + "%" ]]]'

Unfortunately this is buggy both for the position fed to the cover popup card, and also for the label on the button card:

  1. When tapping on the button card, the popup opens. But the initial position of the slider is not read from the current_tilt_position attribute, but from current_position instead. So with the blinds closed, when opening the popup, it always shows 0 instead of the current tilt position. When I run the blinds to 50% open, the popup slider shows 50 instead of the current tilt position. Tilt position control using the slider however works fine, it is just the initial value when opening the card that is wrong.

  2. The label on the button card shows the value of the current_position attribute, too, though I was able to work around this issue using the custom label template in my config above, IMO this should show the value of current_tilt_position by default if the button card is set to cover_control: tilt_position.

Thanks for this great piece of software!

Best regards, // Veit

veitw avatar Jun 13 '22 16:06 veitw

Thanks for the feedback, I will look into it. But since I do not have covers (and no one really tell me about this) it is difficult to test.

I will keep this in mind though

jimz011 avatar Jun 13 '22 16:06 jimz011

@jimz011 : Can I help with testing?

Alternatively, you could create a virtual cover using cover.template that e.g. simply runs actions that send notifications or emit events or log entries. If you enable optimistic mode for both position and tilt position, you do not have to take care for a feedback channel, HA will simply assume then that the position/tilt position you set has been successfully set and transfer this value to current_cover_position and current_cover_tilt_position:

  - platform: template
    covers:
      my_virtual_cover:
        friendly_name: "my virtual cover"
        device_class: blind
        optimistic: true
        tilt_optimistic: true
        open_cover:
          service: ...
          data: ...
        close_cover:
          service: ...
          data: ...
        stop_cover:
          service: ...
          data: ...
        set_cover_position:
          service: ...
          data:
            ...
            position: "{{position}}"
        set_cover_tilt_position:
          service: ...
          data:
            ...
            tilt: "{{tilt}}"

veitw avatar Jun 13 '22 17:06 veitw

My sincere apologies for this extremely late reply. I have been really busy lately (and still am), but that doesn't mean I don't want to invest time anymore in this project. So the answer is yes, if you can help with anything covers related I'd be glad to accept it.

In March I will move out to a new home and I will buy actual covers, so whatever happens, this will be addressed sooner or later.

jimz011 avatar Oct 26 '22 20:10 jimz011