MYPV integration started

That here I know. I got from MYPV the info about the elwa and the http.

Thank you

Hi sleepymax.
Can you please help a bit here?

I got my sensors working. Now I got + readings on solar production. My question is how can I control the power of Elwa when the solar power change?
I mean on your code I can see that you check the state of two sensor but somehow i’m not coding master.

I have one sensor show the surplus from my solar.

I can control manual the elwa on/off/power change and all the readings.

Thanks in advance.

P.S. Basicaly what you do here…(?).

power: >-
            {{ (((states('sensor.stromverkauf_nach_wp_zaehler') | float -4 )* 36
            + states('sensor.elwa_e_2_mypv_stromverbrauch_aktuell') | float)) *
            0.95 }}

Here is my yaml
alias: ElwaON
description: ElwaON
trigger:

  • platform: state
    entity_id:
    • sensor.vxxout
      condition:
  • condition: sun
    after: sunrise
    before: sunset
    action:
  • if:
    • condition: numeric_state
      entity_id: sensor.vxxout
      above: 800
    • condition: numeric_state
      entity_id: sensor.vxxin
      below: 0.1
      then:
    • service: rest_command.update_elwa_power
      data:
      power: >-
      {{ (((states(‘sensor.vxxout’) | float -4 )* 36 +
      states(‘sensor.elwaxx_power’) | float)) * 0.95 }}
      else:
    • service: rest_command.update_elwa_power
      data:
      power: 0
      mode: single

What that means:
)* 36 +

  • 0.95

Sorry for the trouble…I start with HA last month…A lot to learn.

Im not really anything more than you only try and error!

for MOST people and for most installed scripts it would be the simplest method to only take your surplus from your mysolar and put this into your elwa

power: >-
            {{ (((states('sensor.stromverkauf_nach_wp_zaehler') | float -4 )* 36
            + states('sensor.elwa_e_2_mypv_stromverbrauch_aktuell') | float)) *
            0.95 }}

this is only for calculating the amount of Power on which MY Elwa should run. (On our house there are special engery calculating and measuring devices installed due to our Heatpump) please look here: https://community.home-assistant.io/t/mypv-integation-started/395584/24?u=sleepymaxx
IN short i will only run my elwa on the amount of power which is going to the Grid AFTER all other house consumers, and after my Heapump is also satisfied.
Also i have installed a house Battery which should no be unloaded by my Elwa

So here i go for explaining my sensors and the idea of this template:

sensor.stromverkauf_nach_wp_zaehler

i take the actual power which is going from my house outwards to the grid

-4

i subtrahate 4 amounts of this measured amount (so i dont activate the ELWA too early) and this “4” is the same amount witch has to be the minium to start as condition of my numeric state of my activating script

* 36

i calculate the output how much watts should my elwa consume

+ states
sensor.elwa_e_2_mypv_stromverbrauch_aktuell

the calculated amount of energy for the next period has to be added to the actual amount of energy which is going through the elwa in the actual period (otherwise there will be to less energy going through the elwa and too much to the grid in the next period)

* 0.95

the now new calculated amount of power should be redueced a little bit, so if there is a little cloud or a consumer in my house starts it will not take engery from my battery or the grid!

- service: rest_command.update_elwa_power

this will push the explained amount of power to my elwa

* 0.95  / * 36   / - 4

so feel free to experiment with the calculating parts of your template… i think its depending on your house/installation/battery/waterboiler/using… what best calculating points you have. (i figured it out by controlling my history graph)

PS: please look out! my first script should go into your configuration.yaml
my second script is a automation!

THANK YOU.

Now is all clear.

I will check it at soon we have some sun :slight_smile:

alias: ElwaON
description: ElwaUpdate
trigger:

  • platform: state
    entity_id:
    • sensor.vxxout
      condition:
  • condition: sun
    after: sunrise
    before: sunset
    action:
  • if:
    • condition: numeric_state
      entity_id: sensor.vxxout
      above: “4”
      then:
    • service: rest_command.update_elwa_power
      data:
      power: >-
      {{ (((states(‘sensor.vxxout’) | float -4 )* 40 +
      states(‘sensor.elwaxx_power’) | float)) * 0.9 }}
      else:
    • service: rest_command.update_elwa_power
      data:
      power: 0
      mode: single

Hi. Well I have finally arrange it to my needs.
It works just fine.
Thanks for your advise/help.

P.S.

alias: ElwaON
description: ElwaUpdate
trigger:

  • platform: state
    entity_id:
    • sensor.vxxout
      condition:
  • condition: sun
    after: sunrise
    before: sunset
    action:
  • if:
    • condition: numeric_state
      entity_id: sensor.vxxout
      above: “800”
      then:
    • service: rest_command.update_elwa_power
      data:
      power: >-
      {{ (((states(‘sensor.vxxout’) | float -800 )* 3 +
      states(‘sensor.elwaxx_power’) | float)) * 0.25 }}
      else:
    • service: rest_command.update_elwa_power
      data:
      power: 0
      mode: single

