aex351 / home-assistant-neerslag-card

Display Buienalarm and/or Buienradar data in a graph for Home Assistant.
29 stars 3 forks source link
home-assistant

hacs_badge

Neerslag Card

Recommendation: Use the Neerslag App or migrate from the Neerslag Card to the Neerslag App (all-one-package: sensors + card). The Neerslag App is part of the default HACS repository.

Display rain forecast using Buienalarm and/or Buienradar sensor data.

The graph will auto-scale (auto-zoom) depending on the amount of rain. You can interact with the graph to see how much rain will fall on a specific moment. This card is fully functional on both mobile as well as desktop.

Features

Example

Installation overview

The Neerslag card installation consists out of three actions: 1) Install via HACS or manual; 2) Configuring the Buienalarm and/or Buienradar custom sensor via configuration.yaml 3) Adding the the Neerslag Card to your dashboard

Note: Home Assistant requires a restart after making changes in: configuration.yaml.

1a. Install via HACS (recommended)

This is the recommended option and also allows for easy updates. 1) Find this repository in HACS; 2) Add the Neerslag Card in the Home Assistant Community Store as front-end plugin.

For updates go to the Community Store (HACS) and click update

1b. Manual install (with HACS installed)

Not recommended, you will need to track updates manually by browsing to the repository; 1) Download the latest release of the Neerslag Card from this repository; 2) In Home Assistant, create the folder config/www/community if it does not exist; 3) Add the Neerslag Card to the community folder. (i.e. community/neerslag-card/); 4) Add the Neerslag Card as a resource in Home Assistant (config/lovelace/resources); 5) Using the following details as resource: /hacsfiles/neerslag-card/neerslag-card.js as Javascript module.

For updates: repeat step 1 to 3. Home Assistant will not delete any settings.

2. Setup Buienalarm and/or Buienradar custom sensor

Buienalarm sensor configuration

Add the following to configuration.yaml:

sensor:
  - platform: command_line
    command: python3 -c "import requests; import json; import random; dataRequest = requests.get('https://cdn-secure.buienalarm.nl/api/3.4/forecast.php?lat=<lat-3-decimals>&lon=<lon-3-decimals>&region=nl&c='+str(random.randint(0,999999999999999)) ).text; dataRequest = dataRequest.replace('\r\n',' '); data = '{\"data\":'+dataRequest+'}';    print(data);"
    name: Neerslag_Buienalarm_Regen_Data
    json_attributes:
      - data
    value_template: 'last_changed: {{states.sensor.neerslag_buienalarm_regen_data.last_changed | default(now())}}'
    scan_interval: 240

Configuration options:

Using one sensor:

type: 'custom:neerslag-card'
title: Neerslag
entity: sensor.neerslag_buienalarm_regen_data

Using two sensors:

type: 'custom:neerslag-card'
title: Neerslag
entities:
  - sensor.neerslag_buienalarm_regen_data
  - sensor.neerslag_buienradar_regen_data

Advanced configuration options:

Enable auto zoom to have the graph dynamically zoom in or out depending on the amount of rainfall.

Note: By default auto zoom is disabled. Which gives the graph a fixed starting position displaying low, medium and heavy rainfall. Auto zoom will continue on extreme rainfall. Before version 2022.07.07.1 this setting was set to true.

autozoom: false