question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Feature]: Inverted slider for cover card

See original GitHub issue

Is your feature request related to a problem?

I want to use the mushroom cover cards to control my KNX shutters in my house. In generell everything works. The problem is, that for the position slider, i need an inverted value, because in KNX 0% is fully open and for Home Assistant is 100% fully opened. Before i used the mushroom cover cards, i build the cards myself and for the slider is used a seperate entity with the following code:

cover:
  platform: template
  covers:
    cover_og_buero_inverted: ##Büro
      friendly_name: Buero Rolladen inverted
      position_template: >
        {{100 - (state_attr(‘cover.og_buero_rolladen’,‘current_position’)|int)}}
      set_cover_position:
        service: cover.set_cover_position
          data_template:
            entity_id: cover.og_buero_rolladen
            position: >
              {{100 - position}}

But in the mushroom cover card its not possible to use an seperate entity only for the slider. Up/down/hold works perfectly with the buttons.

Describe the solution you’d like

Seperate entity for the slider in the cover card

Describe alternatives you’ve considered

No response

Additional context

No response

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
piitayacommented, Sep 22, 2022
0reactions
spalicommented, Oct 6, 2022

That shouldn’t be required for KNX. The integration does the translation of the percentage. A closed cover shows 100% in KNX and 0% in Home Assistant. That’s the default and I can confirm this in my installation. Are you sure you don’t mix up anything?

Home Assistant definition:

knx:
  cover:
    - name: buro_jalousie_fenster
      move_long_address: 3/1/81
      move_short_address: 3/2/81
      position_address: 3/3/81
      angle_address: 3/4/81
      position_state_address: 3/6/81
      angle_state_address: 3/7/81
      travelling_time_down: 44
      travelling_time_up: 45

Home Assistant Status for closed (current_position: 0): image KNX Status for closed (100%): image

So this shouldn’t be the case if setup by default.

I had a similar problem, but only because an exception for the vertical blinds (german: "Markise). For me it’s natural that the button down would “open” it and the button up would close it (similar to the physical orientation). So the Buttons worked as expected. But the status felt wrong for me, because Open is for me when it’s out (create shade). and closed when it’s rolled up (no shade).

So i created my own card with inverted state in the GUI. It was not out of the box, but works well now for me. You need card-mod and stack-in-card. With them I created basically a template card, which shows the inverted icon and state. And below the default mushroom cover card with the buttons.

type: custom:stack-in-card
cards:
  - type: custom:mushroom-template-card
    card_mod:
      style: |
        ha-card {
          padding-bottom: 0 !important;
        }
    primary: Markise
    secondary: |-
      {% set pos = state_attr(entity, 'current_position') %}
      {{
        'Geschlossen' if pos == 100 else
        'Schliesst' if states(entity) == 'opening' else
        'Öffnet' if states(entity) == 'closing' else
        'Offen'
      }}{{ (' - ' +  (100-pos) | string + '%') if pos > 0 and pos < 100 }}
    icon: |-
      {{
        'mdi:blinds-open' if state_attr(entity, 'current_position') == 100 else
        'mdi:arrow-down-box' if states(entity) == 'closing' else
        'mdi:arrow-up-box' if states(entity) == 'opening' else
        'mdi:blinds'
      }}
    entity: cover.aussen_sitzplatz_markise_sud_sitzplatz
    icon_color: '{{ ''grey'' if state_attr(entity, ''current_position'') == 100 else ''blue'' }}'
    layout: vertical
  - type: custom:mushroom-cover-card
    entity: cover.aussen_sitzplatz_markise_sud_sitzplatz
    show_buttons_control: true
    layout: vertical
    tap_action:
      action: more-info
    name: Markise
    primary_info: none
    secondary_info: none
    icon_type: none
    card_mod:
      style: >
        {% set color = '--rgb-disabled' if
        state_attr('cover.aussen_sitzplatz_markise_sud_sitzplatz',
        'current_position') == 100 else '--rgb-blue' %}

        :host {
          --rgb-state-cover-closed: var({{color}}) !important;
          --rgb-state-cover-closing: var({{color}}) !important;
          --rgb-state-cover-open: var({{color}}) !important;
          --rgb-state-cover-opening: var({{color}}) !important;
        }
Read more comments on GitHub >

github_iconTop Results From Across the Web

Sliding Flip Page Card | Slide & Stand Card - YouTube
Learn how to make a pretty Sliding Flip Page Card following my easy tutorial.Please find links to the product I use below.
Read more >
New! Easy Open-and-Slide Surprise Cards - YouTube
How to make a card with a simple surprise inside! ... [ SSS ] ——— https://ldli.co/e/7e70py [ ELH ] • Reverse Confetti Big...
Read more >
Custom Button Card 6: Shadows Glows and Sliders - YouTube
Sometimes having flat Home Assistant dashboard Icons is not enough Make them stand-out (literally) from the background by adding ...
Read more >
mattieha/slider-button-card - GitHub
A button card with integrated slider for light, switch, fan, cover, ... Invert calculation of state and percentage, useful for cover entities, false...
Read more >
Carousel/slider design best practices (with examples) - Webflow
Arrows that, on click, advance to the next slide, or move back. You can place these visually on the slides, or either above...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found