Hallo. Anybody get this error?

This error originated from a custom integration.

Logger: custom_components.mypv.sensor
Source: custom_components/mypv/sensor.py:65
Integration: MyPV AC-THOR and ELWA (documentation)
First occurred: 21:47:34 (153 occurrences)
Last logged: 22:12:56

‘power_act’

Had to integrate a new condition (its for updating the right amount of Power to the Elwa) - for the newer Readers its already included “upstairs”.

  - platform: state
    entity_id:
      - sensor.master_battery_discharge

every time the state of my battery is changing the whole script is running so the Flow´s of the Power on witch the Elwa is driven is waaaayy moore Smooth:

no clue here… (error in HA or in the Elwa itself)?maybe there are some configuration datas missing?https://community.home-assistant.io/t/mypv-integation-started/395584/42?u=sleepymaxx

I have send one email to MYPV…maybe they know something.

so the error occurs in your elwa … so how are your configurations on your elwa… ?

I’m not sure is on the Elwa. Still searching…and asking.

I just disable the integration the error is not showing anymore. Looks like is on the integration.

Basically I can use the Elwa without the integration. I just reported here to check if is only me or is a wide error.

I once had a similar problem with another sensor in a template… mostly i found out (for me) the major problem of sensors, templates and so on are when there are missing some parts in the definiton and the ordening of the sensor or the template… so i would check if there are all definitons for your sensors actual and acting right…
at mine it was the ordening of unique id + device class + unit of measurement + state class…

so i recommend to look for the right sensor-configurations…
But really this is only a option from The Glass Bowl of a noobie…

All looks ok. I’m still searching.

rest:
  - resource: "http://192.168.XXX.XXX/data.jsn"
    scan_interval: 10
    sensor:
      - name: "ELWAXX_Power"
        value_template: "{{ value_json.power }}"
        unit_of_measurement: "W"
      - name: "ELWAXX_TEMP"
        value_template: "{{ value_json.temp1 / 10 }}"
        unit_of_measurement: "°C"
      - name: "ELWAXX_Tagret"
        value_template: "{{ value_json.ww1target / 10 }}"
        unit_of_measurement: "°C"

At soon I found the issue…I will post it.

oh… im not thinking so… you have to add much more information to your sensor only with the additional informations of your sensor HA is able to sort your data correct and use your data in the right way.
i really recommend to upddate your sensors definitons by adding some lines like:

    sensor:
      - name: "xxx"
        unique_id: "xxx"
        value_template: "xxx"
        device_class: xxx
        unit_of_measurement: "xxxx"
        state_class: xxx

i know it´s work to look out for the right categories of your sensors but in your case i think it would be better… :wink:

Thanks. I give a try.

I have made a bit better automation for the Elwa to not activate the stages two fast ( clicking the relays too fast ). It send the calculate power with delay 10 seconds. Also the minimum power is adjusted to 200w.

alias: ElwaUpdate
description: ElwaUpdate
trigger:

  • platform: state
    entity_id:
    • sensor.vxxout
      condition:
  • condition: numeric_state
    entity_id: sensor.vxxout
    above: “1000”
    action:
  • choose:
    • conditions:
      • condition: numeric_state
        entity_id: sensor.vxxout
        above: “1000”
        sequence:
      • service: rest_command.update_elwa_power
        data_template:
        power: >-
        {%- set calculated_power = (((states(‘sensor.vxxout’) | float -
        1000) * 3 + states(‘sensor.elwaxx_power’) | float)) * 0.23 -%}
        {{ calculated_power if calculated_power >= 200 else 0 }}
      • delay: “00:00:10”
      • service: rest_command.update_elwa_power
        data_template:
        power: “{{ states(‘sensor.vxxout’) | float }}”
    • conditions:
      • condition: numeric_state
        entity_id: sensor.vxxout
        below: “1000”
        sequence:
      • service: rest_command.update_elwa_power
        data_template:
        power: 0
        default:
        mode: single

p.s. Works extreme good like this with clouds like this.

I have implemente your “simple” automation from Jan. 18, which works really nice except for the flaws of fast switching that you already mentioned.

When I went through your new “advanced” automation, I struggle to understand why you set the power to the max available power ( I assume that is sensor.vxxout) after the 10 second delay.
Could you explain the reason behind this?

To avoid clicking the relays like crazy in Elwa.

P.S. Here is one updated version.

