Powercalc - Virtual power sensors

The component supports input_boolean so create one, set it to true and then set up this in powercalc:

  - platform: powercalc
    entity_id: input_boolean.freezer  
    fixed:
      power: 30
3 Likes

Yes this would be the best solution. The component code relies a lot on an entity existing in Home Assistant, so would be quite some effort to support your use case.

1 Like

@OzGav very nice! Thank you! I
@bramski I don’t think a workaround would be required, OzGav’s solution actually makes a lot of sense

Thanks to the both of you!

1 Like

Hey all,

Would there be any reason why this template is not updating with sensors from this component?


- sensors:
    all_lights_energy:
      friendly_name: "All Lights Energy"
      unit_of_measurement: kWh
      value_template: >-
        {{states('sensor.bedroom_ceiling_energy') | float + states('sensor.bedroom_left_energy') | float + states('sensor.bedroom_right_energy') | float + states('sensor.conservatory_ceiling_1_energy') | float + states('sensor.conservatory_ceiling_2_energy') | float + states('sensor.conservatory_ceiling_3_energy') | float + states('sensor.dining_ceiling_energy') | float + states('sensor.floor_lamp_energy') | float + states('sensor.iris_1_energy') | float + states('sensor.iris_2_energy') | float + states('sensor.lounge_ceiling_energy') | float + states('small_lamp_energy') | float + states('sensor.nursery_ceiling_energy') | float}}
      attribute_templates:
        state_class: total_increasing
        device_class: energy
        icon: mdi:counter

Also, this other one is updating but when it’s added to the energy dashboard for an individual device it doesn’t so a bar for the usage?


- sensors:
    hot_tub_energy:
      friendly_name: "Hot Tub Energy"
      unit_of_measurement: kWh
      value_template: >-
        {{states('sensor.cleverspa_energy') | float + states('sensor.cleverspa_bubbles_energy') | float}}
      attribute_templates:
        state_class: total_increasing
        device_class: energy
        icon: mdi:counter

If I use the energy entity on its own eg sensor.cleverspa_energy it works fine. But I want to put 2 sensors together.

Thanks for any help

I’m not at home to check my exact config but two things I can think of. Firstly, I believe for the bar graphs to appear on the energy page they have to be recorded in the database. So check your config and make sure they are included in the RECORDER section

Next not sure your sensor templates are setup correctly as per here Template - Home Assistant (I think you are using the legacy format so this may not matter but can’t hurt updating to current format?)

I think it should be

- template:
    - sensor:
        - name: “Hot Tub Energy”
          unit_of_measurement: kWh
          state: >-
              {{states('sensor.cleverspa_energy') | float + states('sensor.cleverspa_bubbles_energy') | float}}
          state_class: total_increasing
          device_class: energy
          icon: mdi:counter

Edit: for the first one I would carefully check that all of the light energy sensors have a value. If you have any unknowns it might be generating an error. In the link to the Template section In the docs have a look at the “considerations” section

@OzGav Good suggestion to use the new format. You are missing a quote after Hot Tub, and a wrong quote at the beginning.
@AlexGreenUK I also have no clue why your sensors are not working. Any errors in the logs? Maybe try removing certain sensors from the template until you find the culprit. Is this template working correctly from developer tools?

I just created a new section in the Wiki with some examples how to create groups. Hope this also helps other to setup template sensors correctly.

I have so much lights and adding for every light an extra entry into the configuration yaml is not that nice. So a good idea could be to at least enable a possibility to work with wildcards like:

  - platform: powercalc
    entity_id: light.hue_color_livingroom_*

as I have 4 of the same type or even let us filter on models

  - platform: powercalc
    model: "Hue color candle"

as a result the component adds all with standard values whenever the model is “Hue color candle”.

Thanks for this cool component
Lukas

Thanks fixed. That’s what happens when I try and do this on the go on the iPad!

I have put all my energy stuff in a package so that the configuration.yaml stays manageable. Packages - Home Assistant

1 Like

See https://github.com/bramstroker/homeassistant-powercalc/issues/169. This is a similar request. You can add your idea there. This is a big complex feature request which will require lot of development effort. I will consider but can’t promise I will do it anytime soon.

