InventoCasa / ha-advanced-blueprints

Advanced Blueprints combined with pyscript for extra useful automations
139 stars 33 forks source link

no regulation in off-grid operation? #65

Open pvdeye opened 1 month ago

pvdeye commented 1 month ago

Is there a way to get the control to work when I don't send any electricity into the grid?

Maik7 commented 1 month ago

yes. The details depend on what you want to use as the base for the control. Normally the script is using the solar excess (= the electricity you send into the grid). I assume you are using a battery and you want to control the load of the battery to keep the load within an optimal range to not overstress the battery? If this is the case you can create a virtual sensor "actual_load - maximum_load", where maximum load is the load you do want to exceed, and actual load is the measured load. This sensor is used for "import_export_power". With this the script tries to keep your load below maximum_load

pvdeye commented 1 month ago

Yes, that's exactly what I want to do. Do you have an example of your sensor please?

Maik7 commented 1 month ago

HI, not exactly the sensor you need, but I am using this sensor for simulating a total power sensor. You need to subtract the maximum_allowed_battery_discharge_power in the last line, too.

In configuration.yaml:

template:
  - sensor:
      - name: "Gesamtleistung"
        unit_of_measurement: "W"
        state: >
          {% set power1 = states('sensor.tasmota1_energy_power') | float(default=0) %}
          {% set power2 = states('sensor.tasmota2_energy_power') | float(default=0) %}
          {% set power3 = states('sensor.tasmota3_energy_power') | float(default=0) %}
          {% set power4 = states('sensor.tasmota4_energy_power') | float(default=0) %}
          {% set power5 = states('sensor.tasmota5_energy_power') | float(default=0) %}
          {% set power6 = states('sensor.tasmota6_energy_power') | float(default=0) %}
          {% set power7 = states('sensor.virtueller_kuehlschrank_sim_energy_power') | float(default=0) %}
          {% set power8 = states('sensor.virtuelles_aquarium_sim_energy_power') | float(default=0) %}
          {% set power9 = states('sensor.virtueller_akku_energy_power') | float(default=0) %}

          {% set zusatz = states('input_number.zusatz_power') | float(default=0) %}
          {% set zufalls_power = states('input_number.zufalls_power') | float(default=0) %}
          {% set solar_power = states('sensor.ap1_total_power') | float(default=0) %}

          {{ power1 + power2 + power3 + power4 + power5 + power6 + power7 + power8 + power9 + zusatz + zufalls_power - solar_power }}
pvdeye commented 1 month ago

Danke Maik ich versteh irgendwie nicht für was ich das brauche? Bitte um Erklärung kann ich nicht einfach den battery sensor als im-export power einsetzen?

Maik7 commented 1 month ago

Hi,das Beispiel zeigt nur, wie verschiedene Messwerte zu einem neuen Sensor verrechnet werden können. Du musst vermutlich nur deinen Batteriesensor und eine Konstante addieren. Oder willst Du auf 0 Watt Entladung regeln? Dann reicht der Batteriesensor, ggf. mit -1 multipliziert. Grüße Maik