alias: ElwaUpdate
description: ElwaUpdate
trigger:

  • platform: state
    entity_id: sensor.vxxout
    condition:
  • condition: numeric_state
    entity_id: sensor.vxxout
    above: “1000”
  • condition: template
    value_template: “{{ is_state(‘input_boolean.elwa_update_running’, ‘off’) }}”
    action:
  • service: input_boolean.turn_on
    target:
    entity_id: input_boolean.elwa_update_running
    data: {}
  • choose:
    • conditions:
      • condition: numeric_state
        entity_id: sensor.vxxout
        above: “1000”
        sequence:
      • service: rest_command.update_elwa_power
        data_template:
        power: >-
        {%- set calculated_power = (((states(‘sensor.vxxout’) | float -
        1000) * 3 + states(‘sensor.elwaxx_power’) | float)) * 0.23 -%}
        {{ calculated_power if calculated_power >= 200 else 0 }}
      • delay: “00:00:15”
      • service: rest_command.update_elwa_power
        data_template:
        power: “{{ states(‘sensor.vxxout’) | float }}”
    • conditions:
      • condition: numeric_state
        entity_id: sensor.vxxout
        below: “1000”
        sequence:
      • service: rest_command.update_elwa_power
        data_template:
        power: 0
  • service: input_boolean.turn_off
    target:
    entity_id: input_boolean.elwa_update_running
    data: {}
    mode: single

In my last version you get error… ELWA is all ready running. In this version is fixed with the …input_boolean

You have to add in YAML config…
input_boolean:
elwa_update_running:
name: “Elwa Update Running”
initial: off

Enjoy

Okay, I understand. Do you have ELWA or ELWA 2? I use ELWA 2 and it says : “continously variable” power settings (without steps, german “stufenlos”).

I am not sitting in the basement all the time when I work on my automation but I have to test it at some point. So far (maybe because of low solar power) I only heard the “on” clicking relays. I am not sure if there is another relay for a higher power setting.
To find out if there are multiple “hardware power levels” I emailed them.

My automation is a bit different, but apparently also does the job even with clouds or the heat pump switching on to prepare the water for heating.

Basically I specify:

home_buffer

  • buffer power for changes of home consumption (say 200 W)

heater_consumption_ratio

  • ELWA excess power consumption ratio (e.g. 80%)

minimum_battery_level

  • minimum state of charge of my battery (e.g. 95%)

And add sliders to my dashboard for control.
Then I calculate:

elwa_power_set= (grid_export_power - home_buffer + elwa_power_measurement) * heater_consumption_ratio

Last I set this value (ELWA power setting) and add a delay of 10 seconds. Otherwise, the ELWA measurement is not yet there and as you said, it can change rapidly if a cloud passes by.

I avoid setting the ELWA power to 100% of my excess power, because the slightest cloud will then lead to a shutdown (–> Relay clicking) if solar power reduces due clouds and grid export becomes negative.

alias: ELWA simple Automation ratio
description: ELWA simple automation https://community.home-assistant.io/t/mypv->integation-started/395584/40 von showup Jan. 18 2024
trigger:

  • platform: state
    entity_id:
    • sensor.grid_export_power
      condition:
  • condition: sun
    before: sunset
    after: sunrise
    action:
  • if:
    • condition: numeric_state
      entity_id: sensor.grid_export_power
      above: input_number.home_buffer
    • condition: numeric_state
      entity_id: sensor.battery_state_of_charge
      above: input_number.minimum_battery_level
    • condition: sun
      before: sunset
      after: sunrise
  • then:
    #Calculate ELWA Power setting
    - service: input_number.set_value
    data_template:
    entity_id: input_number.elwa_power_set
    value: >
    {%- set calculatedPower= (states(‘sensor.grid_export_power’) |
    float(0) - states('input_number.home_buffer)|float(0) +
    states(‘sensor.elwa_power_measurement’) | float(0) ) *
    states(‘input_number.heater_consumption_ratio’)|float(0) / 100 -%}
    # negative fallback:
    ‘{{ calculatedPower if calculatedPower > 0 else 0 }}’
    - service: rest_command.update_elwa_power
    data:
    power: “{{ states(‘input_number.elwa_power_set’)|float(0) }}”
    - delay:
    hours: 0
    minutes: 0
    seconds: 5
    milliseconds: 0
  • else:
    - service: input_number.set_value
    data_template:
    entity_id: input_number.elwa_power_set
    value: “{{ 0 }}”
    - service: rest_command.update_elwa_power
    data:
    power: “{{ 0 }}”
    mode: single

Have you (or anyone else here) figured out if you can change the max. Power for the device via a http command rather than the Web-Interface of the ELWA?

I would probably use PID Control = 1 but limit the max. power according to the current solar production if possible.