Skip to content

Commit

Permalink
Merge pull request #22 from StevenLooman/master
Browse files Browse the repository at this point in the history
Rewrite sensor to better suite current home assistant state
  • Loading branch information
gieljnssns authored Jul 20, 2021
2 parents eaeb08a + cce68a4 commit 70ad1d3
Show file tree
Hide file tree
Showing 5 changed files with 214 additions and 142 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__pycache__
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
### [v1.8](https://github.com/gieljnssns/buienalarm-sensor-homeassistant/compare/v1.7...v1.8) (2021-07-18)

### [v1.7](https://github.com/gieljnssns/buienalarm-sensor-homeassistant/compare/v1.6...v1.7) (2021-07-15)

### [v1.6](https://github.com/gieljnssns/buienalarm-sensor-homeassistant/compare/v1.5...v1.6) (2021-07-06)
Expand Down
55 changes: 55 additions & 0 deletions custom_components/buienalarm/const.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
"""Support for Buienalarm weather service."""

from datetime import timedelta
from typing import NamedTuple
import logging

from homeassistant.const import (
TEMP_CELSIUS,
LENGTH_MILLIMETERS,
TIME_MINUTES,
)

SensorType = NamedTuple(
"SensorType",
[
("name", str),
("unit", str),
("icon", str),
])


LOGGER = logging.getLogger(__package__)
UPDATE_INTERVAL = timedelta(seconds=300)
ATTRIBUTION = "Data provided by Buienalarm B.V."
DEFAULT_TIMEFRAME = 60
DEFAULT_NAME = "ba"
ITEM_TEMP = "temperature"
ITEM_PRECIP_NOW = "precipitation"
ITEM_PRECIP_FORECAST_AVG = "precipitation_forecast_average"
ITEM_PRECIP_FORECAST_TOTAL = "precipitation_forecast_total"
ITEM_NEXT_RAIN_FORECAST = "next_rain_forecast"
SENSOR_TYPES = {
ITEM_TEMP: SensorType(
"Temperature",
TEMP_CELSIUS,
"mdi:thermometer"),
ITEM_PRECIP_NOW: SensorType(
"Precipitation",
LENGTH_MILLIMETERS + "/h",
"mdi:weather-pouring"),
ITEM_PRECIP_FORECAST_AVG: SensorType(
"Precipitation forecast average",
LENGTH_MILLIMETERS + "/h",
"mdi:weather-pouring"),
ITEM_PRECIP_FORECAST_TOTAL: SensorType(
"Precipitation forecast total",
LENGTH_MILLIMETERS,
"mdi:weather-pouring"),
ITEM_NEXT_RAIN_FORECAST: SensorType(
"Next rain forecast",
TIME_MINUTES,
"mdi:weather-pouring"),
}
CONF_TIMEFRAME = "timeframe"
CONF_CONDITION_PRECIPITATION = "precipitation"
4 changes: 2 additions & 2 deletions custom_components/buienalarm/manifest.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"domain": "buienalarm",
"name": "Buienalarm",
"version": "1.7",
"version": "1.8",
"documentation": "https://github.com/gieljnssns/buienalarm-sensor-homeassistant/tree/master",
"requirements": ["pybuienalarm==0.0.10"],
"requirements": ["pybuienalarm==0.1.0"],
"dependencies": [],
"codeowners": ["@gieljnssns"]
}
Loading

0 comments on commit 70ad1d3

Please sign in to comment.