Powercalc - Virtual power sensors

Update, I already did some work on this few days ago and got it working. See Add possibility to use daily fixed energy sensor in a group by bramstroker · Pull Request #503 · bramstroker/homeassistant-powercalc · GitHub. Will need to do some final testing before this can be merged and released.

This development will allow you to do:

- platform: powercalc
  create_group: "My group"
  entities:
    - entity_id: light.kitchen
    - name: nestmini
      daily_fixed_energy:
        value: 0.5

Hi all,
how can I reset values from “powercalc”?

I assume you want to reset the energy sensors (kWh) right? I think the only way to do this is by some delete queries in the DB, statistics table.
Have a look here: How to delete old Energy Data.

I am trying to set up an IKEA light bulb in a group but for some reason the power and energy sensors are not being created. Here is the YAML I am using:

platform: powercalc
create_group: Powercalc All Lights
entities:
  - entity_id: light.kitchen_ceiling_1
  - entity_id: light.kitchen_ceiling_2
  - entity_id: light.kitchen_ceiling_3
  - entity_id: light.bathroom_ceiling_1
  - entity_id: light.bathroom_ceiling_2
  - entity_id: light.living_room_ceiling_1
  - entity_id: light.living_room_ceiling_2
  - entity_id: light.living_room_ceiling_3
  - entity_id: light.dining_table
  - entity_id: light.lounge_table 
  - entity_id: light.bedroom_bedside_glyn
  - entity_id: light.bedroom_bedside_deb
  - entity_id: light.outside_back_garage_wall_left
    manufacturer: signify
    model: LTG002
  - entity_id: light.outside_back_garage_wall_right
    manufacturer: signify
    model: LTG002
  - entity_id: light.outside_front_garage_wall_left
  - entity_id: light.outside_front_garage_wall_right
  - entity_id: light.outside_front_door
    fixed:
      power: 9.5

light.outside_front_door is the entity in question.

The funny thin is if I put the code for the specific entity into a seperate sensor definition the energy and power sensors get created correctly.

platform: powercalc
entities:
  - entity_id: light.outside_front_door
    fixed:
      power: 9.5

The only problem is that they are now not in the same group as the others.

Could you please check the logs for errors? And create an issue on github when you still experience problems?

Habe tried that and no errors found in the logs. I have re created the yaml and reordered some of the entities and it now seems to be working!

platform: powercalc
create_group: Powercalc All Lights
entities:
  - entity_id: light.kitchen_ceiling_1
  - entity_id: light.kitchen_ceiling_2
  - entity_id: light.kitchen_ceiling_3
  - entity_id: light.bathroom_ceiling_1
  - entity_id: light.bathroom_ceiling_2
  - entity_id: light.living_room_ceiling_1
  - entity_id: light.living_room_ceiling_2
  - entity_id: light.living_room_ceiling_3
  - entity_id: light.dining_table
  - entity_id: light.lounge_table 
  - entity_id: light.bedroom_bedside_glyn
  - entity_id: light.bedroom_bedside_deb
  - entity_id: light.outside_back_garage_wall_left
    manufacturer: signify
    model: LTG002
  - entity_id: light.outside_back_garage_wall_right
    manufacturer: signify
    model: LTG002
  - entity_id: light.outside_front_garage_wall_left
  - entity_id: light.outside_front_garage_wall_right
  - entity_id: switch.garage_light_front
    fixed:
      power: 100
  - entity_id: switch.garage_light_back
    fixed:
      power: 100
  - entity_id: light.outside_front_door
    manufacturer: ikea
    model: LED1732G11 # Closest Match   
  - entity_id: light.lounge_floor
    manufacturer: ikea
    model: LED1732G11 # Closest Match   
  - entity_id: light.outside_back_deck_wall
    manufacturer: ikea
    model: LED1732G11 # Closest Match   ```

Hi,

Trying to get a power sensor from a Climate device using

fixed:
    states_power: 

However I’m not sure which states are valid for the device and from what I can find it’s the HVAC Action state I need to monitor for calculation of power used, some guidance is much appreciated.

Best Regards

You can have a look in the “Developer tools” section.

Search for the climate entity in question and have a look in the states and attributes columns.

In my case the current state is cool. The possible hvac modes are listed in the attributes in my situation hvac_modes

Thank you for the feedback.
I got it working however as the entry in question i always in Heat mode the calculation is not correct.

