Skip to content

Instantly share code, notes, and snippets.

@eMerzh
Last active April 2, 2023 10:38
Show Gist options
  • Save eMerzh/f31500381a3a4baefa1ab8a52679eb44 to your computer and use it in GitHub Desktop.
Save eMerzh/f31500381a3a4baefa1ab8a52679eb44 to your computer and use it in GitHub Desktop.
Rain Estimate Sensor
sensor:
- platform: rest
# find your station on https://hydrometrie.wallonie.be/home/observations/precipitation.html?mode=map&station=DGH%2F2348
# here DGH%2F2348
resource_template: https://hydrometrie.wallonie.be/services/KiWIS/KiWIS?request=getTimeseriesValues&service=kisters&type=queryServices&datasource=0&format=json&maxquality=206&forceCacheHeaderTime=300&valuesasstring=false&ts_path=DGH%2F2348%2FPrecip%2FDay.Total&metadata=false&md_returnfields=ts_id%2C%20ts_path%2C%20ts_spacing%2C%20ts_name%2C%20ts_shortname%2C%20station_no%2C%20station_id%2C%20station_latitude%2C%20station_longitude%2C%20station_name%2C%20ts_unitname%2C%20ts_unitsymbol%2C%20stationparameter_name%2C%20ca_sta&from={{ today_at("00:00").isoformat() }}&returnfields=Timestamp%2CValue
name: "Hydrometrie Lillois"
scan_interval: 1800
unit_of_measurement: "mm"
device_class: "precipitation"
value_template: "{{ value_json[0]['data'][-1][1] }}"
template:
- sensor:
- name: "roof_rain"
unit_of_measurement: "L"
device_class: water
state_class: measurement
# More or less 70m2 of roofs
state: >
{{ states ('sensor.hydrometrie_lillois')|float(0) * 70 }}
utility_meter:
hourly_rain_in_tank:
source: sensor.roof_rain
cycle: hourly
daily_rain_in_tank:
source: sensor.roof_rain
cycle: daily
monthly_rain_in_tank:
source: sensor.roof_rain
cycle: monthly
quarterly_rain_in_tank:
source: sensor.roof_rain
cycle: quarterly
yearly_rain_in_tank:
source: sensor.roof_rain
cycle: yearly
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment