From 453c3c6e60a5c2901f896da316b6b62bd2c56426 Mon Sep 17 00:00:00 2001 From: 31c0fe9c6dbd74bcdde92e1d2aaa03e1d272f75f Date: Fri, 26 Aug 2022 11:25:07 +1000 Subject: [PATCH] Home Assistant Git Exporter --- config/packages/sungrow.yaml | 56 +++++++++++++++++---------- config/zigbee2mqtt/state.json | 14 +++---- lovelace/lovelace.lovelace_solar.yaml | 15 +++++++ 3 files changed, 58 insertions(+), 27 deletions(-) diff --git a/config/packages/sungrow.yaml b/config/packages/sungrow.yaml index 6344592..499a70b 100644 --- a/config/packages/sungrow.yaml +++ b/config/packages/sungrow.yaml @@ -206,26 +206,42 @@ automation: above: 4900 for: minutes: 1 - - platform: numeric_state + - platform: state entity_id: - sensor.inverter_battery_level - sensor.inverter_active_power - sensor.home_weather_cloud_coverage - sensor.home_weather_forecast_cloud_coverage - sensor.solcast_forecast_remaining_today - - platform: state - entity_id: - - sensor.home_weather_forecast_condition - - sensor.home_weather_condition - - weather.home - - weather.home_hourly - - weather.home_weather + # - sensor.home_weather_forecast_condition + # - sensor.home_weather_condition + # - weather.home + - weather.home_hourly # can use attributes on this one to make decisions about the coming hours + # - weather.home_weather + - sun.sun # use `next_setting` attribute to ensure battery is online at least an hour before sunset + not_to: + - unavailable + - unknown variables: kwh_until_full: > - {{ 12.8 * (1.0/(100 - states('sensor.inverter_battery_level') | float)) }} - condition: - - "{{ }}" - action: [] + {{ 12.8 * ((100 - states('sensor.inverter_battery_level') | float)/100) }} + sunsetting: > + {{ now() + timedelta(hours = 1) > state_attr('sun.sun', 'next_setting')| as_datetime }} + should_slow_battery: > + {{ states('sensor.inverter_pv_power') | float > 5100 and + states('sensor.inverter_active_power') | float < 4200 }} + condition: [] + action: + - choose: + - conditions: + - "{{ should_slow_battery and not sunsetting and 2*kwh_until_full < states('sensor.solcast_forecast_remaining_today') | float }}" + sequence: + - service: script.inverter_force_battery_charge + - conditions: + - "{{ states('sensor.inverter_pv_power') | float < 4900 }}" + sequence: + - service: script.inverter_self_consumption + default: [] script: inverter_set_battery_reserve: @@ -602,7 +618,7 @@ modbus: device_class: power state_class: measurement scale: 1 - scan_interval: 1 + scan_interval: 5 - name: Inverter active power unique_id: a3ee41f78c6c55377c00 @@ -617,7 +633,7 @@ modbus: device_class: power state_class: measurement scale: 1 - scan_interval: 1 + scan_interval: 5 - name: Inverter reactive power unique_id: 5a58fe975877eec6d37c @@ -673,7 +689,7 @@ modbus: swap: word precision: 0 scale: 1 - scan_interval: 1 + scan_interval: 5 # Currently this only ever returns 0x00 over Modbus :/ - name: Inverter running state (raw) @@ -685,7 +701,7 @@ modbus: swap: word precision: 0 scale: 1 - scan_interval: 1 + scan_interval: 5 - name: Inverter PV generation today unique_id: 27953d57c315260a7983 @@ -760,7 +776,7 @@ modbus: device_class: power state_class: measurement scale: 1 - scan_interval: 1 + scan_interval: 5 - name: Inverter export power unique_id: 4c3bac29a87561796c06 @@ -775,7 +791,7 @@ modbus: device_class: power state_class: measurement scale: 1 - scan_interval: 1 + scan_interval: 5 - name: Inverter battery charge from PV today unique_id: d496459e40e0d49f5c11 @@ -868,7 +884,7 @@ modbus: device_class: current state_class: measurement scale: 0.1 - scan_interval: 1 + scan_interval: 5 - name: Inverter battery power (raw) unique_id: 4f7dacbf06d004b547d9 @@ -883,7 +899,7 @@ modbus: device_class: power state_class: measurement scale: 1 - scan_interval: 1 + scan_interval: 5 - name: Inverter battery level unique_id: 61e9d0508f0e75a3f25c diff --git a/config/zigbee2mqtt/state.json b/config/zigbee2mqtt/state.json index 999ff9a..bcd4c53 100644 --- a/config/zigbee2mqtt/state.json +++ b/config/zigbee2mqtt/state.json @@ -9,8 +9,8 @@ }, "0x00158d0008091c32": { "contact": false, - "voltage": 3005, - "battery": 44, + "voltage": 2995, + "battery": 41, "temperature": 19, "linkquality": 255, "device_temperature": 21, @@ -40,7 +40,7 @@ "battery": 50, "temperature": 12, "linkquality": 255, - "device_temperature": 17, + "device_temperature": 16, "power_outage_count": 13 }, "0x00158d0007e4c4f2": { @@ -49,11 +49,11 @@ "battery": 36, "temperature": 21, "linkquality": 255, - "device_temperature": 24, + "device_temperature": 23, "power_outage_count": 41 }, "0x5c0272fffee93bae": { - "occupancy": false, + "occupancy": true, "tamper": false, "battery_low": false, "linkquality": 255 @@ -67,11 +67,11 @@ "linkquality": 191 }, "0xa4c138fda4db2c5e": { - "occupancy": false, + "occupancy": true, "battery": 50, "sensitivity": "high", "keep_time": "120", - "illuminance": 802, + "illuminance": 826, "linkquality": 127 }, "0x84b4dbfffe850fda": { diff --git a/lovelace/lovelace.lovelace_solar.yaml b/lovelace/lovelace.lovelace_solar.yaml index 796f62c..1efbc03 100644 --- a/lovelace/lovelace.lovelace_solar.yaml +++ b/lovelace/lovelace.lovelace_solar.yaml @@ -477,6 +477,12 @@ config: secondary_info: last-triggered toggle: true type: custom:multiple-entity-row + - entity: automation.inverter_maximise_output + icon: mdi:arrow-up-box + name: Maximise output + secondary_info: last-triggered + toggle: true + type: custom:multiple-entity-row - entity: automation.update_pvoutput icon: mdi:solar-power-variant-outline name: Send to PVOutput @@ -494,6 +500,15 @@ config: - domain: script name: /[Ii]nverter/ type: custom:auto-entities + - entities: + battery: sensor.inverter_battery_power + battery_charge: sensor.inverter_battery_level + grid: sensor.inverter_grid_power_demand + solar: sensor.inverter_pv_power + kw_decimals: 2 + type: custom:power-flow-card + w_decimals: 0 + watt_threshold: 900 icon: mdi:wrench path: configure theme: Backend-selected