Value cannot be processed as a number - Broadlink SP3

I think this issue started since 0.88 version.
The Broadlink SP3 socket, which I use to check if the bedroom TV is on, started to act weirdly. It is working, because I can see the watt usage, I just don’t like the logs being full with this message. :smiley:

2019-02-26 12:12:18 WARNING (MainThread) [homeassistant.helpers.condition] Value cannot be processed as a number: <state sensor.bedroom_tv_load=; friendly_name=bedroom_tv_load, hidden=True @ 2019-02-26T12:12:18.150749+01:00> (Offending entity: )

Tried this solution, but it’s not working.

The sensor I’ve created for it is.

  bedroom_tv_load:
    value_template: "{{ states.switch.bedroom_tv_socket.attributes.current_power_w }}"

What does the states page show when you look at the attribute current_power_w’s result?

it works as intended. displayes watt usage.

Sorry, I should have been more clear.

What does the attribute current_power_w look like in the states page for the switch.bedroom_tv_socket entity?

you mean this?

Yeah, hmm. I’m not sure why you are getting that error. But your TV load does not match what the switch is saying. I was hoping to see that it contained units, but that doesn’t seem to be the issue. Is that 0.24 value the current load with the TV on?

the value is valid, it’s not on right now. When it’s on, the value changes, and it’s a valid change again. So no problem with the value, that’s what I was saying. It is working, automation depending on it runs with no problem.
The only problem is that HA has lots of warning in the log. :slight_smile:

Yes, and something that would spark that warning would be characters that doesn’t allow it to convert the value into a number. I understand your problem, just trying to see where the error could be coming from.

So, give this a whirl

  bedroom_tv_load:
    value_template: >
      {% set s =  state_attr('switch.bedroom_tv_socket', 'current_power_w') %}
      {{ s | float if s else 0.0 }}

Basically asserts that it needs a number otherwise it returns zero.

giving it a try.
thx

it does seem to be working.
thx dude! :slight_smile:

no problem. It seems like your device must have been momentarily disconnecting or returning bad values.