Tageszeitabhängigkeit einer automatisierung

folgende automatisierung funktioniert bereits,

id: 'xxxxxxxxxxxxxxxxxx'
alias: >-
  wenn SolarInputPower für 5 minuten > 650 und ElectricLevel > 80 schalte
  Ladestation ein
description: ''
trigger:
  - type: power
    platform: device
    device_id: 64c5c7821a7a0d157370b23f081ddb4f
    entity_id: 48ae62e97630b5415dd35641650860f8
    domain: sensor
    above: 650
    for:
      hours: 0
      minutes: 5
      seconds: 0
condition:
  - condition: numeric_state
    entity_id: sensor.electriclevel
    above: 80
action:
  - service: switch.turn_on
    target:
      device_id:
        - 1df8755e4ea63f32088176e3226b2d66
    data: {}
    enabled: true
  - service: notify.mobile_app_max_3
    data:
      message: wallbox EIN
mode: single

ich würde es gerne um tages-zeitabhängigkeit ergänzen im sinne von:

um 10°° reichen 40% speicher
um 12°° reichen 60%
um 16°° müssen es aber schon 90% sein

ist es ein “oder” oder ein “und”? oder noch was anderes? mit den zeiten schwimme ich noch :slight_smile:

Du darfst keine Feste Zeiten definieren, sonder Zeiträume.

Z.B.

  • vor 12Uhr → 40%
  • nach 12 Uhr und vor 16 Uhr → 60%
  • nach 16 Uhr → 90%

Den Sensor sensor.power_xyz sowie den Switch switch.wallbox musst Du noch gegen Deinen Entitäten austauschen.

description: ""
mode: single
trigger:
  - platform: numeric_state
    entity_id:
      - sensor.power_xyz
    for:
      hours: 0
      minutes: 5
      seconds: 0
    above: 650
condition: []
action:
  - choose:
      - conditions:
          - condition: time
            before: "12:00:00"
          - condition: numeric_state
            entity_id: sensor.electriclevel
            above: 40
          - condition: state
            entity_id: switch.wallbox
            state: "off"
        sequence:
          - service: switch.turn_on
            metadata: {}
            data: {}
            target:
              entity_id: switch.wallbox
          - service: notify.mobile_app_max_3
            metadata: {}
            data:
              message: wallbox EIN
      - conditions:
          - condition: time
            after: "12:00:00"
            before: "16:00:00"
          - condition: numeric_state
            entity_id: sensor.electriclevel
            above: 60
          - condition: state
            entity_id: switch.wallbox
            state: "off"
        sequence:
          - service: switch.turn_on
            metadata: {}
            data: {}
            target:
              entity_id: switch.wallbox
          - service: notify.mobile_app_max_3
            metadata: {}
            data:
              message: wallbox EIN
      - conditions:
          - condition: time
            after: "16:00:00"
          - condition: numeric_state
            entity_id: sensor.electriclevel
            above: 90
          - condition: state
            entity_id: switch.wallbox
            state: "off"
        sequence:
          - service: switch.turn_on
            metadata: {}
            data: {}
            target:
              entity_id: switch.wallbox
          - service: notify.mobile_app_max_3
            metadata: {}
            data:
              message: wallbox EIN

Gruß
Osorkon

danke, werde ich testen…

Bei dem zweiten mal dran schauen, muss ich fest stellen, dass es nur bedingt funktioniert. Und zwar wenn der Power Sensor über 650 beträgt und darüber bleibt aber die Bedingung der Batterie nicht zutrifft. Dann wird die Wallbox nie eingeschaltet. Hier fehlen noch 3 Trigger und einen zusätzliche Bedingung.

description: ""
mode: single
trigger:
  - platform: numeric_state
    entity_id:
      - sensor.power_xyz
    for:
      hours: 0
      minutes: 5
      seconds: 0
    above: 650
  - platform: numeric_state
    entity_id:
      - sensor.electriclevel
    above: 40
  - platform: numeric_state
    entity_id:
      - sensor.electriclevel
    above: 60
  - platform: numeric_state
    entity_id:
      - sensor.electriclevel
    above: 90
condition: []
action:
  - choose:
      - conditions:
          - condition: time
            before: "12:00:00"
          - condition: numeric_state
            entity_id: sensor.electriclevel
            above: 40
          - condition: state
            entity_id: switch.wallbox
            state: "off"
          - condition: numeric_state
            entity_id: sensor.power_xyz
            above: 650
        sequence:
          - service: switch.turn_on
            metadata: {}
            data: {}
            target:
              entity_id: switch.wallbox
          - service: notify.mobile_app_max_3
            metadata: {}
            data:
              message: wallbox EIN
      - conditions:
          - condition: time
            after: "12:00:00"
            before: "16:00:00"
          - condition: numeric_state
            entity_id: sensor.electriclevel
            above: 60
          - condition: state
            entity_id: switch.wallbox
            state: "off"
          - condition: numeric_state
            entity_id: sensor.power_xyz
            above: 650
        sequence:
          - service: switch.turn_on
            metadata: {}
            data: {}
            target:
              entity_id: switch.wallbox
          - service: notify.mobile_app_max_3
            metadata: {}
            data:
              message: wallbox EIN
      - conditions:
          - condition: time
            after: "16:00:00"
          - condition: numeric_state
            entity_id: sensor.electriclevel
            above: 90
          - condition: state
            entity_id: switch.wallbox
            state: "off"
          - condition: numeric_state
            entity_id: sensor.power_xyz
            above: 650
        sequence:
          - service: switch.turn_on
            metadata: {}
            data: {}
            target:
              entity_id: switch.wallbox
          - service: notify.mobile_app_max_3
            metadata: {}
            data:
              message: wallbox EIN

