diff --git a/packages/integrations/energy/energy.yaml b/packages/integrations/energy/energy.yaml index 9e11a315..23a2f6b6 100644 --- a/packages/integrations/energy/energy.yaml +++ b/packages/integrations/energy/energy.yaml @@ -411,7 +411,8 @@ script: { 'estimate_charge_percentage': estimate_charge_percentage|round(2), 'estimate_charge_kwh': estimate_charge_kwh|round(2), - 'charge_hours': estimate_charge_hours|round(1), + 'charge_hours': estimate_charge_hours|round(2), + 'charge_hours_rounded': (estimate_charge_hours|round(0, 'ceil') * 2)/2, 'last_changed': ''~states.sensor.total_solar_forecast_estimated_energy_production_today.last_changed~'' } }} @@ -438,7 +439,8 @@ script: { 'estimate_charge_percentage': estimate_charge_percentage|round(2), 'estimate_charge_kwh': estimate_charge_kwh|round(2), - 'charge_hours': estimate_charge_hours|round(1), + 'charge_hours': estimate_charge_hours|round(2), + 'charge_hours_rounded': (estimate_charge_hours|round(0, 'ceil') * 2)/2, 'last_changed': ''~states.sensor.total_solar_forecast_estimated_energy_production_tomorrow.last_changed~'' } }} @@ -493,7 +495,8 @@ script: The last self sustaining generation of the day will be at {{ as_timestamp(get_last_solar_generation('sensor.solcast_pv_forecast_forecast_tomorrow', 'detailedForecast', 'period_start', 'pv_estimate', 0.7)|replace(' ', 'T'))|timestamp_custom('%H:%M:%S') }} - ({{ get_last_solar_generation('sensor.solcast_pv_forecast_forecast_tomorrow', 'detailedForecast', 'pv_estimate', 'pv_estimate', 0.7)|round(2) }} kWh) finishing at + ({{ get_last_solar_generation('sensor.solcast_pv_forecast_forecast_tomorrow', 'detailedForecast', 'pv_estimate', 'pv_estimate', 0.7)|round(2) }} kWh) + finishing at {{ as_timestamp(get_last_solar_generation('sensor.solcast_pv_forecast_forecast_tomorrow', 'detailedForecast', 'period_start', 'pv_estimate')|replace(' ', 'T'))|timestamp_custom('%H:%M:%S') }}. {%- endif -%} {%- if solar_forecast_data.estimate_charge_percentage != 23 %} @@ -502,7 +505,8 @@ script: Charge :house_with_garden::battery: battery to {{ solar_forecast_data.estimate_charge_percentage }}% ({{ solar_forecast_data.estimate_charge_kwh }}kWh). - Charge time is {{ (solar_forecast_data.charge_hours)|round(0, 'ceil') }} hours ({{ ((solar_forecast_data.charge_hours|round(0, 'ceil'))*2)|round(0) }} slots). + Charge time is {{ solar_forecast_data.charge_hours }} ({{ solar_forecast_data.charge_hours_rounded }}) hours + ({{ (solar_forecast_data.charge_hours_rounded*2) }} slots). {%- endif -%} title: ":sunny: :zap: Solar" people: diff --git a/packages/integrations/energy/solar_assistant.yaml b/packages/integrations/energy/solar_assistant.yaml index e6775fcd..4b795e98 100644 --- a/packages/integrations/energy/solar_assistant.yaml +++ b/packages/integrations/energy/solar_assistant.yaml @@ -563,35 +563,65 @@ script: - condition: template value_template: "{{ solar_forecast_data.charge_hours == 1 }}" - condition: state - entity_id: binary_sensor.octopus_energy_target_overnight_home_battery_charge_1_hours + entity_id: binary_sensor.octopus_energy_target_overnight_home_battery_charge_1_hour state: "on" - and: - condition: template - value_template: "{{ solar_forecast_data.charge_hours|round(0, 'ceil') == 2 }}" + value_template: "{{ solar_forecast_data.charge_hours_rounded == 1.5 }}" + - condition: state + entity_id: binary_sensor.octopus_energy_target_overnight_home_battery_charge_1_5_hours + state: "on" + - and: + - condition: template + value_template: "{{ solar_forecast_data.charge_hours_rounded == 2 }}" - condition: state entity_id: binary_sensor.octopus_energy_target_overnight_home_battery_charge_2_hours state: "on" - and: - condition: template - value_template: "{{ solar_forecast_data.charge_hours|round(0, 'ceil') == 3 }}" + value_template: "{{ solar_forecast_data.charge_hours_rounded == 2.5 }}" + - condition: state + entity_id: binary_sensor.octopus_energy_target_overnight_home_battery_charge_2_5_hours + state: "on" + - and: + - condition: template + value_template: "{{ solar_forecast_data.charge_hours_rounded == 3 }}" - condition: state entity_id: binary_sensor.octopus_energy_target_overnight_home_battery_charge_3_hours state: "on" - and: - condition: template - value_template: "{{ solar_forecast_data.charge_hours|round(0, 'ceil') == 4 }}" + value_template: "{{ solar_forecast_data.charge_hours_rounded == 3.5 }}" + - condition: state + entity_id: binary_sensor.octopus_energy_target_overnight_home_battery_charge_3_5_hours + state: "on" + - and: + - condition: template + value_template: "{{ solar_forecast_data.charge_hours_rounded == 4 }}" - condition: state entity_id: binary_sensor.octopus_energy_target_overnight_home_battery_charge_4_hours state: "on" - and: - condition: template - value_template: "{{ solar_forecast_data.charge_hours|round(0, 'ceil') == 5 }}" + value_template: "{{ solar_forecast_data.charge_hours_rounded == 4.5 }}" + - condition: state + entity_id: binary_sensor.octopus_energy_target_overnight_home_battery_charge_4_5_hours + state: "on" + - and: + - condition: template + value_template: "{{ solar_forecast_data.charge_hours_rounded == 5 }}" - condition: state entity_id: binary_sensor.octopus_energy_target_overnight_home_battery_charge_5_hours state: "on" - and: - condition: template - value_template: "{{ solar_forecast_data.charge_hours|round(0, 'ceil') == 6 }}" + value_template: "{{ solar_forecast_data.charge_hours_rounded == 5.5 }}" + - condition: state + entity_id: binary_sensor.octopus_energy_target_overnight_home_battery_charge_5_5_hours + state: "on" + - and: + - condition: template + value_template: "{{ solar_forecast_data.charge_hours_rounded == 6 }}" - condition: state entity_id: binary_sensor.octopus_energy_target_overnight_home_battery_charge_6_hours state: "on" @@ -606,37 +636,67 @@ script: - or: - and: - condition: template - value_template: "{{ solar_forecast_data.charge_hours|round(0, 'ceil') == 1 }}" + value_template: "{{ solar_forecast_data.charge_hours == 1 }}" - condition: state - entity_id: binary_sensor.octopus_energy_target_overnight_home_battery_charge_1_hours + entity_id: binary_sensor.octopus_energy_target_overnight_home_battery_charge_1_hour state: "on" - and: - condition: template - value_template: "{{ solar_forecast_data.charge_hours|round(0, 'ceil') == 2 }}" + value_template: "{{ solar_forecast_data.charge_hours_rounded == 1.5 }}" + - condition: state + entity_id: binary_sensor.octopus_energy_target_overnight_home_battery_charge_1_5_hours + state: "on" + - and: + - condition: template + value_template: "{{ solar_forecast_data.charge_hours_rounded == 2 }}" - condition: state entity_id: binary_sensor.octopus_energy_target_overnight_home_battery_charge_2_hours state: "on" - and: - condition: template - value_template: "{{ solar_forecast_data.charge_hours|round(0, 'ceil') == 3 }}" + value_template: "{{ solar_forecast_data.charge_hours_rounded == 2.5 }}" + - condition: state + entity_id: binary_sensor.octopus_energy_target_overnight_home_battery_charge_2_5_hours + state: "on" + - and: + - condition: template + value_template: "{{ solar_forecast_data.charge_hours_rounded == 3 }}" - condition: state entity_id: binary_sensor.octopus_energy_target_overnight_home_battery_charge_3_hours state: "on" - and: - condition: template - value_template: "{{ solar_forecast_data.charge_hours|round(0, 'ceil') == 4 }}" + value_template: "{{ solar_forecast_data.charge_hours_rounded == 3.5 }}" + - condition: state + entity_id: binary_sensor.octopus_energy_target_overnight_home_battery_charge_3_5_hours + state: "on" + - and: + - condition: template + value_template: "{{ solar_forecast_data.charge_hours_rounded == 4 }}" - condition: state entity_id: binary_sensor.octopus_energy_target_overnight_home_battery_charge_4_hours state: "on" - and: - condition: template - value_template: "{{ solar_forecast_data.charge_hours|round(0, 'ceil') == 5 }}" + value_template: "{{ solar_forecast_data.charge_hours_rounded == 4.5 }}" + - condition: state + entity_id: binary_sensor.octopus_energy_target_overnight_home_battery_charge_4_5_hours + state: "on" + - and: + - condition: template + value_template: "{{ solar_forecast_data.charge_hours_rounded == 5 }}" - condition: state entity_id: binary_sensor.octopus_energy_target_overnight_home_battery_charge_5_hours state: "on" - and: - condition: template - value_template: "{{ solar_forecast_data.charge_hours|round(0, 'ceil') == 6 }}" + value_template: "{{ solar_forecast_data.charge_hours_rounded == 5.5 }}" + - condition: state + entity_id: binary_sensor.octopus_energy_target_overnight_home_battery_charge_5_5_hours + state: "on" + - and: + - condition: template + value_template: "{{ solar_forecast_data.charge_hours_rounded == 6 }}" - condition: state entity_id: binary_sensor.octopus_energy_target_overnight_home_battery_charge_6_hours state: "on" @@ -650,7 +710,7 @@ script: data: message: >- Scheduled to charge - {{ solar_forecast_data.charge_hours }}({{ solar_forecast_data.charge_hours|round(0, 'ceil') }}) + {{ solar_forecast_data.charge_hours }}({{ solar_forecast_data.charge_hours_rounded }}) hour{{ iif(solar_forecast_data.charge_hours > 1,'s','') }} and inverter has not switched to battery first mode. title: Solar Assistant @@ -662,7 +722,7 @@ script: data: message: >- Scheduled to charge - {{ solar_forecast_data.charge_hours }}({{ solar_forecast_data.charge_hours|round(0, 'ceil') }}) + {{ solar_forecast_data.charge_hours }}({{ solar_forecast_data.charge_hours_rounded }}) hour{{ iif(solar_forecast_data.charge_hours > 1,'s','') }}. Charging house battery. title: Solar Assistant @@ -827,56 +887,56 @@ script: sensor: - platform: statistics - name: "Home Electricity Power Daily Average Over An Hour" + name: "Home Electricity Power Average Over An Hour" unique_id: 97f8c377-acd2-4d92-a2f2-6bbf5ca0b110 entity_id: sensor.growatt_sph_load_power state_characteristic: mean max_age: hours: 1 - platform: statistics - name: "Home Electricity Power Daily Average Over A Day" + name: "Home Electricity Power Average Over A Day" unique_id: 74b261eb-6feb-473d-87b4-8eca961be99d entity_id: sensor.growatt_sph_load_power state_characteristic: mean max_age: hours: 24 - platform: statistics - name: "Home Electricity Power Daily Average Over A Week" + name: "Home Electricity Power Average Over A Week" unique_id: 47f78be2-bea5-499c-926b-50b48f92f202 entity_id: sensor.growatt_sph_load_power state_characteristic: mean max_age: days: 7 - platform: statistics - name: "Home Electricity Power Daily Average Over A Month" + name: "Home Electricity Power Average Over A Month" unique_id: c0b7e702-5468-4cb1-8221-8067cf44c3e1 entity_id: sensor.growatt_sph_load_power state_characteristic: mean max_age: days: 30 - platform: statistics - name: "Home Electricity Power Daily Mean Over An Hour" + name: "Home Electricity Power Mean Over An Hour" unique_id: b9256d7e-504c-43e2-ac7d-f77ed5b69aaa entity_id: sensor.growatt_sph_load_power state_characteristic: median max_age: hours: 1 - platform: statistics - name: "Home Electricity Power Daily Mean Over A Day" + name: "Home Electricity Power Mean Over A Day" unique_id: 82ff2fd7-2694-4171-b0ec-3cafc52205cf entity_id: sensor.growatt_sph_load_power state_characteristic: median max_age: hours: 24 - platform: statistics - name: "Home Electricity Power Daily Mean Over A Week" + name: "Home Electricity Power Mean Over A Week" unique_id: fe221135-0a10-414b-8954-137ea83aa73f entity_id: sensor.growatt_sph_load_power state_characteristic: median max_age: days: 7 - platform: statistics - name: "Home Electricity Power Daily Mean Over A Month" + name: "Home Electricity Power Mean Over A Month" unique_id: 5891e92f-7bbc-4c51-941e-aa005fba93f9 entity_id: sensor.growatt_sph_load_power state_characteristic: median