Possibility to show current shutter-position?

As far as I know, you can’t create sensors from the GUI currently.

I only see the Doppel-S (double S) how we call it in Switzerland in the friendly name not in the entity_id, so there should be no issue.

There’s a guide on how to install lovelace plugins linked in the link that @pedrorferreira posted:

Hi, yes, I already saw it… but I am still getting an error and I am not yet sure, if (or better where) I’ve made a mistake… :smiley:

Did you restart HA? Can you please post the error?

1 Like

Okay, So here we go with a “vanilla yaml version”
To make it clear,I don’t have covers and don’t plan on having any soon but …
With gracious thanks to : -
@febalci @pedrorferreira for the inputs and @Burningstone just for his usual support :wink:
@Joca - I don’t use scenes, I use scripts for the equivalent, but thanks anyway

I have put the following together, please point out any mistakes
(I don’t have covers - so can’t test at all ) and I’ll correct them so that anyone coming across it doesn’t get side-swiped. (This is written for a package so cut and paste snippets if you don’t use them).

sensor:
  - platform: template
    sensors:
      s_cover_bed1_position:
        friendly_name: Bed 1 Cover Position
        value_template: "{{ state_attr(‘cover.bed1_cover’, ‘current_position’) }}"
        icon_template: >
          {% set posn = state_attr(‘cover.bed1_cover’, ‘current_position’) | int %}
          {% if posn == 0 %}
            mdi:window-shutter
          {% elif posn == 100 %}
            mdi:window-shutter-open
          {% else %}
            mdi:window-shutter-alert
          {% endif %}

input_datetime:
  id_cover_bed1_open:
    name: Bed1 Cover Opens At
    has_time: true
    icon: mdi:clock-start
  id_cover_bed1_close:
    name: Bed1 Cover Closes At
    has_time: true
    icon: mdi:clock-end

input_number:
  in_cover_bed1_posn_ctrl:
    name: Bed 1 Position Control
    min: 0
    max: 100
    step: 1
    mode: slider
    icon: mdi:rotate-right

automation:
  - alias: au_cover_bed1_posn_ctrl
    trigger:
      - platform: state
        entity_id: input_number.in_cover_bed1_posn_ctrl
    action:
      - service: cover.set_cover_position
        data_template:
          entity_id: cover.bed1_cover
          position: "{{ states('input_number.in_cover_bed1_posn_ctrl') | int }}"
  - alias: au_cover_bed1_open
    trigger:
      - platform: template
        value_template: "{{ states('sensor.time') == states('input_datetime.id_cover_bed1_open') [0:5] }}"
    action:
      - service: input_number.set_value
        entity_id: input_number.in_cover_bed1_posn_ctrl
        value: 90
  - alias: au_cover_bed1_close
    trigger:
      - platform: template
        value_template: "{{ states('sensor.time') == states('input_datetime.id_cover_bed1_close') [0:5] }}"
    action:
      - service: input_number.set_value
        entity_id: input_number.in_cover_bed1_posn_ctrl
        value: 0

The above requires sensor.time to have been set up
I’ve put some sample automations in (for time activation too) feel free to adapt

Two possible issues : -

  1. not sure how the position sensor updates I would guess that an attribute change of ‘cover.bed1_cover’ will trigger the update and the ‘watcher’ should be set from reading the template. There’s no other entities so not bothered setting the entity_id: header in the sensor
  2. “IF” someone, manually moves the cover then the ‘input_number.in_cover_bed1_posn_ctrl’ will get out of sync. (I could set an automation watcher on the position, checking that the automation hadn’t fired in the last ~45 seconds, if it hadn’t - wait ~45 seconds and then update the input number with the actual current position. What do you guys think ?

I hate having to build stuff like this without an actual device to work from, so this ‘may’ be my first and last attempt at doing so…

I swear :pray: no edits until someone feeds back a mistake (there’s bound to be at least one)
:beers:

2 Likes

Sorry if this isn’t prudent. I am new at this.

I am trying to create a card that shows the current position of a blind/cover using svg icons (open / 25 / 50 / 75 / closed), so that it animates when opening and closing, plus showing a decently accurate representation of how low the cover is at any moment. The generic icons for open / close is just boring, but what I want to do seems terribly difficult to achieve.

I have read many threads that touch upon it but none that give a complete explanation, so that we who are codeally challenged might understand. Do I have to create a sensor, or a sensor template, or an input_select? Why is it that the entity card can show the attribute current_position, but I cant get that in any other card, like cust button card – let alone actually use the value?

Keeping fingers crossed for some hallelujah answer!

I am using this card to animate the blinds. Maybe the code could help you