Skip to content

Commit

Permalink
update deps
Browse files Browse the repository at this point in the history
  • Loading branch information
eifinger committed Mar 29, 2021
1 parent b34eb05 commit 7745df1
Show file tree
Hide file tree
Showing 32 changed files with 1,377 additions and 577 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/homeassistant-installed.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,6 @@ jobs:
- name: Create secrets.yaml
run: mv travis_secrets.yaml secrets.yaml
- name: Home Assistant Check Installed
uses: "docker://homeassistant/home-assistant:2021.3.3"
uses: "docker://homeassistant/home-assistant:2021.3.4"
with:
args: python -m homeassistant --config . --script check_config --info all
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@ version: '2.1'
services:
homeassistant:
container_name: homeassistant
image: homeassistant/home-assistant:2021.3.3
image: homeassistant/home-assistant:2021.3.4
volumes:
- /home/admin/homeassistant:/config
- /etc/localtime:/etc/localtime:ro
Expand Down
2 changes: 1 addition & 1 deletion custom_components/alexa_media/.translations/pt_BR.json
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@
"securitycode": "Código 2FA (recomendado para evitar problemas de login)",
"url": "Amazon region domain (e.g., amazon.co.uk)"
},
"description": "Please confirm the information below. For legacy configuration, disable `Use Login Proxy method` option.",
"description": "Por favor, confirme as informações abaixo. Para configuração legada, desative a opção `Usar método de proxy de login`.",
"title": "Alexa Media Player - Configuration"
}
}
Expand Down
11 changes: 6 additions & 5 deletions custom_components/alexa_media/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@
from homeassistant.data_entry_flow import UnknownFlow
from homeassistant.exceptions import Unauthorized
from homeassistant.helpers import config_validation as cv
from homeassistant.helpers.event import async_call_later
from homeassistant.helpers.network import get_url
from homeassistant.helpers.network import NoURLAvailableError, get_url
from homeassistant.util import slugify
import voluptuous as vol
from yarl import URL
Expand Down Expand Up @@ -186,6 +185,10 @@ async def async_step_import(self, import_config):
async def async_step_user(self, user_input=None):
"""Provide a proxy for login."""
self._save_user_input_to_config(user_input=user_input)
try:
hass_url: Text = get_url(self.hass, prefer_external=True)
except NoURLAvailableError:
hass_url = ""
self.proxy_schema = OrderedDict(
[
(
Expand All @@ -207,9 +210,7 @@ async def async_step_user(self, user_input=None):
(
vol.Required(
CONF_HASS_URL,
default=self.config.get(
CONF_HASS_URL, get_url(self.hass, prefer_external=True)
),
default=self.config.get(CONF_HASS_URL, hass_url),
),
str,
),
Expand Down
2 changes: 1 addition & 1 deletion custom_components/alexa_media/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"""
from datetime import timedelta

__version__ = "3.8.3"
__version__ = "3.8.5"
PROJECT_URL = "https://github.com/custom-components/alexa_media_player/"
ISSUE_URL = f"{PROJECT_URL}issues"

Expand Down
4 changes: 2 additions & 2 deletions custom_components/alexa_media/manifest.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"domain": "alexa_media",
"name": "Alexa Media Player",
"version": "3.8.3",
"version": "3.8.5",
"config_flow": true,
"documentation": "https://github.com/custom-components/alexa_media_player/wiki",
"issue_tracker": "https://github.com/custom-components/alexa_media_player/issues",
"dependencies": ["persistent_notification", "http"],
"codeowners": ["@keatontaylor", "@alandtse"],
"requirements": ["alexapy==1.24.3", "packaging~=20.3", "wrapt~=1.12.1"]
"requirements": ["alexapy==1.24.5", "packaging~=20.3", "wrapt~=1.12.1"]
}
2 changes: 1 addition & 1 deletion custom_components/alexa_media/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ def state(self) -> datetime.datetime:

def _process_state(self, value):
return (
value[self._sensor_property].replace(tzinfo=LOCAL_TIMEZONE).isoformat()
dt.as_local(value[self._sensor_property]).isoformat()
if value
else STATE_UNAVAILABLE
)
Expand Down
2 changes: 1 addition & 1 deletion custom_components/alexa_media/translations/pt_BR.json
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@
"securitycode": "Código 2FA (recomendado para evitar problemas de login)",
"url": "Amazon region domain (e.g., amazon.co.uk)"
},
"description": "Please confirm the information below. For legacy configuration, disable `Use Login Proxy method` option.",
"description": "Por favor, confirme as informações abaixo. Para configuração legada, desative a opção `Usar método de proxy de login`.",
"title": "Alexa Media Player - Configuration"
}
}
Expand Down
3 changes: 2 additions & 1 deletion custom_components/avanza_stock/const.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
"""Constants for avanza_stock."""
__version__ = "1.0.8"
__version__ = "1.0.9"

DEFAULT_NAME = "Avanza Stock"

CONF_STOCK = "stock"
CONF_SHARES = "shares"
CONF_PURCHASE_DATE = "purchase_date"
CONF_PURCHASE_PRICE = "purchase_price"
CONF_CONVERSION_CURRENCY = "conversion_currency"
CONF_INVERT_CONVERSION_CURRENCY = "invert_conversion_currency"
Expand Down
1 change: 1 addition & 0 deletions custom_components/avanza_stock/manifest.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"domain": "avanza_stock",
"name": "Avanza Stock",
"version": "1.0.9",
"documentation": "https://github.com/custom-components/sensor.avanza_stock",
"dependencies": [],
"codeowners": ["@claha"],
Expand Down
11 changes: 11 additions & 0 deletions custom_components/avanza_stock/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
CHANGE_PRICE_MAPPING,
CONF_CONVERSION_CURRENCY,
CONF_INVERT_CONVERSION_CURRENCY,
CONF_PURCHASE_DATE,
CONF_PURCHASE_PRICE,
CONF_SHARES,
CONF_STOCK,
Expand All @@ -47,6 +48,7 @@
vol.Required(CONF_ID): cv.positive_int,
vol.Optional(CONF_NAME): cv.string,
vol.Optional(CONF_SHARES): vol.Coerce(float),
vol.Optional(CONF_PURCHASE_DATE): cv.string,
vol.Optional(CONF_PURCHASE_PRICE): vol.Coerce(float),
vol.Optional(CONF_CONVERSION_CURRENCY): cv.positive_int,
vol.Optional(CONF_INVERT_CONVERSION_CURRENCY, default=False): cv.boolean,
Expand All @@ -61,6 +63,7 @@
),
vol.Optional(CONF_NAME): cv.string,
vol.Optional(CONF_SHARES): vol.Coerce(float),
vol.Optional(CONF_PURCHASE_DATE): cv.string,
vol.Optional(CONF_PURCHASE_PRICE): vol.Coerce(float),
vol.Optional(CONF_CONVERSION_CURRENCY): cv.positive_int,
vol.Optional(CONF_INVERT_CONVERSION_CURRENCY, default=False): cv.boolean,
Expand All @@ -81,6 +84,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
if isinstance(stock, int):
name = config.get(CONF_NAME)
shares = config.get(CONF_SHARES)
purchase_date = config.get(CONF_PURCHASE_DATE)
purchase_price = config.get(CONF_PURCHASE_PRICE)
conversion_currency = config.get(CONF_CONVERSION_CURRENCY)
invert_conversion_currency = config.get(CONF_INVERT_CONVERSION_CURRENCY)
Expand All @@ -93,6 +97,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
stock,
name,
shares,
purchase_date,
purchase_price,
conversion_currency,
invert_conversion_currency,
Expand All @@ -109,6 +114,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
if name is None:
name = DEFAULT_NAME + " " + str(id)
shares = s.get(CONF_SHARES)
purchase_date = s.get(CONF_PURCHASE_DATE)
purchase_price = s.get(CONF_PURCHASE_PRICE)
conversion_currency = s.get(CONF_CONVERSION_CURRENCY)
invert_conversion_currency = s.get(CONF_INVERT_CONVERSION_CURRENCY)
Expand All @@ -119,6 +125,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
id,
name,
shares,
purchase_date,
purchase_price,
conversion_currency,
invert_conversion_currency,
Expand All @@ -140,6 +147,7 @@ def __init__(
stock,
name,
shares,
purchase_date,
purchase_price,
conversion_currency,
invert_conversion_currency,
Expand All @@ -152,6 +160,7 @@ def __init__(
self._stock = stock
self._name = name
self._shares = shares
self._purchase_date = purchase_date
self._purchase_price = purchase_price
self._conversion_currency = conversion_currency
self._invert_conversion_currency = invert_conversion_currency
Expand Down Expand Up @@ -269,6 +278,8 @@ def _update_company(self, data, attr):
self._state_attributes[attr] = company.get(attr, None)

def _update_profit_loss(self, price):
if self._purchase_date is not None:
self._state_attributes["purchaseDate"] = self._purchase_date
if self._purchase_price is not None:
self._state_attributes["purchasePrice"] = self._purchase_price
self._state_attributes["profitLoss"] = round(
Expand Down
5 changes: 3 additions & 2 deletions custom_components/dwd_weather/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
latitude = entry.data[CONF_LATITUDE]
longitude = entry.data[CONF_LONGITUDE]
site_name = entry.data[CONF_NAME]
time_window = entry.data[CONF_WEATHER_INTERVAL]
weather_interval = entry.data[CONF_WEATHER_INTERVAL]
station_id = entry.data[CONF_STATION_ID]

dwd_weather_data = DWDWeatherData(
hass, latitude, longitude, station_id, time_window
hass, latitude, longitude, station_id, weather_interval
)

# Update data initially
Expand All @@ -64,6 +64,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
DWDWEATHER_DATA: dwd_weather_data,
DWDWEATHER_COORDINATOR: dwdweather_coordinator,
DWDWEATHER_NAME: site_name,
CONF_WEATHER_INTERVAL: weather_interval,
}

# Fetch initial data so we have data when entities subscribe
Expand Down
12 changes: 9 additions & 3 deletions custom_components/dwd_weather/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,10 @@ async def validate_input(hass: core.HomeAssistant, data):
if dwd_weather_data.dwd_weather.get_station_name(False) == "":
raise CannotConnect()

return {"site_name": dwd_weather_data.dwd_weather.get_station_name(False).title()}
return {
"site_name": dwd_weather_data.dwd_weather.get_station_name(False).title(),
"weather_interval": str(weather_interval),
}


class DWDWeatherConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
Expand Down Expand Up @@ -75,8 +78,11 @@ async def async_step_user(self, user_input=None):
_LOGGER.exception("Unexpected exception")
errors["base"] = "unknown"
else:
user_input[CONF_NAME] = info["site_name"]
await self.async_set_unique_id(f"{user_input[CONF_NAME].lower()}")
unique_id = info["site_name"].lower()
if info["weather_interval"] != "24":
unique_id += " " + info["weather_interval"] + "h"
user_input[CONF_NAME] = unique_id
await self.async_set_unique_id(unique_id)
self._abort_if_unique_id_configured()
return self.async_create_entry(
title=user_input[CONF_NAME].title(), data=user_input
Expand Down
22 changes: 11 additions & 11 deletions custom_components/dwd_weather/connector.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@


class DWDWeatherData:
def __init__(self, hass, latitude, longitude, station_id, time_window):
def __init__(self, hass, latitude, longitude, station_id, weather_interval):
"""Initialize the data object."""
self._hass = hass
self.forecast = None
Expand All @@ -33,7 +33,7 @@ def __init__(self, hass, latitude, longitude, station_id, time_window):
# Public attributes
self.latitude = latitude
self.longitude = longitude
self.time_window = time_window
self.weather_interval = weather_interval
self.infos = {}

# Checks if station_id was set by the user
Expand Down Expand Up @@ -76,15 +76,15 @@ def _update(self):
)
# Find the next timewindow from actual time
while timestep < timestamp:
timestep += timedelta(hours=self.time_window)
timestep += timedelta(hours=self.weather_interval)
# Reduce by one to include the current timewindow
timestep -= timedelta(hours=self.time_window)
timestep -= timedelta(hours=self.weather_interval)
for _ in range(0, 9):
for _ in range(int(24 / self.time_window)):
for _ in range(int(24 / self.weather_interval)):
temp_max = self.dwd_weather.get_timeframe_max(
dwdforecast.WeatherDataType.TEMPERATURE,
timestep,
self.time_window,
self.weather_interval,
False,
)
if temp_max is not None:
Expand All @@ -93,7 +93,7 @@ def _update(self):
temp_min = self.dwd_weather.get_timeframe_min(
dwdforecast.WeatherDataType.TEMPERATURE,
timestep,
self.time_window,
self.weather_interval,
False,
)
if temp_min is not None:
Expand All @@ -102,7 +102,7 @@ def _update(self):
precipitation_prop = self.dwd_weather.get_timeframe_max(
dwdforecast.WeatherDataType.PRECIPITATION_PROBABILITY,
timestep,
self.time_window,
self.weather_interval,
False,
)
if precipitation_prop is not None:
Expand All @@ -112,21 +112,21 @@ def _update(self):
ATTR_FORECAST_TIME: timestep.strftime("%Y-%m-%dT%H:00:00Z"),
ATTR_FORECAST_CONDITION: self.dwd_weather.get_timeframe_condition(
timestep,
self.time_window,
self.weather_interval,
False,
),
ATTR_FORECAST_TEMP: temp_max,
ATTR_FORECAST_TEMP_LOW: temp_min,
ATTR_FORECAST_PRECIPITATION: self.dwd_weather.get_timeframe_sum(
dwdforecast.WeatherDataType.PRECIPITATION,
timestep,
self.time_window,
self.weather_interval,
False,
),
"precipitation_probability": precipitation_prop, # ATTR_FORECAST_PRECIPITATION_PROBABILITY
}
)
timestep += timedelta(hours=self.time_window)
timestep += timedelta(hours=self.weather_interval)
self.forecast = forecast_data

def get_condition(self):
Expand Down
2 changes: 1 addition & 1 deletion custom_components/dwd_weather/manifest.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"domain": "dwd_weather",
"version": "1.2.3",
"version": "1.2.6",
"name": "Deutscher Wetterdienst (DWD)",
"documentation": "https://github.com/FL550/dwd_weather",
"issue_tracker": "https://github.com/FL550/dwd_weather/issues",
Expand Down
2 changes: 1 addition & 1 deletion custom_components/dwd_weather/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ def __init__(self, entry_data, hass_data, sensor_type):

self._type = sensor_type
self._name = f"{SENSOR_TYPES[self._type][0]} {hass_data[DWDWEATHER_NAME]}"
self._unique_id = f"{SENSOR_TYPES[self._type][0]}_{self._connector.dwd_weather.get_station_name(False).lower()}"
self._unique_id = f"{SENSOR_TYPES[self._type][0]}_{hass_data[DWDWEATHER_NAME]}"

@property
def name(self):
Expand Down
4 changes: 1 addition & 3 deletions custom_components/dwd_weather/weather.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,7 @@ def __init__(self, entry_data, hass_data):
self._coordinator = hass_data[DWDWEATHER_COORDINATOR]

self._name = f"{DEFAULT_NAME} {hass_data[DWDWEATHER_NAME]}"
self._unique_id = (
f"{self._connector.dwd_weather.get_station_name(False).lower()}"
)
self._unique_id = f"{hass_data[DWDWEATHER_NAME]}"

async def async_added_to_hass(self):
"""When entity is added to hass."""
Expand Down
3 changes: 0 additions & 3 deletions custom_components/philips_android_tv/__init__.py

This file was deleted.

8 changes: 0 additions & 8 deletions custom_components/philips_android_tv/manifest.json

This file was deleted.

Loading

0 comments on commit 7745df1

Please sign in to comment.