Skip to content
Merged

2022.5.4 #71747

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
2293045
Fix timezone issue on onvif integration (#70473)
marvinroger May 12, 2022
4a54425
Fix Insteon issue with dimmer default on level (#71426)
teharris1 May 9, 2022
b213f22
Migrate sabnzbd sensors unique ids (#71455)
shaiu May 9, 2022
6c70a51
Bump simplisafe-python to 2022.05.1 (#71545)
bachya May 8, 2022
18d440c
Fix SABnzbd config check (#71549)
shaiu May 9, 2022
2caa92b
Fix typer/click incompatibilty for unifiprotect (#71555)
AngellusMortis May 9, 2022
4b28d52
Improve Google Cast detection of HLS playlists (#71564)
emontnemery May 9, 2022
0099560
Correct device class for meater cook sensors (#71565)
emontnemery May 9, 2022
8f5677f
Bump pychromecast to 12.1.2 (#71567)
emontnemery May 9, 2022
596039f
Bump logi_circle to 0.2.3 (#71578)
evanjd May 9, 2022
cd69b57
Bump nam backend library to version 1.2.4 (#71584)
bieniu May 9, 2022
fabea6a
Bump pydeconz to v92 (#71613)
Kane610 May 9, 2022
aa30122
Fix wrong brightness level change visible in UI (#71655)
rappenze May 10, 2022
1f53786
Prevent history_stats from rejecting states when microseconds differ …
bdraco May 12, 2022
a19a88d
Fix zwave_js device automation bug (#71715)
raman325 May 12, 2022
c9543d8
Bumped version to 2022.5.4
balloob May 12, 2022
316bfc8
Fix merge conflict with master to dev in sabnzbd (CI fix) (#71605)
bdraco May 9, 2022
2500cc6
Add use_wallclock_as_timestamps option to generic (#71245)
uvjustin May 12, 2022
f65eca9
Changed API for Ukraine Alarm (#71754)
PaulAnnekov May 12, 2022
99c5070
Add missing cast test fixture (#71595)
emontnemery May 9, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions homeassistant/components/cast/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,12 +237,14 @@ def _is_url(url):
return all([result.scheme, result.netloc])


async def _fetch_playlist(hass, url):
async def _fetch_playlist(hass, url, supported_content_types):
"""Fetch a playlist from the given url."""
try:
session = aiohttp_client.async_get_clientsession(hass, verify_ssl=False)
async with session.get(url, timeout=5) as resp:
charset = resp.charset or "utf-8"
if resp.content_type in supported_content_types:
raise PlaylistSupported
try:
playlist_data = (await resp.content.read(64 * 1024)).decode(charset)
except ValueError as err:
Expand All @@ -260,7 +262,16 @@ async def parse_m3u(hass, url):

Based on https://github.com/dvndrsn/M3uParser/blob/master/m3uparser.py
"""
m3u_data = await _fetch_playlist(hass, url)
# From Mozilla gecko source: https://github.com/mozilla/gecko-dev/blob/c4c1adbae87bf2d128c39832d72498550ee1b4b8/dom/media/DecoderTraits.cpp#L47-L52
hls_content_types = (
# https://tools.ietf.org/html/draft-pantos-http-live-streaming-19#section-10
"application/vnd.apple.mpegurl",
# Some sites serve these as the informal HLS m3u type.
"application/x-mpegurl",
"audio/mpegurl",
"audio/x-mpegurl",
)
m3u_data = await _fetch_playlist(hass, url, hls_content_types)
m3u_lines = m3u_data.splitlines()

playlist = []
Expand Down Expand Up @@ -301,7 +312,7 @@ async def parse_pls(hass, url):

Based on https://github.com/mariob/plsparser/blob/master/src/plsparser.py
"""
pls_data = await _fetch_playlist(hass, url)
pls_data = await _fetch_playlist(hass, url, ())

pls_parser = configparser.ConfigParser()
try:
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/cast/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"name": "Google Cast",
"config_flow": true,
"documentation": "https://www.home-assistant.io/integrations/cast",
"requirements": ["pychromecast==12.1.1"],
"requirements": ["pychromecast==12.1.2"],
"after_dependencies": [
"cloud",
"http",
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/deconz/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"name": "deCONZ",
"config_flow": true,
"documentation": "https://www.home-assistant.io/integrations/deconz",
"requirements": ["pydeconz==91"],
"requirements": ["pydeconz==92"],
"ssdp": [
{
"manufacturer": "Royal Philips Electronics",
Expand Down
1 change: 1 addition & 0 deletions homeassistant/components/fibaro/light.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ def _turn_on(self, **kwargs):
if ATTR_BRIGHTNESS in kwargs:
self._attr_brightness = kwargs[ATTR_BRIGHTNESS]
self.set_level(scaleto99(self._attr_brightness))
return

if ATTR_RGB_COLOR in kwargs:
# Update based on parameters
Expand Down
5 changes: 5 additions & 0 deletions homeassistant/components/generic/camera.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
CONF_RTSP_TRANSPORT,
CONF_STILL_IMAGE_URL,
CONF_STREAM_SOURCE,
CONF_USE_WALLCLOCK_AS_TIMESTAMPS,
DEFAULT_NAME,
FFMPEG_OPTION_MAP,
GET_IMAGE_TIMEOUT,
Expand Down Expand Up @@ -160,6 +161,10 @@ def __init__(self, hass, device_info, identifier, title):
CONF_RTSP_TRANSPORT
]
self._auth = generate_auth(device_info)
if device_info.get(CONF_USE_WALLCLOCK_AS_TIMESTAMPS):
self.stream_options[
FFMPEG_OPTION_MAP[CONF_USE_WALLCLOCK_AS_TIMESTAMPS]
] = "1"

self._last_url = None
self._last_image = None
Expand Down
20 changes: 19 additions & 1 deletion homeassistant/components/generic/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
CONF_RTSP_TRANSPORT,
CONF_STILL_IMAGE_URL,
CONF_STREAM_SOURCE,
CONF_USE_WALLCLOCK_AS_TIMESTAMPS,
DEFAULT_NAME,
DOMAIN,
FFMPEG_OPTION_MAP,
Expand All @@ -64,6 +65,7 @@
def build_schema(
user_input: dict[str, Any] | MappingProxyType[str, Any],
is_options_flow: bool = False,
show_advanced_options=False,
):
"""Create schema for camera config setup."""
spec = {
Expand Down Expand Up @@ -106,6 +108,13 @@ def build_schema(
default=user_input.get(CONF_LIMIT_REFETCH_TO_URL_CHANGE, False),
)
] = bool
if show_advanced_options:
spec[
vol.Required(
CONF_USE_WALLCLOCK_AS_TIMESTAMPS,
default=user_input.get(CONF_USE_WALLCLOCK_AS_TIMESTAMPS, False),
)
] = bool
return vol.Schema(spec)


Expand Down Expand Up @@ -199,6 +208,8 @@ async def async_test_stream(hass, info) -> dict[str, str]:
}
if rtsp_transport := info.get(CONF_RTSP_TRANSPORT):
stream_options[FFMPEG_OPTION_MAP[CONF_RTSP_TRANSPORT]] = rtsp_transport
if info.get(CONF_USE_WALLCLOCK_AS_TIMESTAMPS):
stream_options[FFMPEG_OPTION_MAP[CONF_USE_WALLCLOCK_AS_TIMESTAMPS]] = "1"
_LOGGER.debug("Attempting to open stream %s", stream_source)
container = await hass.async_add_executor_job(
partial(
Expand Down Expand Up @@ -356,13 +367,20 @@ async def async_step_init(
],
CONF_FRAMERATE: user_input[CONF_FRAMERATE],
CONF_VERIFY_SSL: user_input[CONF_VERIFY_SSL],
CONF_USE_WALLCLOCK_AS_TIMESTAMPS: user_input.get(
CONF_USE_WALLCLOCK_AS_TIMESTAMPS
),
}
return self.async_create_entry(
title=title,
data=data,
)
return self.async_show_form(
step_id="init",
data_schema=build_schema(user_input or self.config_entry.options, True),
data_schema=build_schema(
user_input or self.config_entry.options,
True,
self.show_advanced_options,
),
errors=errors,
)
6 changes: 5 additions & 1 deletion homeassistant/components/generic/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@
CONF_STREAM_SOURCE = "stream_source"
CONF_FRAMERATE = "framerate"
CONF_RTSP_TRANSPORT = "rtsp_transport"
FFMPEG_OPTION_MAP = {CONF_RTSP_TRANSPORT: "rtsp_transport"}
CONF_USE_WALLCLOCK_AS_TIMESTAMPS = "use_wallclock_as_timestamps"
FFMPEG_OPTION_MAP = {
CONF_RTSP_TRANSPORT: "rtsp_transport",
CONF_USE_WALLCLOCK_AS_TIMESTAMPS: "use_wallclock_as_timestamps",
}
RTSP_TRANSPORTS = {
"tcp": "TCP",
"udp": "UDP",
Expand Down
4 changes: 4 additions & 0 deletions homeassistant/components/generic/strings.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,13 @@
"authentication": "[%key:component::generic::config::step::user::data::authentication%]",
"limit_refetch_to_url_change": "[%key:component::generic::config::step::user::data::limit_refetch_to_url_change%]",
"password": "[%key:common::config_flow::data::password%]",
"use_wallclock_as_timestamps": "Use wallclock as timestamps",
"username": "[%key:common::config_flow::data::username%]",
"framerate": "[%key:component::generic::config::step::user::data::framerate%]",
"verify_ssl": "[%key:common::config_flow::data::verify_ssl%]"
},
"data_description": {
"use_wallclock_as_timestamps": "This option may correct segmenting or crashing issues arising from buggy timestamp implementations on some cameras"
}
},
"content_type": {
Expand Down
6 changes: 4 additions & 2 deletions homeassistant/components/generic/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
"user": {
"data": {
"authentication": "Authentication",
"content_type": "Content Type",
"framerate": "Frame Rate (Hz)",
"limit_refetch_to_url_change": "Limit refetch to url change",
"password": "Password",
Expand Down Expand Up @@ -72,15 +71,18 @@
"init": {
"data": {
"authentication": "Authentication",
"content_type": "Content Type",
"framerate": "Frame Rate (Hz)",
"limit_refetch_to_url_change": "Limit refetch to url change",
"password": "Password",
"rtsp_transport": "RTSP transport protocol",
"still_image_url": "Still Image URL (e.g. http://...)",
"stream_source": "Stream Source URL (e.g. rtsp://...)",
"use_wallclock_as_timestamps": "Use wallclock as timestamps",
"username": "Username",
"verify_ssl": "Verify SSL certificate"
},
"data_description": {
"use_wallclock_as_timestamps": "This option may correct segmenting or crashing issues arising from buggy timestamp implementations on some cameras"
}
}
}
Expand Down
6 changes: 5 additions & 1 deletion homeassistant/components/history_stats/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,11 @@ async def async_update(self, event: Event | None) -> HistoryStatsState:
new_data = False
if event and event.data["new_state"] is not None:
new_state: State = event.data["new_state"]
if current_period_start <= new_state.last_changed <= current_period_end:
if (
current_period_start_timestamp
<= floored_timestamp(new_state.last_changed)
<= current_period_end_timestamp
):
self._history_current_period.append(new_state)
new_data = True
if not new_data and current_period_end_timestamp < now_timestamp:
Expand Down
5 changes: 2 additions & 3 deletions homeassistant/components/insteon/insteon_entity.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,10 +153,9 @@ def _print_aldb(self):

def get_device_property(self, name: str):
"""Get a single Insteon device property value (raw)."""
value = None
if (prop := self._insteon_device.properties.get(name)) is not None:
value = prop.value if prop.new_value is None else prop.new_value
return value
return prop.value
return None

def _get_label(self):
"""Get the device label for grouped devices."""
Expand Down
4 changes: 2 additions & 2 deletions homeassistant/components/insteon/light.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@ async def async_turn_on(self, **kwargs):
"""Turn light on."""
if ATTR_BRIGHTNESS in kwargs:
brightness = int(kwargs[ATTR_BRIGHTNESS])
else:
elif self._insteon_device_group.group == 1:
brightness = self.get_device_property(ON_LEVEL)
if brightness is not None:
if brightness:
await self._insteon_device.async_on(
on_level=brightness, group=self._insteon_device_group.group
)
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/logi_circle/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"name": "Logi Circle",
"config_flow": true,
"documentation": "https://www.home-assistant.io/integrations/logi_circle",
"requirements": ["logi_circle==0.2.2"],
"requirements": ["logi_circle==0.2.3"],
"dependencies": ["ffmpeg", "http"],
"codeowners": ["@evanjd"],
"iot_class": "cloud_polling",
Expand Down
2 changes: 0 additions & 2 deletions homeassistant/components/meater/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,6 @@ class MeaterProbeTemperature(
):
"""Meater Temperature Sensor Entity."""

_attr_device_class = SensorDeviceClass.TEMPERATURE
_attr_native_unit_of_measurement = TEMP_CELSIUS
entity_description: MeaterSensorEntityDescription

def __init__(
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/nam/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"name": "Nettigo Air Monitor",
"documentation": "https://www.home-assistant.io/integrations/nam",
"codeowners": ["@bieniu"],
"requirements": ["nettigo-air-monitor==1.2.3"],
"requirements": ["nettigo-air-monitor==1.2.4"],
"zeroconf": [
{
"type": "_http._tcp.local.",
Expand Down
12 changes: 4 additions & 8 deletions homeassistant/components/onvif/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,17 +165,13 @@ async def async_check_date_and_time(self) -> None:
)
return

tzone = dt_util.DEFAULT_TIME_ZONE
cdate = device_time.LocalDateTime
if device_time.UTCDateTime:
tzone = dt_util.UTC
cdate = device_time.UTCDateTime
else:
tzone = (
dt_util.get_time_zone(
device_time.TimeZone or str(dt_util.DEFAULT_TIME_ZONE)
)
or dt_util.DEFAULT_TIME_ZONE
)
cdate = device_time.LocalDateTime
elif device_time.TimeZone:
tzone = dt_util.get_time_zone(device_time.TimeZone.TZ) or tzone

if cdate is None:
LOGGER.warning("Could not retrieve date/time on this camera")
Expand Down
Loading