Value cannot be processed as a number tp link sensor

Hi

I’m trying to get the current power of my tp link smart plug from my dishwasher to check if it goed below a certain power usage (and turn it off then). I’m getting the error with the state that the value cannot be processed as a number. When I try to put it in the template editor, the correct value is displayed (0.00, cause it’s off right now). I’ve searched around a bit here and tried to modify a few things, but none was working. Here’s my code I have right now:

sensor:
  - platform: template
    sensors:
      dishwasher_power:
        value_template: '{{ states.switch.dishwasher.attributes["current_power_w"] | float }}'
        unit_of_measurement: 'W'

That means nothing as “million” | float == 0.0 is true
I don’t think your entity attribute statement is correct

Try this:

value_template: "{{ state_attr('switch.dishwasher', 'current_power_w') | float }}"

First it gives me the error that ‘sensor’ is not a valid option for tplink, and after a few moments, the same error (cannot be processed…):

Where exactly did you put this:

sensor:
  - platform: template
    sensors:
      dishwasher_power:
        value_template: "{{ state_attr('switch.dishwasher', 'current_power_w') | float }}"
        unit_of_measurement: 'W'

What is above it?

Above it are alle my tp link switches:

Hope that’s correct?

sensor: should not be indented below tplink. It should be hard up against the margin and there should only be one sensor: in your configuration.yaml file.

Template sensors are not options for the tplink integration. They are an integration in their own right.

1 Like

Ok, that was it. Sorry for the mistake (I’m only a beginner :upside_down_face: :wink:) and thanks for the help.

1 Like

Please don’t post pictures.
If you insert preformatted text (As Tom did) this is much smaller and we can read it, fault find and cut and paste it into our template editors. Please read the sticky at the top of the forum (by Tinkerer)

1 Like

You shouldn’t have to apologize. This documentation clearly states “In order to get the power consumption readings from a TP-Link HS110 device, you’ll have to create a template sensor.”

1 Like