MYPV integration started

Because of this issue i created my script which is setting the amount of engery direct from the output from HA

Hi Sleepymax. I use this and is working perfect so far. ( You see my screenshoots ).

alias: ElwaUpdate
description: ElwaUpdate
trigger:
  - platform: state
    entity_id: sensor.vxxout
condition:
  - condition: numeric_state
    entity_id: sensor.vxxout
    above: 800
action:
  - choose:
      - conditions:
          - condition: numeric_state
            entity_id: sensor.vxxout
            above: 800
          - condition: template
            value_template: "{{ states('sensor.elwaxx_power') != 'unknown' }}"
        sequence:
          - service: rest_command.update_elwa_pid_power
            data_template:
              power: >-
                {%- set calculated_power = (((states('sensor.vxxout') | float -
                800) * 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_pid_power
            data_template:
              power: "{{ states('sensor.vxxout') | float }}"
      - conditions:
          - condition: template
            value_template: "{{ states.sensor.vxxout.state != 'unavailable' }}"
          - condition: template
            value_template: "{{ states.sensor.elwaxx_power.state != 'unavailable' }}"
        sequence:
          - service: rest_command.update_elwa_pid_power
            data_template:
              power: 0
mode: restart

1 Like

i got mail from MyPV:

it doesn´t matter what steering method you are using - you should choose only one of them :wink: …

so you can use the: /control.html?pid_power=n
or the /control.html?power=n input

the differce between both steering mehods is: pid_power will (should?) come mostly direct from a metering device and you can set a Elwa intern goal of (50w?) for giving to the grid - then the elwa intern pid will work to use mostly everything except of these (50?)watts for heating your water

if you will use the power input then the amount of power which will be used by the elwa is calculated outside of your elwa (in my instance in HA) and this gives a fixed amount of power on witch the elwa is driven so every single watts more or less regulation is coming through the extern Steering (HA)

so the difference of the steering is only in everyone´s personal preferences (requirements) - it won´t affect the durability or anything else in your !MyPV ELWA E2!

(got this and tried to transalte correctly…)

How you command the elwa?

Hi Sleepymaxx.

For me ( Elwa-E ) works perfect with the pid_power so far.

At soon I got the Elwa-2 I will report back :slight_smile:

P.S. Here is the today Elwa…

1 Like

i think you are trying to set up the same integration for one device twice.
please delete your first AC-Thor-1 device and reconfigue your Integration with the right settings again…
grafik
in my opinion you should find out by yourself what tick´s you have to set up…
grafik

Anybody get errors after the latest core update 2024.5.1? on rest commands or is just my system get crazy?

After hours of test/check with the 2024.5.1 the communications with Elwa have issues. Restful errors and json errors.

Please let me know if anybody have this issues.

UPDATE: I run the 2024.5.2 Now everything it works again normal.

Thanks for the integration. It worked immediately after installation, thanks!
I got the inverter Huawei SUN2000-10KTL-M1, the power sensor Huawei DTSU666-H3 and the optimizer myPV AC Thor 9s. Having run in all the issues from the inverter like “Modbus TCP is interferring with Modbus RTU” etc., I finally got everything up and running with the following hardware setup: Huawei USB-Dongle disconnected and not in use, the Thor connected via modbus RTU to the inverter. Your integration shows nicely all the parameters from the Thor, but not the ones from the inverter nor the power meter. The most important is the power produced from the inverter. I had assumed that the parameter “Power from solar” is the one, but it does not read any values. Additionally, the DC voltage and current from the solar panels would also be good to monitor. So my questions:

  1. Is there a way to get these parameters from the Thor 9s and your integration?
    UPDATE: i can now read at least the “photovoltaic power”. In the Websetup of the Thor9s, go to “Measurement Settings” → “Photovoltaic Power” and set the “Meter Register” to “32080” and the data type to “int32”, no scaling. Then the value is available in the integration as “m1sum”. However, it is updated only every minute.

  2. Is it possible to change the polling frequency from the default (which is 10s )?
    UPDATE: The line
    update_interval = timedelta(seconds=10)
    in the file coordinator.py does the trick

Thanks.

Hello everyone!
I am absolutely thrilled that you have managed to integrate mypv. Unfortunately, the information is now scattered over an entire thread. I would love it if you could commit your working configuration and push it to a repository and possibly create a pull request. That would really make it easier for newcomers.
I would also be happy to support you if git fails. If you send me your yaml files, I will create the corresponding pull request.

description: ElwaUpdate
trigger:
  - platform: state
    entity_id:
      - sensor.master_battery_discharge
  - platform: state
    entity_id:
      - sensor.stromverkauf_nach_wp_zaehler
condition:
  - condition: sun
    before: sunset
    after: sunrise
action:
  - if:
      - condition: numeric_state
        entity_id: sensor.master_battery_discharge
        below: "0.16"
      - condition: numeric_state
        entity_id: sensor.stromverkauf_nach_wp_zaehler
        above: "4"
    then:
      - service: rest_command.update_elwa_power
        data:
          power: >-
            {{ ((((states('sensor.stromverkauf_nach_wp_zaehler') | float -4)*55
            + states('sensor.elwa_e_2_mypv_stromverbrauch_aktuell') |
            float))*0.9)}}
    else:
      - service: rest_command.update_elwa_power
        data:
          power: 0
    enabled: true
mode: single

rest:
  - resource: "http://xxx.xxx.xxx.xxx/data.jsn"
    scan_interval: 10
    sensor:
      - name: "MyPV Stromverbrauch aktuell"
        unique_id: "mypv_stromverbrauch_aktuell"
        value_template: "{{ value_json.power_elwa2 }}"
        device_class: energy
        unit_of_measurement: "W"
        state_class: total_increasing
      - name: "Trinkwasser Temperatur unten"
        unique_id: "trinkwassertemperatur_unten"
        value_template: "{{ value_json.temp1 / 10 }}"
        device_class: temperature
        unit_of_measurement: "°C"
      - name: "Trinkwasser Temperatur Oben"
        unique_id: "trinkwassertemperatur_oben"
        value_template: "{{ value_json.temp2 / 10 }}"
        device_class: temperature
        unit_of_measurement: "°C"
rest_command:
  update_elwa_power:
    url: "http://xxx.xxx.xxx.xxx/control.html?power={{ power }}"
  update_elwa_pid:
    url: "http://xxx.xxx.xxx.xxx/control.html?pid_power={{ pid_power }}"
  update_elwa_boost:
    url: "http://xxx.xxx.xxx.xxx/control.html?boost={{ 1 }}"

Hello everyone, I’m hoping someone can help me figure out why controlling my AC ELWA 2 via HTTP isn’t working. My goal is to manage it through a Home Assistant automation, similar to the examples discussed in this forum. Here’s what I’ve done so far:

  • Configured the control method to “HTTP” in the ELWA settings.
  • Attempted to set the pid_power using Postman with the following URL:
http://192.168.1.117/control.html?pid_power=1000
  • I also tried using:
http://192.168.1.117/control.html?power=1000

Despite this, it still doesn’t work. The ELWA settings display a message like “not connected.” However, the grey boxes for the IP occasionally show the IP address of my machine that is sending the POST requests. The ELWA is connected via cable.

Any help would be much appreciated! Thank you!

Edit: Nevermind. Didn’t really change anything but it works now :slight_smile:

Hi sleepymaxx, isn’t it possible to create a second automation to reduce the power to the AC ELWA2 instead of going directly to 0 when there is a cloud which causes the the battery to drain or power be consumed from the grid.
Let’s say out of the battery or grid 100W are consumed then the actual elwa power should be reduced by 100W.
I’m just not good in yaml.
Cheers Boris

In my system I activate the automation at soon my system export to grid 800watt and stop the automation when export is under 800watt. So basically I’m only use solar energy, no battery and no grid.

hi boris …

as mentioned here:

you can really simply only change the numbers in the automation (and you will get what you are looking for)

MYPV integration started - #39 by sleepymaxx

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!

you can adjust the settings only by changing the numbers in the first automation to get this effect …

i for myself was wondering very much of doing so and already had a similar option for doing so —

The odds why im using my form of integration are:
Found out the total kill of the elwa power will not be a very problematic idea - the extra power will go to the grid (not my problem! for me) (and our grid will have no problem at all with the amout of a 3kw from an on/off device) :wink:
Second (im Swabian (Special region of Germany/Bavaria/) and we are very proud of beeing extremly stingy! It´s like some kind of sports! :wink:
Third and for me most importand i use the same automation at around the year - and especially in Winter time a little cloud or a deep flying plane will kill all amount of power i milliseconds … (although my PV is very much overpowered with 30KW Peak) so i have to buy aditionall … i wont do that.
Last point on this: i wrote the complete integration and automatation last year in winter – in summer times i later added a very huge automation to kill all processes in the elwa [ noticed that i used tooo much power to heat the water - and throw a really high amount of energy out of the window - from february to april i used about 150 kwH a month too much for water heating – and we didn´t benefit from it]!
so i added a kill switch (in software) to only heat when the water needs it - if you want i will also post this here aditionally.

[(a intern kill switch is buildt in the elwa - your maximum Temp on Solarpower) - but i found out by looking at the graphs that the elwa is ticling around the top spot too much (running going to max temp – pausing about 5 min - running … and so on) for me this won´t be a good steering so i added eventual pauses for the Elwa for about 1 Hour.]

Also afterwards i cheked the amount of power / hot water we (Family of 5) used in our house to optimize the amount of enery used for waterheating - and it is tremendous - we used round about 200 kwH every month to heat water by the elwa for Washing/ Bathing/Washing Machine/ Dishwasher/ Heating/ Shower/ Kitchen…

this will summarise to more than 2500 kwh anually - if i create the same amount of warm wather with my heatpump i will only use nearly about as much as 1000 kwH of Energy - (to be honest: average warm water with the elwa is rised to 55°C [calcium related]! average warm water with the heatpump is lowered to 43°C [Wife Acceptance Factor]]

Calculation:
buying 1000kwh for heatpump costs 1000x0,335€= 335€ savings
selling 2500kwh solar Energy brings 2500x 0,075€=187,5€ earnings
Netto earning a Year =147,5 € so i really need more than 5! Jears to get my invest in the Elwa even!
So in summarise: better don´t overestimate the posibillities - i really love this piece - but my wallet must also be satisfied!

Here is my activated Automation for killing my Elwa - it looks after the Temperatures of my Drinking Water Boiler (300L) and stops the Elwa Automation if the Water is too hot for me - sensor in Elwa over 64.5 °C - also it reacivates the Elwa automatation if the second sensor in my Water boiler is under 54 °C (middle of the Boiler ) or the Elwa water Sensor is too low (due to needing Water while pausing the elwa automatation)

Also i rewrote a automation for Holidays but its not quite much…

alias: Elwa Pausieren
description: ""
triggers:
  - entity_id:
      - sensor.elwa_e_2_trinkwasser_temperatur_unten
    above: 64.5
    for:
      hours: 0
      minutes: 0
      seconds: 5
    trigger: numeric_state
  - entity_id:
      - sensor.elwa_e_2_trinkwasser_temperatur_oben
    below: 54
    for:
      hours: 0
      minutes: 0
      seconds: 5
    trigger: numeric_state
  - entity_id:
      - sensor.elwa_e_2_trinkwasser_temperatur_unten
    for:
      hours: 0
      minutes: 0
      seconds: 5
    below: 45
    trigger: numeric_state
conditions:
  - condition: sun
    before: sunset
    after: sunrise
actions:
  - choose:
      - conditions:
          - condition: numeric_state
            entity_id: sensor.elwa_e_2_trinkwasser_temperatur_oben
            above: 55
        sequence:
          - metadata: {}
            data:
              stop_actions: true
            target:
              entity_id: automation.automation_2
            action: automation.turn_off
          - data:
              power: 0
            action: rest_command.update_elwa_power
          - delay:
              hours: 1
              minutes: 0
              seconds: 0
              milliseconds: 0
          - metadata: {}
            data: {}
            target:
              entity_id: automation.automation_2
            action: automation.turn_on
      - conditions:
          - condition: or
            conditions:
              - condition: numeric_state
                entity_id: sensor.elwa_e_2_trinkwasser_temperatur_oben
                below: 54
              - condition: numeric_state
                entity_id: sensor.elwa_e_2_trinkwasser_temperatur_unten
                below: 45
        sequence:
          - metadata: {}
            data: {}
            target:
              entity_id: automation.automation_2
            action: automation.turn_on
mode: restart