Homematic show cover-level as a badge

Hey there,

i´m trying to show the actual level of a shutter-device as a badge by using the template_sensor.

The badge appears - but there is no value in it. How can i get the information in which attribute the acutal Level is stored?

Here my code:

sensor:
  - platform: template
    sensors:
      solar_angle:
        value_template: '{{ states.cover.KEQ0879052.attributes.current_position }}'
       
        friendly_name: 'Wohnzimmer'

The code you have provided looks correct. Using the same template in the HASS UI (that template testing thing) works for me an shows the current position. If that doesn’t work for you as well, my first thought would be, that you have enabled resolving of device names, for which the example in the documentation isn’t accurate. In that case you would need to use the entity ID to which the name got resolved instead of the raw device ID.

Hey Daniel,

thanks for replying. I did a reboot and now it works - thank you.

No, i did not activate the resolving feature, the reboot did the trick. But one question is still open:

Is there a chance of getting out which attributes an entity has and what would be the best: what actual value it has?

Why i´m asking that is, that i´m migration from openhab. In OH every items has channels (like enitities and attributes in HASS). The channel for the actual level is imho called level in openhab and actual_position in HASS.

So, i´m looking for a away to get out, how are the attributes are called in HASS.

Greetings
Dominic

Internally these channels are also present in HASS. But exposing everything as separate entities seemed to be the more userfriendly solution. But for some devices with a lot of channels (switches etc.) you still get the entity with the channel number appended to the name. :wink:

To see which attributes are available you can use this template: {{ states.cover.KEQ0879052.attributes }}
Again, this can be explored best by using the template editor in the HASS UI. Changes to the template are directly visible. More information about that topic can be found in the State Objects documentation.

thanks again - this works great.

One last question in this context: In openhab there was the possibility to map values. For example a closed shutter has the value 0 and I want to display “zu” instead of 0. could this be done with HASS?

Assumes every value bigger than 0 is “offen”

{% if(states.cover.KEQ0879052.attributes.current_position > 0) %} offen {% else %} zu {% endif %}

or the other way round

{% if(states.cover.KEQ0879052.attributes.current_position == 0) %} zu {% else %} offen {% endif %}