Using power consumption to show information (status, elapsed time, count) of cycles on a dish washer

I’ve created a (binary)sensor that turns on when my powermeter detects a usage of more than 2 Watts for more that 2 minutes and turns off if it has been below 2 Watts after 6 minutes:
image

- platform: template
  sensors:
    washer_status:
      friendly_name: "Wasmachine"
      delay_on:
        minutes: 2
      delay_off:
        minutes: 6
      value_template: >-
#        {{ states('sensor_to_monitor')|float > value_before_trigger_on }}
        {{ states('sensor.zolder_wasmachine_energy_power') | float(0) > 2 }}

Because I also wanted to see the time it was running I’ve created another sensor that tells the time it has been running:

- platform: template
  sensors:
    wasmachine_looptijd:
      friendly_name: Looptijd wasmachine
      value_template: >
        {% set x = states('sensor.time') %}
        {% set t = 0 if states('binary_sensor.washer_status') == 'off' else now().timestamp() - states.binary_sensor.washer_status.last_changed.timestamp() %}
        {{ t | timestamp_custom('%H:%M', false) }}

To top it al of I’ve also made an automation that’ll inform me through my Nest speakers and telegram what device has been started/stopped:

alias: Melding - Apparatuur in-/uitgeschakeld
description: ''
trigger:
  - platform: state
    entity_id:
      - binary_sensor.washer_status
      - binary_sensor.dryer_status
      - binary_sensor.dishwasher_status
    id: Apparatuur in-/uitgeschakeld
condition: []
action:
  - service: tts.cloud_say
    data_template:
      entity_id: media_player.woonkamer
      message: >-
        De {{trigger.to_state.name}} is zojuist gestart of heeft zojuist zijn
        programma afgerond.
  - service: notify.telegram
    data:
      message: >-
        De {{trigger.to_state.name}} is zojuist gestart of heeft zojuist zijn
        programma afgerond.
mode: single

The last one is a work in progress because I would like it to say if a device has been started or stopped.

Since I’m going to pay top dollar for my electricity in a couple of weeks I’ve made an automation for my dishwasher, turning the dishwasher off and restarting it when I’m in the lower tarrifs. It’s a bit off-topic, but it might interest you. I’ve made the assumption that if I turn on the dishwasher before 6PM it was done on purpose.

alias: Schakeling - Vaatwasser
description: ''
trigger:
  - platform: numeric_state
    entity_id: sensor.keuken_vaatwasser_energy_power
    above: '60'
    id: Vaatwasser stroomverbruik
  - platform: time
    at: '23:10:00'
    id: Vaatwasser inschakelen
condition: []
action:
  - choose:
      - conditions:
          - condition: trigger
            id: Vaatwasser stroomverbruik
          - condition: time
            after: '18:30:00'
            before: '23:00:00'
        sequence:
          - type: turn_off
            device_id: XXXXXXXXXXXX
            entity_id: switch.keuken_vaatwasser
            domain: switch
          - service: media_player.volume_set
            data:
              volume_level: 0.6
            target:
              entity_id: media_player.woonkamer
          - service: tts.cloud_say
            data:
              entity_id: media_player.woonkamer
              message: >-
                De vaatwasser wordt nu uitgeschakeld en zal om tien over elf
                weer worden ingeschakeld.
      - conditions:
          - condition: trigger
            id: Vaatwasser inschakelen
        sequence:
          - type: turn_on
            device_id: XXXXXXXXXXXX
            entity_id: switch.keuken_vaatwasser
            domain: switch
    default: []
mode: single

I’ve used a powerplug from Moeshouse that was ESP8266-based (JH-G01E). Unfortunately their latest sockets come with Tuya hardware and can’t be flashed with Tasmota. It where nice plugs to measure power, switch off devices, etc.