Quantcast
Channel: Configuration - Home Assistant Community
Viewing all articles
Browse latest Browse all 105808

Template cover - how to get position in set_cover_position

$
0
0

@InToSSH wrote:

Hello,
I am trying to set up a template cover to control a tilt of other cover entity (by ESPHome), but I cannot figure out how to get the position in set_cover_position action, I tried to do {{position}} as the doc stated, but I got no value.

cover:
  - platform: template
    covers:
      living_room_cover_tilt:
        friendly_name: "Living Room Cover Tilt"
        position_template: "{{ state_attr('cover.living_room_cover', 'current_tilt_position') | int }}"
        availability_template: "{% if is_state('cover.living_room_cover', 'unavailable') %} false {% else %} true {% endif %}"
        entity_id: cover.living_room_cover_tilt
        device_class: blind
        open_cover:
          service: cover.open_cover_tilt
          data:
            entity_id: cover.living_room_cover
        close_cover:
          service: cover.close_cover_tilt
          data:
            entity_id: cover.living_room_cover
        set_cover_position:
          service: cover.set_cover_tilt_position
          data:
            entity_id: cover.living_room_cover
            tilt_position: "{{position}}"
          

Using this I get an error: Failed to call service cover/set_cover_position. expected int for dictionary value @ data['tilt_position']

I even tried to use MQTT to listen to the topic to see the actual value, but there is none.

set_cover_position:
          service: mqtt.publish
          data:
            topic: /test/cover
            payload_template: "{{position}}"

Also tried {{position | int}} as I noticed the position is a float, but that didn’t help.

Also the position_template doesn’t work, I want it to sync with the current tilt position of the cover.living_room_cover.

Can anyone help please?

If you are wondering why I am doing it like this it’s because Google Assistant doesn’t support tilt setting, so I want to expose another entity for tilt.

Posts: 17

Participants: 3

Read full topic


Viewing all articles
Browse latest Browse all 105808

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>