Yes I also manage it this way. All my power sensors contained in a single package. It’s also a one time configuration. Most people are not adding new lights on a weekly basis.

1 Like

Thanks.

I cant get the system up and running for all lights without lut support. getting the following errors:

2021-09-11 10:24:55 ERROR (MainThread) [custom_components.powercalc.sensor] Skipping sensor setup light.lightstrip_wohnzimmer: Model not found in library (manufacturer: Signify Netherlands B.V., model: LCL002)
2021-09-11 10:24:55 ERROR (MainThread) [custom_components.powercalc.sensor] Skipping sensor setup light.lightstrip_klavier: Model not found in library (manufacturer: Signify Netherlands B.V., model: LST002)
2021-09-11 10:24:55 ERROR (MainThread) [custom_components.powercalc.sensor] Skipping sensor setup light.lightstrip_esszimmer: Model not found in library (manufacturer: OSRAM, model: Plug 01)
2021-09-11 10:24:55 ERROR (MainThread) [custom_components.powercalc.sensor] Skipping sensor setup light.deckenlampe_esszimmer: Model not found in library (manufacturer: 3A Smart Home DE, model: LXN-1S27LX1.0)
2021-09-11 10:24:55 ERROR (MainThread) [custom_components.powercalc.sensor] Skipping sensor setup light.kristalllampe: Model not found in library (manufacturer: OSRAM, model: Plug 01)
2021-09-11 10:24:55 ERROR (MainThread) [custom_components.powercalc.sensor] Skipping sensor setup light.stehlampe_klavier: Model not found in library (manufacturer: OSRAM, model: Plug 01)

my configuration looks like this:

  - platform: powercalc
    entity_id: light.lightstrip_klavier
    mode: linear
    linear:
      min_power: 0.3
      max_power: 20.0
  - platform: powercalc
    entity_id: light.lightstrip_esszimmer
    mode: fixed
    fixed:
      power: 20.0
  - platform: powercalc
    entity_id: light.deckenlampe_esszimmer
    mode: fixed
    fixed:
      power: 50.0
  - platform: powercalc
    entity_id: light.kristalllampe
    mode: fixed
    fixed:
      power: 15.0
  - platform: powercalc
    entity_id: light.stehlampe_klavier
    mode: fixed
    fixed:
      power: 20.0

no idea what is missing/wrong with that.

This is actually a bug which I fixed yesterday see https://github.com/bramstroker/homeassistant-powercalc/pull/214. However the fix is not released yet. Will release a new version 0.7.0 containing this fix today. You can remove mode: fixed, mode: linear from configuration, this will be automatically set correctly.

edit
Just released v0.7.0. Let me know if this solves your issue.

you are great, working fine now :slight_smile:

1 Like

Is it possible to to /powercalc/data own folder?
I just have few Gledopto bulbs that probably are similar to some Signify bulbs just I will made some small modifications to Signify files. Temporary solution for me.

I did it, in fact, but update deleted my folders.

Yes. have a look at custom_model_directory

Oh, I overlooked it, sorry.
Two more Q:
A. Do I need to add an entry for every sensor or can I use it as a global configuration?
B. Can I put that subfolder with custom light models into /powercalc/data/ directory? Or it will be erased during the update?

A. Do I need to add an entry for every sensor or can I use it as a global configuration?

Yes you need to add the setting for each sensor you want to have use a custom light definition for

B. Can I put that subfolder with custom light models into /powercalc/data/ directory? Or it will be erased during the update?

You have to put it in a subdirectory under your home asssitant config directory, when you put it in /powercalc/data it will be overwritten next update.
So you could create config/powercalc_custom_models/my_light for example.

1 Like

Is there also an overview of manual settings for devices which are used by many people, like e.g. Google Nest speakers. That would make it more easy to add those, so not everybody has to measure outputs themselves if they want to add it.

1 Like

No, not yet. Maybe I will consider into extending the light model library with other kind of devices/appliances, but I have not plans on doing that short term yet.