Gruß
Osorkon

Danke erstmal. ich schraube hier an irgendwas wovon ich so gut wie nichts verstehe, deshalb verstehe ich auch die Fehlermeldung nicht:

Automatisierung ist nicht verfügbar / Auslöser: extra keys not allowed @ data[‘condition’]

alias: einschalten mit tageszeiten
description: ""
mode: single
trigger:
  - platform: numeric_state
    entity_id:
      - sensor.electriclevel
    for:
      hours: 0
      minutes: 5
      seconds: 0
    above: 650
  - platform: numeric_state
    entity_id:
      - sensor.electriclevel
    above: 40
  - platform: numeric_state
    entity_id:
      - sensor.electriclevel
    above: 60
  - platform: numeric_state
    entity_id:
      - sensor.electriclevel
    above: 90
    condition: []
    action: null
choose:
  - conditions:
      - condition: time
        before: "12:00:00"
      - condition: numeric_state
        entity_id: sensor.electriclevel
        above: 40
      - condition: state
        entity_id: switch.ladestation_schalter
        state: "off"
      - condition: numeric_state
        entity_id: sensor.solarinputpower
        above: 650
    sequence:
      - service: switch.turn_on
        metadata: {}
        data: {}
        target:
          entity_id: switch.ladestation_schalter
      - service: notify.mobile_app_max_3
        metadata: {}
        data:
          message: wallbox EIN
  - conditions:
      - condition: time
        after: "12:00:00"
        before: "16:00:00"
      - condition: numeric_state
        entity_id: sensor.electriclevel
        above: 60
      - condition: state
        entity_id: switch.ladestation_schalter
        state: "off"
      - condition: numeric_state
        entity_id: sensor.solarinputpower
        above: 650
    sequence:
      - service: switch.turn_on
        metadata: {}
        data: {}
        target:
          entity_id: switch.ladestation_schalter
      - service: notify.mobile_app_max_3
        metadata: {}
        data:
          message: wallbox EIN
  - conditions:
      - condition: time
        after: "16:00:00"
      - condition: numeric_state
        entity_id: sensor.electriclevel
        above: 90
      - condition: state
        entity_id: switch.ladestation_schalter
        state: "off"
      - condition: numeric_state
        entity_id: sensor.solarinputpower
        above: 650
    sequence:
      - service: switch.turn_on
        metadata: {}
        data: {}
        target:
          entity_id: switch.ladestation_schalter
      - service: notify.mobile_app_max_3
        metadata: {}
        data:
          message: wallbox EIN

:crayon:by HarryP: Fettdruck entfernt

Mein Tipp, nutze ChatGPT, vergleiche vorher/nachher und probiere. Das senkt auch auf neuem Gebiet die erste Hürde. Ich bat einfach Deine Automatisation zu überprüfen und er hat ein paar Korrekturen vorgenommen

alias: einschalten mit tageszeiten
description: ""
mode: single
trigger:
  - platform: numeric_state
    entity_id: sensor.electriclevel
    for:
      hours: 0
      minutes: 5
      seconds: 0
    above: 650
  - platform: numeric_state
    entity_id: sensor.electriclevel
    above: 40
  - platform: numeric_state
    entity_id: sensor.electriclevel
    above: 60
  - platform: numeric_state
    entity_id: sensor.electriclevel
    above: 90
condition: []  # Diese Zeile wurde entfernt, da sie überflüssig ist
action:
  - choose:
      - conditions:
          - condition: time
            before: "12:00:00"
          - condition: numeric_state
            entity_id: sensor.electriclevel
            above: 40
          - condition: state
            entity_id: switch.ladestation_schalter
            state: "off"
          - condition: numeric_state
            entity_id: sensor.solarinputpower
            above: 650
        sequence:
          - service: switch.turn_on
            target:
              entity_id: switch.ladestation_schalter
          - service: notify.mobile_app_max_3
            data:
              message: wallbox EIN
      - conditions:
          - condition: time
            after: "12:00:00"
            before: "16:00:00"
          - condition: numeric_state
            entity_id: sensor.electriclevel
            above: 60
          - condition: state
            entity_id: switch.ladestation_schalter
            state: "off"
          - condition: numeric_state
            entity_id: sensor.solarinputpower
            above: 650
        sequence:
          - service: switch.turn_on
            target:
              entity_id: switch.ladestation_schalter
          - service: notify.mobile_app_max_3
            data:
              message: wallbox EIN
      - conditions:
          - condition: time
            after: "16:00:00"
          - condition: numeric_state
            entity_id: sensor.electriclevel
            above: 90
          - condition: state
            entity_id: switch.ladestation_schalter
            state: "off"
          - condition: numeric_state
            entity_id: sensor.solarinputpower
            above: 650
        sequence:
          - service: switch.turn_on
            target:
              entity_id: switch.ladestation_schalter
          - service: notify.mobile_app_max_3
            data:
              message: wallbox EIN

Sowas wie “action: null” weist z.B. auf Fehler.

Viel Spaß und gutes Gelingen.

das mit chatGPT hat tasächlich funktioniert. Es hat mehrere nachfragen gebraucht, aber die automatisierung läuft jetzt erstmal. Bin erstaunt was man damit machen kann!!!

1 „Gefällt mir“