Notification when washing machine is done with KP115

I have a kasa kp115 power monitor plug connected to my washing machine and I am trying to setup notifications to my cell phone for when the washing machine is completed.

I have the plug discovered and setup in HA and have done some monitoring of it to get an idea of when the machine has completed washing clothes. I found out once it is below 3.8 or so watts, it is completed. Problem is, I am not getting notified when the washing machine is done.

Here is what I have setup:

My configuration checks out when I validate it and when I do a test push, my phone and IPAD receive the notification via the HA app.

Here is what I see in the logs:

WARNING (MainThread) [homeassistant.components.homeassistant.triggers.numeric_state] Error in ‘Washing Machine ends’ trigger: In ‘numeric_state’ condition: entity sensor.washing_machine_current_consumption state ‘W’ cannot be processed as a number

What can I do to fix this to work? Not sure if I am setting it up right as the plug seems to always pull up to 3.7 watts when not in use. I am new to this and have been trying to figure this out by online searching but I am having no success.

Thanks.

Remove this line:

   attribute: unit_of_measurement

By including that line, you instructed the Numeric State Trigger to monitor the value of the unit_of_measurement attribute.

I actually tried that at first and it still doesn’t work. I can’t recall the error message I get, but I can get it for you a little later.

I actually get the same error message as before.

The problem may be strings vs numbers. I set up a separate template binary sensor that converts the consumption to int (you will want to use float for 3.8):

    tp_link_115_in_use:
      device_class: power
      value_template: "{{ (states('sensor.tp_link_115_current_consumption') | int) > 10 }}"
      delay_on: 0:02:00
      delay_off: 0:02:00

Then the automation can use this new entity instead. Alternatively you could use value_template in your existing code, as documented here.

I have a similar one created with automations gui…works fine…the only thing I donot have is the period for the state.

alias: Notify when in use
description: ''
trigger:
  - platform: numeric_state
    entity_id: sensor.gosund_2_consumption
    above: '45'
condition: []
action:
  - service: notify.notify
    data:
      message: Audio On
      title: audio on
mode: single

The error message is indicating the value contains the letter W which is exactly what is present in the unit_of_measurement attribute for a sensor measuring power.

Are you using the Automation Editor to modify the automation?

If you are not, after modifying the automation with a text editor you must execute Configuration > Settings > Server Controls > Reload Automations.

The state value’s type for all entities is a string. At this point in time of Home Assistant’s evolution, only an entity’s attributes can have a value whose type can be something other than string (such as list, integer, float, boolean, etc).

The problem here is that the Numeric State Trigger was instructed to monitor an attribute that merely contains the letter W which (aside from being the wrong thing to monitor) cannot be converted to a numeric value (which is the error message’s complaint).