Skip to content

Commit

Permalink
Merge branch 'dev' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
Caius-Bonus authored Sep 30, 2023
2 parents 09c32e4 + 6e3c704 commit 3293f46
Show file tree
Hide file tree
Showing 21 changed files with 213 additions and 88 deletions.
1 change: 1 addition & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
Expand Up @@ -898,6 +898,7 @@ omit =
homeassistant/components/opengarage/cover.py
homeassistant/components/opengarage/entity.py
homeassistant/components/opengarage/sensor.py
homeassistant/components/openhardwaremonitor/sensor.py
homeassistant/components/openhome/__init__.py
homeassistant/components/openhome/const.py
homeassistant/components/openhome/media_player.py
Expand Down
3 changes: 3 additions & 0 deletions homeassistant/components/demo/climate.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from typing import Any

from homeassistant.components.climate import (
ATTR_HVAC_MODE,
ATTR_TARGET_TEMP_HIGH,
ATTR_TARGET_TEMP_LOW,
ClimateEntity,
Expand Down Expand Up @@ -258,6 +259,8 @@ async def async_set_temperature(self, **kwargs: Any) -> None:
):
self._target_temperature_high = kwargs.get(ATTR_TARGET_TEMP_HIGH)
self._target_temperature_low = kwargs.get(ATTR_TARGET_TEMP_LOW)
if kwargs.get(ATTR_HVAC_MODE) is not None:
self._hvac_mode = HVACMode(str(kwargs.get(ATTR_HVAC_MODE)))
self.async_write_ha_state()

async def async_set_humidity(self, humidity: int) -> None:
Expand Down
2 changes: 2 additions & 0 deletions homeassistant/components/openhardwaremonitor/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ def native_unit_of_measurement(self):
@property
def native_value(self):
"""Return the state of the device."""
if self.value == "-":
return None
return self.value

@property
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/plex/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"iot_class": "local_push",
"loggers": ["plexapi", "plexwebsocket"],
"requirements": [
"PlexAPI==4.13.2",
"PlexAPI==4.15.3",
"plexauth==0.0.6",
"plexwebsocket==0.0.13"
],
Expand Down
12 changes: 8 additions & 4 deletions homeassistant/components/zwave_js/update.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,11 +211,15 @@ async def _async_update(self, _: HomeAssistant | datetime | None = None) -> None
return

