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

Problem with setting up automation for cover

$
0
0

@RalfP wrote:

Hi folks,

next question from my side. Learning, learning, learning…

I have an enocean switch (Eltako FT55) and a qubino roller shutter.
With the example from the documentation https://www.home-assistant.io/integrations/enocean/ I came up with this one, working fine.

- id: '1575468037003'
  alias: cover living room
  description: ''
  trigger:
  - event_data:
      id: [254, 242, 255, 31]
    event_type: button_pressed
    platform: event
  condition: []
  action:
  - alias: ''
    data:
      entity_id: cover.qubino_goap_zmnhcdx_flush_shutter_switch
    service_template: "{% if trigger.event.data.onoff %} cover.close_cover {% else %} cover.open_cover {% endif %}"

Now I want to use the reading of the qubino for power consumption and, if the motor is moving, stop the motion when a button is pressed.

Look at this.

- id: '1575468037003'
  alias: cover living room
  description: ''
  trigger:
  - event_data:
      id: [254, 242, 255, 31]
      pushed: 1
    event_type: button_pressed
    platform: event
  condition: []
  action:
  - alias: ''
    data:
      entity_id: cover.qubino_goap_zmnhcdx_flush_shutter_switch
    service_template: >-
      "{% if ((trigger.event.data.onoff) and ((state_attr('cover.qubino_goap_zmnhcdx_flush_shutter_level', 'power_consumption') | float) > 0)) %} cover.stop_cover 
      {% elif ((trigger.event.data.onoff) and ((state_attr('cover.qubino_goap_zmnhcdx_flush_shutter_level', 'power_consumption') | float) == 0)) %} cover.close_cover 
      {% elif (!(trigger.event.data.onoff) and ((state_attr('cover.qubino_goap_zmnhcdx_flush_shutter_level', 'power_consumption') | float) > 0)) %} cover.stop_cover 
      {% elif (!(trigger.event.data.onoff) and ((state_attr('cover.qubino_goap_zmnhcdx_flush_shutter_level', 'power_consumption') | float) == 0)) %} cover.open_cover 
      {% endif %}"

When doing this I get so many errors when checking the config I can’t even go back to the first line to see what is the first error.

I’ve also tried with is_state_attr but also too many errors.

I know for sure, one of you will look at it, spot it and then I can just hit my head for being blind but I’m trying now for several days with this.

Help or even a small hint is highly appreciated :slight_smile:
Thanks upfront
Ralf

Posts: 2

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 95563

Trending Articles