MYPV integration started

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.

You can add a limit in your automation…

power: >-
{%- set calculated_power = (((states(‘sensor.vxxout’) | float - 1000) * 3 + states(‘sensor.elwaxx_power’) | float)) * 0.23 -%}
{{ min(calculated_power if calculated_power >= 200 else 0, 3000) }}

This modification ensures that the calculated power value is not greater than 3000. If calculated_power exceeds 3000, it will be capped at 3000.

The upper limit is a good point :+1: Even though my solar panels will unlikely ever exceed 3000 W excess power.

i would recommed to all the ELWA (1)! users to use the
/control.html?pid_power=n
command in order to reduce the clicking of the Elwa because inside there is a “older” Relay working.
By using the pid_power you only add the amount of power you will (steering must be a little different and your config must be rewritten)! because of the pid power output but you will have a much more smoth graph and you will not have the clicking!
https://community.home-assistant.io/t/mypv-integation-started/395584/30?u=sleepymaxx

Hi Sleepymaxx.
So automation must change, and the rest_command must change.

Can you give us an example please?

I was about to implement a PID controller within Homeassistant itself to achieve a smooth change of ELWA power.
However, as your previous post states: the ELWA PID controller can only be 1/0. Is there another way to limit the power the device will use?

Maybe you have more insights into how to setup the device (via the web interface) which I lack unfortunately.

Edit: I just found you can access the settings of the ELWA device via /setup.jsn and set values via e.g. ’ /setup.jsn?ww1target=599 ’ (to change the target warm water temperature).

Edit2: further variables are:

  • maxpwr: Maximum power [0 - 100]% (apparently lower limit seems to be 17%)
  • ww1target: hot water target temperature

So now the question arises: is it smart / intended to set maxpwr = excess_power/3500 * 100? [if > 17] ?
I understand the purpose of a PID controller, however changing the maxpwr every other second may defy the purpose except for the on/off issue…

Edit3: new rest_commands:

rest_command:
   update_elwa_temperature:
    url: "http://xxx.xxx.xxx.xxx/setup.jsn?ww1target={{ temperature }}
   update_elwa_maxpwr:
    url: "http://xxx.xxx.xxx.xxx/setup.jsn?maxpwr={{ power}}

and

/setup.jsn?ww1target=600` --> 60,0°C Hot water temperature target
/setup.jsn?maxpwr=70` --> 70% power of Pmax=3500 W

I just change my YAML to

rest_command:
update_elwa_pid_power:
url: “http://192.168.1.125/control.html?pid_power={{ power }}”

And I have made my automation changes… Now is not clicking anymore.
I’m not sure if is the right way but looks like the clicking issue is fixed.

I believe that is wrong.

At soon I send
http://ELWA_IP/control.html?pid_power=1000 the elwa starts with 285
and in changes of the pid_power=XXXX the elwa change.

If I send http://ELWA_IP/control.html?pid_power=0 the elwa start power down .

I have send one question to MYPV to get more info about.

As I wrote with
rest_command:
update_elwa_pid_power:
url: “http://ELWA IP/control.html?pid_power={{ power }}”

and sending the calculated power data…All is working correct.

One small update about the PID

/control.html?pid_power=100 Elwa power 24
/control.html?pid_power=200 Elwa power 60
/control.html?pid_power=300 Elwa power 100
/control.html?pid_power=400 Elwa power 140
/control.html?pid_power=500 Elwa power 180
/control.html?pid_power=600 Elwa power 220
/control.html?pid_power=800 Elwa power 300
/control.html?pid_power=900 Elwa power 340
/control.html?pid_power=1000 Elwa power 380

Is working correct with this calculation/automation we use for the
/control.html?power=XXX

Here is a screenshot of my system running this morning.

1 Like

I found out the same yesterday by trying some settings. However , from the manual it sounds to me like pid_power is on/off only with a set target temperature and maximum power.

Very good you checked the settings! I am still waiting for more sun! Could you post a plot of the ELWA power measurement over time as well as the set_power? That would give more insight I to the elwa pid logic👍

Great!

I think your explanation of the pid - Power switch is way more intelligent as my old one … i will test the next days your ideas and will change my script furthermore!
Thanks a lot

Hi Speepymax

Today is the second day I test the system. All is running PERFECT.

Basically if you feed the elwa with 200 less from what is real export all is working perfect.

HyyaXgh04IUWlaMo

1 Like