Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- template:
- #########
- - sensor:
- - name: "Excess solar" # Not strictly EXCESS - It's a guess, shows what solar is producing when nothing coming from the grid
- unique_id: excess_solar
- unit_of_measurement: "W"
- device_class: energy
- state: > # if solar is > 0 and house = 0 then publish solar else publish 0
- {% if (states('sensor.solarman_output_active_power') != 'unknown')
- and (int(states('sensor.solarman_output_active_power')) > 0)
- and (int(states('sensor.house_power_consumption')) == 0) %}
- {{ states('sensor.solarman_output_active_power') }}
- {% else %}
- 0
- {% endif %}
- - name: "Weather factor"
- unique_id: weather_factor # Factor for water time multiplier.
- state: >
- {% set ref_temp = 20 %}
- {% set ref_rain = 10 %}
- {% set temp_factor = 5 * ((((float(states('sensor.marybrook_temp_max_0'))) - ref_temp)) / 100) %}
- {% set target_rain = ref_rain * (1 + temp_factor) %}
- {% set likely_rain = float(states('sensor.marybrook_rain_chance_0'))/100 *
- float(states('sensor.marybrook_rain_amount_min_0')) %}
- {% if likely_rain < float(states('sensor.ibusse56_precipitation_today')) %}
- {% set likely_rain = float(states('sensor.ibusse56_precipitation_today')) %}
- {% endif %}
- {% if likely_rain >= target_rain %}
- {% set weather_factor = 0 %}
- {% else %}
- {% set weather_factor = float((target_rain - likely_rain) / ref_rain) %}
- {% endif %}
- {% if weather_factor == 'unavailable' %}
- {% set weather_factor = 1 %}
- {% endif %}
- {{ weather_factor }}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement