Problem mit Automation - Schaltung nach Zeit und Stromvertrach

Hello,

I need your help again.
I have a switch socket that also measures the power consumption.
This should:

  • Automatically switch on every Sunday to Thursday at 8 p.m
  • after 2 hours it should switch off again if the power consumption is below 30 watts
  • if the power consumption is not below 30 watts, you should wait after the 2 hours until the power consumption falls below 30 watts and then switch off (timeout 2 hours).

Now my problems:

  • Although the power consumption can be retrieved under the end entity “socket_tv_bedroom_kg_mit_strommessung_ss00_tz3000_ksw8qtmt_ts011f_electrical_measurement”, I get the following error message when saving the automation: “Message malformed: Entity steckdose_tv_bedroom_kg_mit_strommessung_ss00_tz3000_ksw8qtmt_ts011f_tz3000_ksw8qtmt_ts011f_electrical_measurement_entity is neither valid[action] a valid value’ entity ID @electrical[action] UI_measurement is neither a valid value nor a UU dictionary 0][‘choose’][0][‘sequence’][2][‘if’][0][‘entity_id’]”

  • I’m not sure if I set up the automation correctly.

Here the automation:

alias: Schlafzimmer TV Steckdose
description: ""
trigger:
 - platform: time
   at: "20:00:00"
   id: Woche an
condition: []
action:
 - choose:
     - conditions:
         - condition: trigger
           id: Woche an
         - condition: time
           weekday:
             - mon
             - tue
             - wed
             - thu
             - sun
       sequence:
         - type: turn_on
           device_id: e8abc2608ea338e78c76b0858d25be2f
           entity_id: >-
             switch.steckdose_tv_schlafzimmer_kg_mit_strommessung_ss00_tz3000_ksw8qtmt_ts011f_on_off
           domain: switch
         - delay:
             hours: 2
             minutes: 0
             seconds: 0
             milliseconds: 0
         - if:
             - condition: numeric_state
               entity_id: >-
                 steckdose_tv_schlafzimmer_kg_mit_strommessung_ss00_tz3000_ksw8qtmt_ts011f_electrical_measurement
               below: 30
           then:
             - type: turn_off
               device_id: e8abc2608ea338e78c76b0858d25be2f
               entity_id: >-
                 switch.steckdose_tv_schlafzimmer_kg_mit_strommessung_ss00_tz3000_ksw8qtmt_ts011f_on_off
               domain: switch
           else:
             - wait_for_trigger:
                 - platform: numeric_state
                   entity_id: >-
                     steckdose_tv_schlafzimmer_kg_mit_strommessung_ss00_tz3000_ksw8qtmt_ts011f_electrical_measurement
                   for:
                     hours: 0
                     minutes: 2
                     seconds: 0
                   below: 30
               timeout:
                 hours: 2
                 minutes: 0
                 seconds: 0
                 milliseconds: 0
             - type: turn_off
               device_id: e8abc2608ea338e78c76b0858d25be2f
               entity_id: >-
                 switch.steckdose_tv_schlafzimmer_kg_mit_strommessung_ss00_tz3000_ksw8qtmt_ts011f_on_off
               domain: switch
mode: single

I’m grateful for any help.

Kind regards, Werner

Hi Werner,

not sure if this will solve your problem, but check the entity_id in your if and else condition. They do not have a domain.

steckdose_tv_schlafzimmer_kg_mit_strommessung_ss00_tz3000_ksw8qtmt_ts011f_electrical_measurement

Should be something like:

sensor.steckdose_tv_schlafzimmer_kg_mit_strommessung_ss00_tz3000_ksw8qtmt_ts011f_electrical_measurement
1 Like

So, basically you want to turn it off, if power consumption is below 30W, but not before 22:00?

Split it into two automations:

  1. turn on at Sunday, 20:00
  2. turn off at Sunday, triggered by:
    a) time is 22:00:01 or
    b) power falls below 30W
    with condition that current time has to be after 22:00:00 and power is below 30W
1 Like

Great, the error message has definitely disappeared. Thanks.

Good idea. Thanks. Will create two triggers and try it like this. I want as few automations as possible.