I belive this is detailed in the release notes for 0.96
(0.96: Notion, updated sidebar, advanced mode - Home Assistant)

As far as I can tell it’s the HVAC_Action I’m interested in an that will give me the correct calculation

“hvac_action is introduced for integrations that know the current action: heating, cooling, idle.”

Any thoughts for how I can point powercalc to the hvac_action ?

Sure for attributes you can use the following notations:

fixed:
  states_power:
    hvac_action|cooling: 250
    hvac_action|heating: 400
    hvac_action|idle: 5

Where hvac_action is the attribute name, and cooling the attribute value.

Let me know if this works for you.

1 Like

Hello. I’m new with HA, so maybe the reason of my problem.

I installed “Power calculation” from HACS → Explore and after that I restarted the server.

After that I have search on configuration → device and services → add integration but I can’t find the integration with the name “power”

What I have do wrong ?

Thanks for your help.

You don’t have to add any integration. Just installing with HACS and rebooting is enough. You only need to add integration when it is configurable with the GUI.

Just add configuration as stated in the readme, and after rebooting you should see power and energy entities. Check in “Configuration” → “Devices & Entities” → “Entities”.

When you don’t see any entities please check the logs for errors. You could also enable debug logging to see more information.

Hope this helps.

@bramski the proposed config worked, the help is much appreciated

fixed:
  states_power:
    hvac_action|cooling: 250
    hvac_action|heating: 400
    hvac_action|idle: 5
1 Like

Hello Bramski. Many thanks for your answer. I found it ! great job.

Like I tell you before I’m new with HA. So I added all the entities in my energy section, I mean all my Hue. But I miss all my Yeelight strips and light that have not been detected.

How I can add them to my HA ? I know the power of each light when they are on and all the power in standby. I read a little in the config but I dont understand well how to do this. A concrete example can help me a lot I think :slight_smile:

Last question, we have the power but is it possible to have also the cost with each light entities in the Energy section ?

Many thanks for your help and sorry if my questions are a bit noobs :wink:

Thanks climate works really well as I don’t have an Energy meter on my A/C, but I have been able to assign different values to different modes.

- platform: powercalc  
  entity_id: climate.family
  fixed:
    states_power: 
      cool: 4000
      dry: 1000
      fan_only: 300

Of course it isn’t exact but it is useful for me to understand roughly what is drawing my power.

2 Likes

Have a look at fixed and linear modes in the Readme. It’s all explained there with various examples.

For the costs this is managed by HA core. There are possibilities for Tariffs, I don’t use that myself so cannot help you with that.

Thanks for this addition. Sorry I wasn’t able to create a ticket in time, I was on vacation. Thanks again.

1 Like

Did you get this working with UPS devices? I have my ups / powercalc defined and see it under developer tools, and its showing a value and I added it to the Energy panel but nothing is showing there even after 2 hrs. Other items like lights, switches, have shown up almost immediately.

Hi all,

For all my hue lights, I created a powercalc sensor as follows:

sensor:
  - platform: powercalc
    create_group: All Hue Lights
    entities:
        - light.hue_lightstrip_kast
        - light.hue_lightstrip_bar
        - light.hue_ambiance_lamp_1_gang
        - light.hue_ambiance_lamp_2_gang
        - light.hue_color_spot_1_overkapping
        - light.hue_color_spot_2_overkapping
        - light.hue_color_spot_3_overkapping
        - light.hue_color_spot_4_overkapping
        - light.hue_color_spot_5_overkapping
        - light.hue_color_spot_6_overkapping
        - light.hue_color_lamp_1_overkapping
        - light.hue_go_master
        - light.hue_go_master_2
        - light.dimmable_light_6
        - light.dimmable_light_7

With following config in configuration.yaml:

powercalc:
  scan_interval: 00:01:00 #Each minute
  power_sensor_naming: "{} Powersensor"
  create_utility_meters: true

After reboot, all my entities got a powersensor attribute, but not my group. I want to report on a daily, monthly and yearly basis the power consumption of all my hue lights in grafana…

What do I need to do to get a group power usage tracker in place ?

Thanks in advance !

Kr,

Bart

Your syntax is wrong, this should also give an error in the error log. You are missing entity_id property. Try modify to this:

sensor:
  - platform: powercalc
    create_group: All Hue Lights
    entities:
        - entity_id: light.hue_lightstrip_kast
        - entity_id: light.hue_lightstrip_bar
        ....

Let me know if this works.