Need help with automation socket [solved]

Hello all,

[solved]
didn’t realize that the trigger wait until is executed after the period time if the button switch is on.
i was in the consumption that the wait until was executed AFTER a defined timeframe.
the solution was:
2 triggers wait until. one if the state of the sensor is above 0 followed by a wait until the sensor is back to zero. Dont know if its propper coding but it works for me.

I am strugeling with an automation.
I have an Aubess socket switch where a boiler is pluged into.
what i want is: with an counter helper count day’s and on a certain amount off days that has passed the switch should turn on. If the boiler has its temperature then the sensor from the Aubess switch returns to zero and on that point the switch should be turned off. The problem is the switch sensor for Watt is verry slow and is an sensor.

in my yaml file i created a template sensor int: cause all other tries didn’t work
boiler_keuken_watt:
friendly_name: “boiler watt keuken”
value_template: >-
{{ states(‘sensor.aubess_smart_socket_20a_em_power’)| int }}

i got two automations: one for general if the switch is turned on and one if the helper counter is 4

automation 1:

description: “”
trigger:

  • platform: time
    at: “16:00:00”
    condition: []
    action:
  • service: input_number.increment
    data: {}
    target:
    entity_id: input_number.legionella_teller
  • if:
    • condition: numeric_state
      entity_id: input_number.legionella_teller
      above: 3
      then:
    • service: switch.turn_on
      data: {}
      target:
      entity_id: switch.aubess_smart_socket_20a_em_socket_1
    • service: input_number.set_value
      data:
      value: 0
      target:
      entity_id: input_number.legionella_teller
      mode: single

and this triggers the switch to turn on. As stated, its a bit slow on giving the sensor that gives the Watt consumption. to overcome this issue i delay with 1:30 minutes and trigger if for a given time (40 secs) the switch produces zero Watt.

trigger:

  • platform: device
    type: turned_on
    device_id: feb4ef29e71052163a80c140dd39b51e
    entity_id: switch.aubess_smart_socket_20a_em_socket_1
    domain: switch
    condition: []
    action:
  • wait_for_trigger:
    • platform: numeric_state
      entity_id: sensor.boiler_keuken_watt
      for:
      hours: 0
      minutes: 0
      seconds: 40
      below: 10
      timeout:
      hours: 0
      minutes: 1
      seconds: 30
      milliseconds: 0
  • type: turn_off
    device_id: feb4ef29e71052163a80c140dd39b51e
    entity_id: switch.aubess_smart_socket_20a_em_socket_1
    domain: switch
    mode: single

What am i doing wrong. I tried numeric_state but that did not work also.
Someone care to help me