#Automation on Solar-energy surplus

1 messages Β· Page 1 of 1 (latest)

graceful ingot
#

I have made an own sensor-helper calculating the suplus of my solar panels. I check the current power-production on the growatt datalogger (inverter). I check the currect home-consumption.
I calculate the surplus, production minus the consumption. If this is more then 1000W i want to turn on a smartplug.
In my automation i set up: If the energysurplus is higher then 1000, turn on Smartplug.

It aint working, so im here for help.
In my overview, i see the surplus value "1,877.9 W".
I think this is where its going wrong, because i cant use a , and . in the automation?

How do i set the automation, that it turns on the plug when the value is higher then 1,000.0?
Or must i change the sensor output?

ancient lodge
#

Please share the yaml (in code tags) of the helper and the automation πŸ™‚ Hard to guess what you have now.

graceful ingot
#

Ill post them when i get home. Thanks for your answer.

distant cedar
graceful ingot
#

@ancient lodge
template:

  • sensor:
    • name: "Overschot"
      unique_id: sensor_overschot_uniqueid_1
      unit_of_measurement: "W"
      state: >
      {% set productie = states('sensor.cu04030066_output_power') | float(0) %}
      {% set verbruik = states('sensor.electricity_meter_power_consumption') | float(0) * 1000 %}
      {% set overschot = productie - verbruik %}
      {{ overschot | round(1) if overschot > 0 else 0 }}
#

@ancient lodge

#

Sometimes the automation works, sometimes it doesnt.. It doesnt make sense πŸ™‚ But there is probably something wrong with the config.

ancient lodge
#

At first glance okay. Please share the automatiomn as yaml as well (and please use markdown code tags : ))

graceful ingot
#

this is what i see in my overview (Overschot 1,856.2 W)

ancient lodge
#

Doesn't you meter also just show you the export (teruglevering)?

graceful ingot
#

Ye it does: Electricity Meter Power Production.

ancient lodge
#

why don't you use that?

graceful ingot
#

No obvious reason. Just started playing with ha.

#
  • id: '1750081365389'
    alias: BijOverschot1000OfMeerZetFpenWpAan
    description: ''
    triggers:
    • trigger: numeric_state
      entity_id:
      • sensor.overschot
        above: 1000
        conditions:
    • condition: time
      after: '10:30:00'
      before: '20:00:00'
      actions:
    • type: turn_on
      device_id: 0c0d9e8e20189a1b6ae386197de9ba47
      entity_id: 5bac4f32b80ef6604e517e10b4a19554
      domain: light
      mode: single
  • id: '1750086552890'
    alias: OverschotMinderDan500ZetFpenWpUit
    description: ''
    triggers:
    • trigger: numeric_state
      entity_id:
      • sensor.overschot
        below: 500
        conditions:
    • condition: time
      after: '10:30:00'
      before: '20:00:00'
      actions:
    • type: turn_off
      device_id: 0c0d9e8e20189a1b6ae386197de9ba47
      entity_id: 5bac4f32b80ef6604e517e10b4a19554
      domain: light
      mode: single
  • id: '1750171693968'
    alias: TestLampOverschot
    description: ''
    triggers:
    • trigger: numeric_state
      entity_id:
      • sensor.overschot
        above: 800
        conditions: []
        actions:
    • action: light.turn_on
      metadata: {}
      data: {}
      target:
      device_id: c4b39df19218ba7ca44691af9905079c
      mode: single
#

Just playing with it, and wanted to 'turn on a light' when the value is above 800, but this also doesnt work..... (im doing something wrong... but what)

ancient lodge
#

But "overschot" and " Electricity Meter Power Production" should be the same unless you have a home battery. Last should be more precise

#

you do know that a numeric_state will only trigger when teh value goes from below 1000 to above 1000? (in case of the first automation)?

stiff crystal
#

Hi Florus, a set value with Watt and a numeric value dont work Together. One is power one is simple math. Remove youre unit from youre sensor and you schould be finde.

The other method would be a Script where you Read
{{States('sensor.overshot')}} and log it

If its nil then numeric is right if it isnt states would be the way to go.

ancient lodge
#

@stiff crystal A template sensor can have a unit of measurement, no problem πŸ™‚

stiff crystal
#

Yes but the automation using thst value afterwards cant.

Had the exact same Problem with my growatt system. When i checked the value with unit it didnt work. As numeric it did

ancient lodge
#

yes it can, not different than any other sensor in HA (with a numeric value)

stiff crystal
#

Ok... Mine didnt but you know better. Just Tried to help, good luck then

ancient lodge
#

@stiff crystal Did you any change add the unit in the state instead of in the unit_of_measurment key? Because that's the whole reason, that the state can just be the (numeric) value.

stiff crystal
#

Seems like my system just works different. He will Figure it Out

graceful ingot
#

So, where do i start? I’m kinda lost now πŸ™‚

ancient lodge
ancient lodge
stiff crystal
#

Or other question, have you Tried the device or entitiy trigger?

ancient lodge
#

And other then to learn, I would drop the template as you already have a direct sensor (which is more accurate).

graceful ingot
#

I think i fixed it, creating another helper named overschot_nummeric with the jinja state: {{ states('sensor.overschot') | float }}

#

Thanks for all the help!

graceful ingot
graceful ingot
ancient lodge
#

I'm glad you found the real problem. All the template stuff is just a Rube Goldbergmachine as you already have a sensor for it, directly from your meter.

For not triggering when it's already above, if you also want it to trigger @11:00 when you have enough over production, just add that. Aka, a trigger @11:00 and a condition you need to have overproduction πŸ™‚

#

I didn't see it or go on about it because the misleading because of the template path, and that without proper formatting the yaml is so damn hard to read

graceful ingot
#

I have never wrote any yaml before, so it was made by google and chatgpt..

#

Just been working with it 2 days, so steep learning curve πŸ™‚

ancient lodge