Skip to content

Commit

Permalink
Merge pull request #35335 from home-assistant/rc
Browse files Browse the repository at this point in the history
  • Loading branch information
balloob committed May 7, 2020
2 parents ef489aa + 97d66c4 commit 4d314ba
Show file tree
Hide file tree
Showing 15 changed files with 41 additions and 13 deletions.
1 change: 0 additions & 1 deletion homeassistant/components/discovery/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@
SERVICE_OCTOPRINT: ("octoprint", None),
SERVICE_FREEBOX: ("freebox", None),
SERVICE_YEELIGHT: ("yeelight", None),
"panasonic_viera": ("media_player", "panasonic_viera"),
"yamaha": ("media_player", "yamaha"),
"logitech_mediaserver": ("media_player", "squeezebox"),
"denonavr": ("media_player", "denonavr"),
Expand Down
4 changes: 2 additions & 2 deletions homeassistant/components/islamic_prayer_times/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,11 +125,11 @@ async def async_schedule_future_update(self):
"""
_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"]

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)
_LOGGER.debug(
"Midnight is after day the changes so schedule update for after Midnight the next day"
Expand Down
7 changes: 6 additions & 1 deletion homeassistant/components/islamic_prayer_times/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from homeassistant.const import DEVICE_CLASS_TIMESTAMP
from homeassistant.helpers.dispatcher import async_dispatcher_connect
from homeassistant.helpers.entity import Entity
import homeassistant.util.dt as dt_util

from .const import DATA_UPDATED, DOMAIN, PRAYER_TIMES_ICON, SENSOR_TYPES

Expand Down Expand Up @@ -48,7 +49,11 @@ def icon(self):
@property
def state(self):
"""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
def should_poll(self):
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/myq/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"domain": "myq",
"name": "MyQ",
"documentation": "https://www.home-assistant.io/integrations/myq",
"requirements": ["pymyq==2.0.1"],
"requirements": ["pymyq==2.0.2"],
"codeowners": ["@bdraco"],
"config_flow": true,
"homekit": {
Expand Down
1 change: 0 additions & 1 deletion homeassistant/components/roomba/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ async def async_setup_entry(hass, config_entry):
continuous=config_entry.options[CONF_CONTINUOUS],
delay=config_entry.options[CONF_DELAY],
)
roomba.exclude = "wifistat" # ignore wifistat to avoid unnecessary updates

try:
if not await async_connect_or_timeout(hass, roomba):
Expand Down
4 changes: 4 additions & 0 deletions homeassistant/components/roomba/binary_sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,7 @@ def icon(self):
def state(self):
"""Return the state of the sensor."""
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
13 changes: 12 additions & 1 deletion homeassistant/components/roomba/irobot_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,15 @@ async def async_added_to_hass(self):
"""Register callback function."""
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):
"""Update state on message change."""
self.schedule_update_ha_state()
state = json_data.get("state", {}).get("reported", {})
if self.new_state_filter(state):
self.schedule_update_ha_state()


class IRobotVacuum(IRobotEntity, StateVacuumDevice):
Expand Down Expand Up @@ -212,6 +218,11 @@ def device_state_attributes(self):

def on_message(self, json_data):
"""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)
self.vacuum_state = roomba_reported_state(self.vacuum)
self.schedule_update_ha_state()
Expand Down
4 changes: 4 additions & 0 deletions homeassistant/components/roomba/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,7 @@ def unit_of_measurement(self):
def state(self):
"""Return the state of the sensor."""
return roomba_reported_state(self.vacuum).get("batPct")

def new_state_filter(self, new_state):
"""Filter the new state."""
return "batPct" in new_state
6 changes: 5 additions & 1 deletion homeassistant/components/synology_dsm/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,11 +164,15 @@ async def async_step_ssdp(self, discovery_info):
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.
# 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")

await self.async_set_unique_id(mac)
self._abort_if_unique_id_configured()

self.discovered_conf = {
CONF_NAME: friendly_name,
CONF_HOST: parsed_url.hostname,
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/const.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""Constants used by Home Assistant components."""
MAJOR_VERSION = 0
MINOR_VERSION = 109
PATCH_VERSION = "5"
PATCH_VERSION = "6"
__short_version__ = f"{MAJOR_VERSION}.{MINOR_VERSION}"
__version__ = f"{__short_version__}.{PATCH_VERSION}"
REQUIRED_PYTHON_VER = (3, 7, 0)
Expand Down
2 changes: 1 addition & 1 deletion requirements_all.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1429,7 +1429,7 @@ pymsteams==0.1.12
pymusiccast==0.1.6

# homeassistant.components.myq
pymyq==2.0.1
pymyq==2.0.2

# homeassistant.components.mysensors
pymysensors==0.18.0
Expand Down
2 changes: 1 addition & 1 deletion requirements_test_all.txt
Original file line number Diff line number Diff line change
Expand Up @@ -579,7 +579,7 @@ pymodbus==2.3.0
pymonoprice==0.3

# homeassistant.components.myq
pymyq==2.0.1
pymyq==2.0.2

# homeassistant.components.nut
pynut2==2.1.2
Expand Down
2 changes: 1 addition & 1 deletion tests/components/islamic_prayer_times/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,4 @@
"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()
3 changes: 2 additions & 1 deletion tests/components/islamic_prayer_times/test_sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from unittest.mock import patch

from homeassistant.components import islamic_prayer_times
import homeassistant.util.dt as dt_util

from . import NOW, PRAYER_TIMES, PRAYER_TIMES_TIMESTAMPS

Expand All @@ -26,5 +27,5 @@ async def test_islamic_prayer_times_sensors(hass):
hass.states.get(
f"sensor.{prayer}_{islamic_prayer_times.const.SENSOR_TYPES[prayer]}"
).state
== PRAYER_TIMES_TIMESTAMPS[prayer].isoformat()
== PRAYER_TIMES_TIMESTAMPS[prayer].astimezone(dt_util.UTC).isoformat()
)
1 change: 1 addition & 0 deletions tests/components/synology_dsm/test_config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -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["result"].unique_id == SERIAL
assert result["title"] == "192.168.1.5"
assert result["data"][CONF_HOST] == "192.168.1.5"
assert result["data"][CONF_PORT] == 5001
Expand Down

0 comments on commit 4d314ba

Please sign in to comment.