Merge pull request #35335 from home-assistant/rc

This commit is contained in:
Paulus Schoutsen 2020-05-07 12:33:52 -07:00 committed by GitHub
commit 4d314ba4df
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 41 additions and 13 deletions

View File

@ -66,7 +66,6 @@ SERVICE_HANDLERS = {
SERVICE_OCTOPRINT: ("octoprint", None), SERVICE_OCTOPRINT: ("octoprint", None),
SERVICE_FREEBOX: ("freebox", None), SERVICE_FREEBOX: ("freebox", None),
SERVICE_YEELIGHT: ("yeelight", None), SERVICE_YEELIGHT: ("yeelight", None),
"panasonic_viera": ("media_player", "panasonic_viera"),
"yamaha": ("media_player", "yamaha"), "yamaha": ("media_player", "yamaha"),
"logitech_mediaserver": ("media_player", "squeezebox"), "logitech_mediaserver": ("media_player", "squeezebox"),
"denonavr": ("media_player", "denonavr"), "denonavr": ("media_player", "denonavr"),

View File

@ -125,11 +125,11 @@ class IslamicPrayerClient:
""" """
_LOGGER.debug("Scheduling next update for Islamic prayer times") _LOGGER.debug("Scheduling next update for Islamic prayer times")
now = dt_util.as_local(dt_util.now()) now = dt_util.utcnow()
midnight_dt = self.prayer_times_info["Midnight"] midnight_dt = self.prayer_times_info["Midnight"]
if now > dt_util.as_local(midnight_dt): if now > dt_util.as_utc(midnight_dt):
next_update_at = midnight_dt + timedelta(days=1, minutes=1) next_update_at = midnight_dt + timedelta(days=1, minutes=1)
_LOGGER.debug( _LOGGER.debug(
"Midnight is after day the changes so schedule update for after Midnight the next day" "Midnight is after day the changes so schedule update for after Midnight the next day"

View File

@ -4,6 +4,7 @@ import logging
from homeassistant.const import DEVICE_CLASS_TIMESTAMP from homeassistant.const import DEVICE_CLASS_TIMESTAMP
from homeassistant.helpers.dispatcher import async_dispatcher_connect from homeassistant.helpers.dispatcher import async_dispatcher_connect
from homeassistant.helpers.entity import Entity from homeassistant.helpers.entity import Entity
import homeassistant.util.dt as dt_util
from .const import DATA_UPDATED, DOMAIN, PRAYER_TIMES_ICON, SENSOR_TYPES from .const import DATA_UPDATED, DOMAIN, PRAYER_TIMES_ICON, SENSOR_TYPES
@ -48,7 +49,11 @@ class IslamicPrayerTimeSensor(Entity):
@property @property
def state(self): def state(self):
"""Return the state of the sensor.""" """Return the state of the sensor."""
return self.client.prayer_times_info.get(self.sensor_type).isoformat() return (
self.client.prayer_times_info.get(self.sensor_type)
.astimezone(dt_util.UTC)
.isoformat()
)
@property @property
def should_poll(self): def should_poll(self):

View File

@ -2,7 +2,7 @@
"domain": "myq", "domain": "myq",
"name": "MyQ", "name": "MyQ",
"documentation": "https://www.home-assistant.io/integrations/myq", "documentation": "https://www.home-assistant.io/integrations/myq",
"requirements": ["pymyq==2.0.1"], "requirements": ["pymyq==2.0.2"],
"codeowners": ["@bdraco"], "codeowners": ["@bdraco"],
"config_flow": true, "config_flow": true,
"homekit": { "homekit": {

View File

@ -95,7 +95,6 @@ async def async_setup_entry(hass, config_entry):
continuous=config_entry.options[CONF_CONTINUOUS], continuous=config_entry.options[CONF_CONTINUOUS],
delay=config_entry.options[CONF_DELAY], delay=config_entry.options[CONF_DELAY],
) )
roomba.exclude = "wifistat" # ignore wifistat to avoid unnecessary updates
try: try:
if not await async_connect_or_timeout(hass, roomba): if not await async_connect_or_timeout(hass, roomba):

View File

@ -45,3 +45,7 @@ class RoombaBinStatus(IRobotEntity, BinarySensorDevice):
def state(self): def state(self):
"""Return the state of the sensor.""" """Return the state of the sensor."""
return roomba_reported_state(self.vacuum).get("bin", {}).get("full", False) return roomba_reported_state(self.vacuum).get("bin", {}).get("full", False)
def new_state_filter(self, new_state):
"""Filter the new state."""
return "bin" in new_state

View File

@ -102,8 +102,14 @@ class IRobotEntity(Entity):
"""Register callback function.""" """Register callback function."""
self.vacuum.register_on_message_callback(self.on_message) self.vacuum.register_on_message_callback(self.on_message)
def new_state_filter(self, new_state):
"""Filter the new state."""
raise NotImplementedError
def on_message(self, json_data): def on_message(self, json_data):
"""Update state on message change.""" """Update state on message change."""
state = json_data.get("state", {}).get("reported", {})
if self.new_state_filter(state):
self.schedule_update_ha_state() self.schedule_update_ha_state()
@ -212,6 +218,11 @@ class IRobotVacuum(IRobotEntity, StateVacuumDevice):
def on_message(self, json_data): def on_message(self, json_data):
"""Update state on message change.""" """Update state on message change."""
new_state = json_data.get("state", {}).get("reported", {})
if (
len(new_state) == 1 and "signal" in new_state
): # filter out wifi stat messages
return
_LOGGER.debug("Got new state from the vacuum: %s", json_data) _LOGGER.debug("Got new state from the vacuum: %s", json_data)
self.vacuum_state = roomba_reported_state(self.vacuum) self.vacuum_state = roomba_reported_state(self.vacuum)
self.schedule_update_ha_state() self.schedule_update_ha_state()

View File

@ -46,3 +46,7 @@ class RoombaBattery(IRobotEntity):
def state(self): def state(self):
"""Return the state of the sensor.""" """Return the state of the sensor."""
return roomba_reported_state(self.vacuum).get("batPct") return roomba_reported_state(self.vacuum).get("batPct")
def new_state_filter(self, new_state):
"""Filter the new state."""
return "batPct" in new_state

View File

@ -164,11 +164,15 @@ class SynologyDSMFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
discovery_info[ssdp.ATTR_UPNP_FRIENDLY_NAME].split("(", 1)[0].strip() discovery_info[ssdp.ATTR_UPNP_FRIENDLY_NAME].split("(", 1)[0].strip()
) )
mac = discovery_info[ssdp.ATTR_UPNP_SERIAL].upper()
# Synology NAS can broadcast on multiple IP addresses, since they can be connected to multiple ethernets. # Synology NAS can broadcast on multiple IP addresses, since they can be connected to multiple ethernets.
# The serial of the NAS is actually its MAC address. # The serial of the NAS is actually its MAC address.
if self._mac_already_configured(discovery_info[ssdp.ATTR_UPNP_SERIAL].upper()): if self._mac_already_configured(mac):
return self.async_abort(reason="already_configured") return self.async_abort(reason="already_configured")
await self.async_set_unique_id(mac)
self._abort_if_unique_id_configured()
self.discovered_conf = { self.discovered_conf = {
CONF_NAME: friendly_name, CONF_NAME: friendly_name,
CONF_HOST: parsed_url.hostname, CONF_HOST: parsed_url.hostname,

View File

@ -1,7 +1,7 @@
"""Constants used by Home Assistant components.""" """Constants used by Home Assistant components."""
MAJOR_VERSION = 0 MAJOR_VERSION = 0
MINOR_VERSION = 109 MINOR_VERSION = 109
PATCH_VERSION = "5" PATCH_VERSION = "6"
__short_version__ = f"{MAJOR_VERSION}.{MINOR_VERSION}" __short_version__ = f"{MAJOR_VERSION}.{MINOR_VERSION}"
__version__ = f"{__short_version__}.{PATCH_VERSION}" __version__ = f"{__short_version__}.{PATCH_VERSION}"
REQUIRED_PYTHON_VER = (3, 7, 0) REQUIRED_PYTHON_VER = (3, 7, 0)

View File

@ -1429,7 +1429,7 @@ pymsteams==0.1.12
pymusiccast==0.1.6 pymusiccast==0.1.6
# homeassistant.components.myq # homeassistant.components.myq
pymyq==2.0.1 pymyq==2.0.2
# homeassistant.components.mysensors # homeassistant.components.mysensors
pymysensors==0.18.0 pymysensors==0.18.0

View File

@ -579,7 +579,7 @@ pymodbus==2.3.0
pymonoprice==0.3 pymonoprice==0.3
# homeassistant.components.myq # homeassistant.components.myq
pymyq==2.0.1 pymyq==2.0.2
# homeassistant.components.nut # homeassistant.components.nut
pynut2==2.1.2 pynut2==2.1.2

View File

@ -42,4 +42,4 @@ NEW_PRAYER_TIMES_TIMESTAMPS = {
"Midnight": datetime(2020, 1, 1, 00, 43, 0), "Midnight": datetime(2020, 1, 1, 00, 43, 0),
} }
NOW = datetime(2020, 1, 1, 00, 00, 0) NOW = datetime(2020, 1, 1, 00, 00, 0).astimezone()

View File

@ -2,6 +2,7 @@
from unittest.mock import patch from unittest.mock import patch
from homeassistant.components import islamic_prayer_times from homeassistant.components import islamic_prayer_times
import homeassistant.util.dt as dt_util
from . import NOW, PRAYER_TIMES, PRAYER_TIMES_TIMESTAMPS from . import NOW, PRAYER_TIMES, PRAYER_TIMES_TIMESTAMPS
@ -26,5 +27,5 @@ async def test_islamic_prayer_times_sensors(hass):
hass.states.get( hass.states.get(
f"sensor.{prayer}_{islamic_prayer_times.const.SENSOR_TYPES[prayer]}" f"sensor.{prayer}_{islamic_prayer_times.const.SENSOR_TYPES[prayer]}"
).state ).state
== PRAYER_TIMES_TIMESTAMPS[prayer].isoformat() == PRAYER_TIMES_TIMESTAMPS[prayer].astimezone(dt_util.UTC).isoformat()
) )

View File

@ -383,6 +383,7 @@ async def test_form_ssdp(hass: HomeAssistantType, service: MagicMock):
) )
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
assert result["result"].unique_id == SERIAL
assert result["title"] == "192.168.1.5" assert result["title"] == "192.168.1.5"
assert result["data"][CONF_HOST] == "192.168.1.5" assert result["data"][CONF_HOST] == "192.168.1.5"
assert result["data"][CONF_PORT] == 5001 assert result["data"][CONF_PORT] == 5001