try:
available_firmware_updates = (
await self.driver.controller.async_get_available_firmware_updates(
self.node, API_KEY_FIRMWARE_UPDATE_SERVICE
# Retrieve all firmware updates including non-stable ones but filter
# non-stable channels out
available_firmware_updates = [
update
for update in await self.driver.controller.async_get_available_firmware_updates(
self.node, API_KEY_FIRMWARE_UPDATE_SERVICE, True
)
)
if update.channel == "stable"
]
except FailedZWaveCommand as err:
LOGGER.debug(
"Failed to get firmware updates for node %s: %s",
Expand Down
2 changes: 1 addition & 1 deletion requirements_all.txt
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ Mastodon.py==1.5.1
Pillow==10.0.0

# homeassistant.components.plex
PlexAPI==4.13.2
PlexAPI==4.15.3

# homeassistant.components.progettihwsw
ProgettiHWSW==0.1.3
Expand Down
2 changes: 1 addition & 1 deletion requirements_test_all.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ HATasmota==0.7.3
Pillow==10.0.0

# homeassistant.components.plex
PlexAPI==4.13.2
PlexAPI==4.15.3

# homeassistant.components.progettihwsw
ProgettiHWSW==0.1.3
Expand Down
22 changes: 22 additions & 0 deletions tests/components/demo/test_climate.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,28 @@ async def test_set_target_temp_range_bad_attr(hass: HomeAssistant) -> None:
assert state.attributes.get(ATTR_TARGET_TEMP_HIGH) == 24.0


async def test_set_temp_with_hvac_mode(hass: HomeAssistant) -> None:
"""Test the setting of the hvac_mode in set_temperature."""
state = hass.states.get(ENTITY_CLIMATE)
assert state.attributes.get(ATTR_TEMPERATURE) == 21
assert state.state == HVACMode.COOL

await hass.services.async_call(
DOMAIN,
SERVICE_SET_TEMPERATURE,
{
ATTR_ENTITY_ID: ENTITY_CLIMATE,
ATTR_TEMPERATURE: 23,
ATTR_HVAC_MODE: HVACMode.OFF,
},
blocking=True,
)

state = hass.states.get(ENTITY_CLIMATE)
assert state.state == HVACMode.OFF
assert state.attributes.get(ATTR_TEMPERATURE) == 23


async def test_set_target_humidity_bad_attr(hass: HomeAssistant) -> None:
"""Test setting the target humidity without required attribute."""
state = hass.states.get(ENTITY_CLIMATE)
Expand Down
10 changes: 8 additions & 2 deletions tests/components/plex/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,12 @@ def player_plexweb_resources_fixture():
return load_fixture("plex/player_plexweb_resources.xml")


@pytest.fixture(name="player_plexhtpc_resources", scope="session")
def player_plexhtpc_resources_fixture():
"""Load resources payload for a Plex HTPC player and return it."""
return load_fixture("plex/player_plexhtpc_resources.xml")


@pytest.fixture(name="playlists", scope="session")
def playlists_fixture():
"""Load payload for all playlists and return it."""
Expand Down Expand Up @@ -450,8 +456,8 @@ def mock_plex_calls(
"""Mock Plex API calls."""
requests_mock.get("https://plex.tv/api/users/", text=plextv_shared_users)
requests_mock.get("https://plex.tv/api/invites/requested", text=empty_payload)
requests_mock.get("https://plex.tv/users/account", text=plextv_account)
requests_mock.get("https://plex.tv/api/resources", text=plextv_resources)
requests_mock.get("https://plex.tv/api/v2/user", text=plextv_account)
requests_mock.get("https://plex.tv/api/v2/resources", text=plextv_resources)

url = plex_server_url(entry)

Expand Down
3 changes: 3 additions & 0 deletions tests/components/plex/fixtures/player_plexhtpc_resources.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<MediaContainer size="1">
<Player machineIdentifier="plex_htpc" deviceClass="pc" platform="osx" platformVersion="13.5" product="Plex HTPC for Mac" protocol="plex" protocolCapabilities="timeline,playback,navigation,playqueues" protocolVersion="3" title="Plex HTPC" version="1.33.2.3525-140e01eb" />
</MediaContainer>
23 changes: 13 additions & 10 deletions tests/components/plex/fixtures/plextv_account.xml
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
<user email="[email protected]" id="12345" uuid="1234567890" mailing_list_status="active" thumb="https://plex.tv/users/1234567890abcdef/avatar?c=11111" username="User 1" title="User 1" cloudSyncDevice="" locale="" authenticationToken="faketoken" authToken="faketoken" scrobbleTypes="" restricted="0" home="1" guest="0" queueEmail="[email protected]" queueUid="" hasPassword="true" homeSize="2" maxHomeSize="15" secure="1" certificateVersion="2">
<subscription active="1" status="Active" plan="lifetime">
<feature id="companions_sonos"/>
<user id="12345" uuid="1234567890" username="User 1" title="User 1" email="[email protected]" friendlyName="User 1" locale="" confirmed="1" joinedAt="946730096" emailOnlyAuth="0" hasPassword="1" protected="0" thumb="https://plex.tv/users/1234567890abcdef/avatar?c=12345" authToken="faketoken" mailingListStatus="unsubscribed" mailingListActive="0" scrobbleTypes="" country="CA" subscriptionDescription="" restricted="0" anonymous="" home="1" guest="0" homeSize="2" homeAdmin="1" maxHomeSize="15" rememberExpiresAt="1680893707" adsConsent="" adsConsentSetAt="" adsConsentReminderAt="" experimentalFeatures="0" twoFactorEnabled="1" backupCodesCreated="1">
<subscription active="1" subscribedAt="2023-09-19 00:00:00 UTC" status="Active" paymentService="" plan="lifetime">
<features>
<feature id="companions_sonos"/>
</features>
</subscription>
<profile autoSelectAudio="0" defaultAudioLanguage="en" defaultSubtitleLanguage="en" autoSelectSubtitle="0" defaultSubtitleAccessibility="0" defaultSubtitleForced="0"/>
<entitlements>
<entitlement id="all"/>
</entitlements>
<roles>
<role id="plexpass"/>
</roles>
<entitlements all="1"/>
<profile_settings default_audio_language="en" default_subtitle_language="en" auto_select_subtitle="1" auto_select_audio="1" default_subtitle_accessibility="0" default_subtitle_forced="0"/>
<services/>
<username>testuser</username>
<email>[email protected]</email>
<joined-at type="datetime">2000-01-01 12:34:56 UTC</joined-at>
<authentication-token>faketoken</authentication-token>
<subscriptions>
</subscriptions>
<services>
</services>
</user>
40 changes: 22 additions & 18 deletions tests/components/plex/fixtures/plextv_resources_one_server.xml
Original file line number Diff line number Diff line change
@@ -1,18 +1,22 @@
<MediaContainer size="5">
<Device name="Plex Server 1" product="Plex Media Server" productVersion="1.20.4.3517-ab5e1197c" platform="Linux" platformVersion="20.04.1 LTS (Focal Fossa)" device="PC" clientIdentifier="unique_id_123" createdAt="1429510140" lastSeenAt="1605500006" provides="server" owned="1" accessToken="faketoken" publicAddress="10.20.30.40" httpsRequired="0" synced="0" relay="0" dnsRebindingProtection="0" natLoopbackSupported="1" publicAddressMatches="1" presence="1">
<Connection protocol="https" address="1.2.3.4" port="32400" uri="https://1-2-3-4.123456789001234567890.plex.direct:32400" local="1"/>
</Device>
<Device name="Chrome" product="Plex Web" productVersion="4.46.2" platform="Chrome" platformVersion="14.0" device="OSX" clientIdentifier="plexweb_id" createdAt="1578086003" lastSeenAt="1605461664" provides="client,player,pubsub-player" owned="1" publicAddress="10.20.30.40" publicAddressMatches="1" presence="1" accessToken="faketoken">
<Connection protocol="https" address="1.2.3.5" port="32400" uri="https://1-2-3-5.123456789001234567890.plex.direct:32400" local="1"/>
<Connection protocol="https" address="10.20.30.40" port="35872" uri="https://10-20-30-40.123456789001234567890.plex.direct:35872" local="0"/>
</Device>
<Device name="AppleTV" product="Plex for Apple TV" productVersion="7.9" platform="tvOS" platformVersion="14.2" device="Apple TV" clientIdentifier="A10E4083-BF1A-4586-B884-C638A32D5285" createdAt="1447217545" lastSeenAt="1605495521" provides="client,player,pubsub-player,provider-playback" owned="1" publicAddress="10.20.30.40" publicAddressMatches="1" presence="0">
<Connection protocol="http" address="1.2.3.6" port="32500" uri="http://1.2.3.6:32500" local="1"/>
</Device>
<Device name="jPhone" product="Plex for iOS" productVersion="7.9" platform="iOS" platformVersion="14.2" device="iPhone" clientIdentifier="CDB83941-F8C2-4B56-989E-F3EFD0165BC1" createdAt="1537584529" lastSeenAt="1605501046" provides="client,controller,sync-target,player,pubsub-player,provider-playback" owned="1" publicAddress="10.20.30.40" publicAddressMatches="1" presence="0">
<Connection protocol="http" address="1.2.3.7" port="32500" uri="http://1.2.3.7:32500" local="1"/>
</Device>
<Device name="SHIELD Android TV" product="Plex for Android (TV)" productVersion="8.8.2.21525" platform="Android" platformVersion="9" device="SHIELD Android TV" clientIdentifier="2f2a5ae50a45837c-com-plexapp-android" createdAt="1584850408" lastSeenAt="1605384938" provides="player,pubsub-player,controller" owned="1" publicAddress="10.20.30.40" publicAddressMatches="1" presence="1">
<Connection protocol="http" address="1.2.3.11" port="32500" uri="http://1.2.3.11:32500" local="1"/>
</Device>
</MediaContainer>
<resources>
<resource name="Plex Server 1" product="Plex Media Server" productVersion="1.32.6.7468-07e0d4a7e" platform="Linux" platformVersion="5.15.0-69-generic" device="Docker Container" clientIdentifier="unique_id_123" createdAt="2013-01-01T12:34:56Z" lastSeenAt="2023-09-20T00:00:00Z" provides="server" ownerId="" sourceTitle="" publicAddress="10.20.30.40" accessToken="faketoken" owned="1" home="0" synced="0" relay="0" presence="1" httpsRequired="0" publicAddressMatches="1" dnsRebindingProtection="0" natLoopbackSupported="0">
<connections>
<connection protocol="https" address="1.2.3.4" port="32400" uri="https://1-2-3-4.123456789001234567890.plex.direct:32400" local="1" relay="0" IPv6="0"/>
</connections>
</resource>
<resource name="Plex HTPC" product="Plex HTPC for Mac" productVersion="1.33.2.3525-140e01eb" platform="osx" platformVersion="13.5" device="" clientIdentifier="client_id" createdAt="2023-09-01T00:00:00Z" lastSeenAt="2023-09-01T00:00:00Z" provides="client,player" ownerId="" sourceTitle="" publicAddress="10.20.30.40" accessToken="faketoken" owned="1" home="0" synced="0" relay="0" presence="1" httpsRequired="0" publicAddressMatches="1">
<connections>
<connection protocol="https" address="1.2.3.6" port="32400" uri="https://1-2-3-6.123456789001234567890.plex.direct:32400" local="1" relay="0" IPv6="0"/>
</connections>
</resource>
<resource name="iPhone" product="Plex for iOS" productVersion="8.24" platform="iOS" platformVersion="16.6.1" device="iPhone" clientIdentifier="12345678-0123-0123-0123-012345678901" createdAt="2022-12-31T01:23:45Z" lastSeenAt="2023-09-19T00:00:00Z" provides="client,controller,sync-target,player,pubsub-player,provider-playback" ownerId="" sourceTitle="" publicAddress="10.20.30.40" accessToken="" owned="1" home="0" synced="0" relay="0" presence="0" httpsRequired="0" publicAddressMatches="1">
<connections>
<connection protocol="http" address="1.2.3.10" port="32500" uri="http://1.2.3.10:32500" local="1" relay="0" IPv6="0"/>
</connections>
</resource>
<resource name="SHIELD Android TV" product="Plex for Android (TV)" productVersion="9.31.0.3817" platform="Android" platformVersion="11" device="SHIELD Android TV" clientIdentifier="1234567890-com-plexapp-android" createdAt="2020-01-01T12:34:56Z" lastSeenAt="2023-09-19T00:00:00Z" provides="player,pubsub-player,controller" ownerId="" sourceTitle="" publicAddress="10.20.30.40" accessToken="" owned="1" home="0" synced="0" relay="0" presence="0" httpsRequired="0" publicAddressMatches="1">
<connections>
<connection protocol="http" address="1.2.3.11" port="32500" uri="http://1.2.3.11:32500" local="1" relay="0" IPv6="0"/>
</connections>
</resource>
</resources>
48 changes: 27 additions & 21 deletions tests/components/plex/fixtures/plextv_resources_two_servers.xml
Original file line number Diff line number Diff line change
@@ -1,21 +1,27 @@
<MediaContainer size="6">
<Device name="Plex Server 1" product="Plex Media Server" productVersion="1.20.4.3517-ab5e1197c" platform="Linux" platformVersion="20.04.1 LTS (Focal Fossa)" device="PC" clientIdentifier="unique_id_123" createdAt="1429510140" lastSeenAt="1605500006" provides="server" owned="1" accessToken="faketoken" publicAddress="10.20.30.40" httpsRequired="0" synced="0" relay="0" dnsRebindingProtection="0" natLoopbackSupported="1" publicAddressMatches="1" presence="1">
<Connection protocol="https" address="1.2.3.4" port="32400" uri="https://1-2-3-4.123456789001234567890.plex.direct:32400" local="1"/>
</Device>
<Device name="Plex Server 2" product="Plex Media Server" productVersion="1.20.4.3517-ab5e1197c" platform="Linux" platformVersion="20.04.1 LTS (Focal Fossa)" device="PC" clientIdentifier="unique_id_456" createdAt="1429510140" lastSeenAt="1605500006" provides="server" owned="1" accessToken="faketoken" publicAddress="10.20.30.40" httpsRequired="0" synced="0" relay="0" dnsRebindingProtection="0" natLoopbackSupported="1" publicAddressMatches="1" presence="1">
<Connection protocol="https" address="4.3.2.1" port="32400" uri="https://4-3-2-1.123456789001234567890.plex.direct:32400" local="1"/>
</Device>
<Device name="Chrome" product="Plex Web" productVersion="4.46.2" platform="Chrome" platformVersion="14.0" device="OSX" clientIdentifier="plexweb_id" createdAt="1578086003" lastSeenAt="1605461664" provides="client,player,pubsub-player" owned="1" publicAddress="10.20.30.40" publicAddressMatches="1" presence="1" accessToken="faketoken">
<Connection protocol="https" address="1.2.3.5" port="32400" uri="https://1-2-3-5.123456789001234567890.plex.direct:32400" local="1"/>
<Connection protocol="https" address="10.20.30.40" port="35872" uri="https://10-20-30-40.123456789001234567890.plex.direct:35872" local="0"/>
</Device>
<Device name="AppleTV" product="Plex for Apple TV" productVersion="7.9" platform="tvOS" platformVersion="14.2" device="Apple TV" clientIdentifier="A10E4083-BF1A-4586-B884-C638A32D5285" createdAt="1447217545" lastSeenAt="1605495521" provides="client,player,pubsub-player,provider-playback" owned="1" publicAddress="10.20.30.40" publicAddressMatches="1" presence="0">
<Connection protocol="http" address="1.2.3.6" port="32500" uri="http://1.2.3.6:32500" local="1"/>
</Device>
<Device name="jPhone" product="Plex for iOS" productVersion="7.9" platform="iOS" platformVersion="14.2" device="iPhone" clientIdentifier="CDB83941-F8C2-4B56-989E-F3EFD0165BC1" createdAt="1537584529" lastSeenAt="1605501046" provides="client,controller,sync-target,player,pubsub-player,provider-playback" owned="1" publicAddress="10.20.30.40" publicAddressMatches="1" presence="0">
<Connection protocol="http" address="1.2.3.7" port="32500" uri="http://1.2.3.7:32500" local="1"/>
</Device>
<Device name="SHIELD Android TV" product="Plex for Android (TV)" productVersion="8.8.2.21525" platform="Android" platformVersion="9" device="SHIELD Android TV" clientIdentifier="2f2a5ae50a45837c-com-plexapp-android" createdAt="1584850408" lastSeenAt="1605384938" provides="player,pubsub-player,controller" owned="1" publicAddress="10.20.30.40" publicAddressMatches="1" presence="1">
<Connection protocol="http" address="1.2.3.11" port="32500" uri="http://1.2.3.11:32500" local="1"/>
</Device>
</MediaContainer>
<resources>
<resource name="Plex Server 1" product="Plex Media Server" productVersion="1.32.6.7468-07e0d4a7e" platform="Linux" platformVersion="5.15.0-69-generic" device="Docker Container" clientIdentifier="unique_id_123" createdAt="2013-01-01T12:34:56Z" lastSeenAt="2023-09-20T00:00:00Z" provides="server" ownerId="" sourceTitle="" publicAddress="10.20.30.40" accessToken="faketoken" owned="1" home="0" synced="0" relay="0" presence="1" httpsRequired="0" publicAddressMatches="1" dnsRebindingProtection="0" natLoopbackSupported="0">
<connections>
<connection protocol="https" address="1.2.3.4" port="32400" uri="https://1-2-3-4.123456789001234567890.plex.direct:32400" local="1" relay="0" IPv6="0"/>
</connections>
</resource>
<resource name="Plex Server 2" product="Plex Media Server" productVersion="1.32.6.7468-07e0d4a7e" platform="Linux" platformVersion="5.15.0-69-generic" device="Docker Container" clientIdentifier="unique_id_456" createdAt="2013-01-01T12:34:56Z" lastSeenAt="2023-09-20T00:00:00Z" provides="server" ownerId="" sourceTitle="" publicAddress="10.20.30.40" accessToken="faketoken" owned="1" home="0" synced="0" relay="0" presence="1" httpsRequired="0" publicAddressMatches="1" dnsRebindingProtection="0" natLoopbackSupported="0">
<connections>
<connection protocol="https" address="4.3.2.1" port="32400" uri="https://4-3-2-1.123456789001234567890.plex.direct:32400" local="1" relay="0" IPv6="0"/>
</connections>
</resource>
<resource name="Plex HTPC" product="Plex HTPC for Mac" productVersion="1.33.2.3525-140e01eb" platform="osx" platformVersion="13.5" device="" clientIdentifier="client_id" createdAt="2023-09-01T00:00:00Z" lastSeenAt="2023-09-01T00:00:00Z" provides="client,player" ownerId="" sourceTitle="" publicAddress="10.20.30.40" accessToken="faketoken" owned="1" home="0" synced="0" relay="0" presence="1" httpsRequired="0" publicAddressMatches="1">
<connections>
<connection protocol="https" address="1.2.3.6" port="32400" uri="https://1-2-3-6.123456789001234567890.plex.direct:32400" local="1" relay="0" IPv6="0"/>
</connections>
</resource>
<resource name="iPhone" product="Plex for iOS" productVersion="8.24" platform="iOS" platformVersion="16.6.1" device="iPhone" clientIdentifier="12345678-0123-0123-0123-012345678901" createdAt="2022-12-31T01:23:45Z" lastSeenAt="2023-09-19T00:00:00Z" provides="client,controller,sync-target,player,pubsub-player,provider-playback" ownerId="" sourceTitle="" publicAddress="10.20.30.40" accessToken="" owned="1" home="0" synced="0" relay="0" presence="0" httpsRequired="0" publicAddressMatches="1">
<connections>
<connection protocol="http" address="1.2.3.10" port="32500" uri="http://1.2.3.10:32500" local="1" relay="0" IPv6="0"/>
</connections>
</resource>
<resource name="SHIELD Android TV" product="Plex for Android (TV)" productVersion="9.31.0.3817" platform="Android" platformVersion="11" device="SHIELD Android TV" clientIdentifier="1234567890-com-plexapp-android" createdAt="2020-01-01T12:34:56Z" lastSeenAt="2023-09-20T00:00:00Z" provides="player,pubsub-player,controller" ownerId="" sourceTitle="" publicAddress="10.20.30.40" accessToken="" owned="1" home="0" synced="0" relay="0" presence="0" httpsRequired="0" publicAddressMatches="1">
<connections>
<connection protocol="http" address="1.2.3.11" port="32500" uri="http://1.2.3.11:32500" local="1" relay="0" IPv6="0"/>
</connections>
</resource>
</resources>
Loading

0 comments on commit 3293f46

Please sign in to comment.