Powercalc - Virtual power sensors

I’m considering contributing measurements for a few Lifx bulb types, even after reading this :slight_smile:

Depending on the selected color mode and sleep settings this will take a while. Somewhere from a few hours to 2 days.

Couple of questions:

  1. Will a Shelly 1PM be suitable as a measurement device?
  2. Some of these bulb types have a switchable IR security light. I’m guessing the script does not have the facility to test this?

That’s awesome!

  1. Will a Shelly 1PM be suitable as a measurement device?

Sure. In fact, all the latest added Ikea lights were measured with this exact device. And measurements look really good.

  1. Some of these bulb types have a switchable IR security light. I’m guessing the script does not have the facility to test this?

The script will first turn of the light completely to measure the standby power. So this will also account for the IR sensor actively listening. Or am I misunderstanding?

At night the standby power will be different than during the day as the IR LEDs will be on.

hmm ok I understand. That is not something which is implemented in powercalc (yet). I this information known to HA somehow? That the IR is on or off?

It can be set by a specific Lifx service (not a light service):

  - service: lifx.set_state
    entity_id: light.lifx_deck_spot
    data:
      infrared: < 0 to 255 here >

https://www.home-assistant.io/integrations/lifx/#service-lifxset_state

There is no attribute to read the set value and I am not sure which if any of the supported_feature bits it corresponds to.

I’m starting to think it is beyond scope of the measurement script.

Yes this is a very difficult one. Not only measure script would need to be extended to facilitate this, but the most difficult part is the integration itself.

When the standby power needs to have a different value at night the component must have a way to configure multiple standby values and a timesheet or something like that. But that would only work when it are fixed times. Or we need a way to read the infrared state and base standby power on that, but that’s not available as you indicated.

This would get rather complex and errorprone so I suggest to keep things simple.
Maybe we could somehow calculate the average standby power (for example 8 hours IR on, 16 hour IR off). And use that value as the standby power.
And are you able to measure the light with IR on and off? Maybe the power draw is negligible.

I really am beginning to think it is beyond scope as there is no way to determine if the IR is on or off.

Yes seems there is no way to get the actual infrared state. Also checked the Lifx API docs. Maybe the IR sensor power consumption is negligible, so we could just ignore it. Than it will still be nice to have this LIFX lights in the library.
battery based PIR sensors work a really long time on a single battery (for a year or maybe longer), so I think the energy consumption could be very low.

Happy New Year everyone!
Hi Bram,
is Echo somehow a reserved string? I trying to set up my Echos with Daily Fixed Energy.
Every time I use Echo as a prefix in their names, the sensors are not generated.

- platform: powercalc
  name: EchoSleep
  daily_fixed_energy:
    value: 3.5
    unit_of_measurement: W

No entry in the debug log about that.

Also happy new year to you, and best wishes to everyone!

I have tried with your configuration in my development instance, but it’s working fine for me.
Not sure why it doesn’t work on your HA.
Do you already have a sensor with the same name EchoSleep?

2022-01-02 12:52:11 DEBUG (MainThread) [custom_components.powercalc.sensors.utility_meter] Creating utility_meter sensor: EchoSleep daily
2022-01-02 12:52:11 DEBUG (MainThread) [custom_components.powercalc.sensors.utility_meter] Creating utility_meter sensor: EchoSleep weekly
2022-01-02 12:52:11 DEBUG (MainThread) [custom_components.powercalc.sensors.utility_meter] Creating utility_meter sensor: EchoSleep monthly
2022-01-02 12:52:11 DEBUG (MainThread) [custom_components.powercalc.sensors.energy] sensor.echosleep: Restoring state: 0

Nope. But your question had me checked in Developer Tools → Statistics and it showed that the sensors were created. But the reason why I couldn’t add it to the Energy Dashboard was because I had excluded sensor.echo* from being recorded in the past (don’t know when and why - I can’t remember it).
Sorry to bother you.

Np, glad you found the cause and got it resolved.

Can this do propane consumption on a heating system? That would be a cool use case since a non modulating heater should be a fixed BTU per hour.

Hi, this is not possible and I don’t think I will implement this.
The complete integration is modelled with power in mind. The sensors which powercalc creates have W and kWh units of measurements. Also all internals are named to be power and configuration options as well.

After installing the component, I expected some power and energy sensors to pop up, but I don’t see any. There are a bunch of compatible hue lamps which should be discoverable.
I enabled debug logging, but there are no errors.
I tried 0.13.4 and the latest beta, but with no luck. Any suggestions?

You need to restart home assistent after installing.

Hi Bram,
Thank you for the quick response and awesome work you have done.

I restarted Home Assistant several times, but the sensors did not show up.
When I enabled auto discovery through configuration.yaml, the sensors appeared.

# Power Calc
powercalc:
  enable_autodiscovery: true
  scan_interval: 00:01:00 #Each minute
  create_energy_sensors: true

Before I added this, the configuration only mentioned that the component was loaded in the logs. Now, it shows the sensors it discovered and the state changes.
Could it be that I needed to be more patient and wait 10 minutes before discovery kicked in?

enable_autodiscovery was set to false by default in current and previous powercalc versions. Will be set to true by default in future versions. So that’s why the sensors did not appear.
Is enabled in v0.14.0-beta.1.

Could this be good for this use case?


- platform: powercalc
  name: Conso fan
  entity_id: fan.fan
  fixed:
    states_power:
      off: 1
      33: 14
      67: 18
      100: 30

With such a device:
image

I want to use percentage to get W/h
But also using state on/off as it can be off with 67%.

Pretty sure it won’t work but can’t find the good way :frowning:

Have a look at linear mode with calibration. That will do exactly what you want. For fans it will look at percentage automatically.