Devices with no power status/attribute

Hi

I have a lot of devices that don’t have a build in power meter.
They are just ‘on’ or ‘off’ nothing else is known about them.
But I do know how much they consume (just read what is printed on the light (eg 15w), gives a good indication).

So I want to create entities that have exactly this amount of power for each light, but when the light is off, the entity shows 0, when it’s on, it shows 15w.

A good start I think would be a naming convention.
The light is called light.livingroom
So the sensor should probably called sensor.light_livingroom_power

Any ideas how to do this ?

You could try to create a template sensor that shows 15 if the light is on and 0 if the light is off and add the unit_of_measurement: 'W' and device_class: power.

Hi @Burningstone

Something like this ?

- platform: template
  sensors:
    light_qbus_v0_bureel_boekenkast_power:
      value_template: >
        {% if is_state('light.qbus_v0_bureel_boekenkast', 'on') %}   10   {% else %}   0   {% endif %}

I can confirm this is working.

I adapted the above value_template for lights that are actually dimmers. In this example I use a dimmable lightbulb that, at full power, uses 15w, and assuming dimming to 33% will effectively consume 5w. This will probably not be exact, but it is the closed I can come to the truth, considering I don’t have a power meter for each light.

- platform: template
  sensors:
    light_qbus_v1_slaapkamer_kato_centraal_dimmer_power:
      value_template: >
        {% if is_state('light.qbus_v1_slaapkamer_kato_centraal_dimmer', 'on') %}
        {{(states.light.qbus_v1_slaapkamer_kato_centraal_dimmer.attributes.brightness * 15 / 255)|float|round(0)}}
        {% else %}   0   {% endif %}

I hope this is useful for others…

1 Like