Powercalc - Virtual power sensors

Hi,
I’m triying to add a multi switch strategy to mesure the power usage of my central boiler (it has 3 Electric resistance heating), I control it with a 4 way switch (ZG-005-RF), the first switch for the on/off heating and the others for each resistances.
When I try to add the multi switch, no power entities are created, but when I try to add a fixed one, it works without problem with each switch.

In configuration.yaml, when I add:

powercalc:
  sensors:
    - name: "Conso Chaudiere"
      multi_switch:
        entities:
          - switch.centrale_chaudiere_commutateur_2
          - switch.centrale_chaudiere_commutateur_3
          - switch.centrale_chaudiere_commutateur_4
        power_off: 0.25
        power: 1700

The power entities are created and works good, but how can i add the trigger with my on/off switch ?

Anything in the logs?

when I try to create multi switch via GUI, I got this :

Cette erreur provient d'une intégration personnalisée

Enregistreur: custom_components.powercalc.sensors.power
Source: custom_components/powercalc/sensors/power.py:222
intégration: Powercalc (documentation, problèmes)
S'est produit pour la première fois: 18:27:38 (1 occurrences)
Dernier enregistrement: 18:27:38

switch.centrale_chaudiere_commutateur: Skipping sensor setup: Model not found in library (manufacturer: _TZ3000_u3oupgdy, model: TS0004)
Cette erreur provient d'une intégration personnalisée

Enregistreur: custom_components.powercalc.sensors.power
Source: custom_components/powercalc/sensors/power.py:194
intégration: Powercalc (documentation, problèmes)
S'est produit pour la première fois: 18:27:38 (1 occurrences)
Dernier enregistrement: 18:27:38

switch.centrale_chaudiere_commutateur: Skipping sensor setup: Model not found in library (manufacturer: _TZ3000_u3oupgdy, model: TS0004)
Cette erreur provient d'une intégration personnalisée

Enregistreur: custom_components.powercalc.sensor
Source: custom_components/powercalc/sensor.py:373
intégration: Powercalc (documentation, problèmes)
S'est produit pour la première fois: 18:27:38 (1 occurrences)
Dernier enregistrement: 18:27:38

No energy sensor created for config_entry 01JAQYFMEJ2QS9GPMDXAKB55EB

could you please create an issue on github and include diagnostics? Click three dots on the config entry and “Dowload diagnostics”.

Done, but I’m not sure if I did it right ^^

I have used a fixed power entity to handle a group of 20 alexa echos for some time. I set this to be 45 watts, and this has always been fine. Now though I have created a template that counts the actual number of echo’s that are online (so that I can unplug some and they automatically stop being counted). I multiply this count by a factor to come up with a total power draw of the online echo devices. I would like to feed the fixed power now based on a value in that template - but I think maybe I’m going about this incorrectly.

        
#   Alexa & Google smart speakers & devices (20 - always on previously) - total fixed energy per day      
      - name: All Alexa & Google Smart speakers
        daily_fixed_energy:
#          value: 45
          value: "{{state_attr('sensor.alexa_echo_online_count','total_echo_power_draw')}}"
          unit_of_measurement: W
          update_frequency: 60

 

What I’m finding is that powercalc continues to use the 45 watt number, even though the current number from the template is 42.

Am I going about this incorrectly?

I see, I don’t think template is re-evaluated for daily fixed mode.
I suggest you to change it to virtual power sensor with fixed mode:
https://docs.powercalc.nl/strategies/fixed/

      - name: All Alexa & Google Smart speakers
        entity_id: sensor.dummy
        fixed:
          value: "{{state_attr('sensor.alexa_echo_online_count','total_echo_power_draw')}}"

This power sensor should react real time to any change in the template.

1 Like

Thank you for this. It worked with one minor change - “value” isn’t allowed under “fixed” - it needs to be “power”.

It seems to work - although an Alexa challenge arose when I went to test - it appears that when you unplug an alexa echo device it remains in “standby” mode for a while (I don’t know how long). Devices that have been unplugged for a few weeks or more all show as unavailable. Going into the Alexa app and trying to do something with the device makes Alexa want to “set it up” - so Alexa recognizes the device isn’t responding - but if I back out of the setup, it still retains the status of “Standby”.

Giving this a full end-to-end test will apparently take some time.

"Nothing is ever easy " (me, 2024) :slight_smile:

Addendum - I tested this the other way around - I took one of my off-line devices and plugged it back in. After asking it a question it went into standby mode. The additional power draw was reflected through the entire chain - so the approach above worked for me. (not if only I could get Alexa to update it’s status information faster…)

Glad you got it working!
My bad I provided you wrong example, but you figured it out :wink:

But only because you gave me the link to the documentation - otherwise I’d still be scratching my head :slight_smile:

thanks again
Ken