Rullaverhon ohjaus

  • Viestiketjun aloittaja Viestiketjun aloittaja refy
  • Aloituspäivämäärä Aloituspäivämäärä

refy

Kasvis
KK Plus pack
YAML:
alias: Blind follows lux (daylight only)
mode: restart

trigger:
  - platform: time_pattern
    minutes: "/10"

condition:
  - condition: sun
    after: sunrise
    before: sunset

action:
  - variables:
      lux: "{{ states('sensor.aqara_motion_and_light_sensor_p2_valaistusvoimakkuus') | float(0) }}"
      pos: "{{ (lux * 0.1) | round(0) }}"

  # move only if change >5%
  - condition: template
    value_template: >
      {% set current = state_attr('cover.matter_window_covering_1','current_position') | int(0) %}
      {% set new = pos | int %}
      {{ (current - new) | abs > 5 }}

  - service: cover.set_cover_position
    target:
      entity_id: cover.matter_window_covering_1
    data:
      position: >
        {% set p = pos | int %}
        {% if p < 1 %}
          1
        {% elif p > 99 %}
          99
        {% else %}
          {{ p }}
        {% endif %}
 
YAML:
alias: Blind follows lux (daylight only)
mode: restart

trigger:
  - platform: time_pattern
    minutes: "/10"

condition:
  - condition: sun
    after: sunrise
    before: sunset

action:
  - variables:

      # --- lux part ---
      lux: "{{ states('sensor.aqara_motion_and_light_sensor_p2_valaistusvoimakkuus') | float(0) }}"
      luxpos: "{{ lux * 0.1 }}"

      # --- UTC noon bias ---
      nowm: "{{ utcnow().hour * 60 + utcnow().minute }}"
      D: "{{ (nowm - 660) | abs }}"
      bias: "{{ 30 * (60 - D) / 60 }}"

      # combined position
      pos: "{{ (luxpos + bias) | round(0) }}"

  # move only if change >5%
  - condition: template
    value_template: >
      {% set current = state_attr('cover.matter_window_covering_1','current_position') | int(0) %}
      {% set new = pos | int %}
      {{ (current - new) | abs > 5 }}

  - service: cover.set_cover_position
    target:
      entity_id: cover.matter_window_covering_1
    data:
      position: >
        {% set p = pos | int %}
        {% if p < 1 %}
          1
        {% elif p > 99 %}
          99
        {% else %}
          {{ p }}
        {% endif %}
 

Luo tili tai kirjaudu sisään kommentoidaksesi

Sinun täytyy olla jäsen voidaksesi jättää kommentin.

Luo käyttäjätili

Liity Konekansalaiseksi. Se on helppoa ja ilmaista! Rekisteröityneenä et näe mainoksia, voit käyttää hakua, näet alueita, joita nyt ovat piilossa...jne.

Kirjaudu sisään

Oletko jo Konekansan jäsen? Kirjaudu sisään tästä.

Takaisin
Ylös