Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion homeassistant/components/nest/device_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def device_model(self) -> str | None:
# The API intentionally returns minimal information about specific
# devices, instead relying on traits, but we can infer a generic model
# name based on the type
return DEVICE_TYPE_MAP.get(self._device.type)
return DEVICE_TYPE_MAP.get(self._device.type or "", None)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

None is the default value returned if the key is missing in the dict. We can remove the second parameter.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That was the original PR, but it was requested to increase readability to make the intent more clear. Want to look at our comment thread and see if you still think this should be removed?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I read it, please remove the second parameter. There's no confusion since the function can take two different parameters, with different meaning.

@MartinHjelmare MartinHjelmare Sep 2, 2023

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alternatively go with the other suggestion:

if self._device.type is None:
    return None
return DEVICE_TYPE_MAP.get(self._device.type)


@property
def suggested_area(self) -> str | None:
Expand Down
4 changes: 2 additions & 2 deletions homeassistant/components/nest/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
],
"documentation": "https://www.home-assistant.io/integrations/nest",
"iot_class": "cloud_push",
"loggers": ["google_nest_sdm", "nest"],
"loggers": ["google_nest_sdm"],
"quality_scale": "platinum",
"requirements": ["google-nest-sdm==2.2.5"]
"requirements": ["google-nest-sdm==3.0.2"]
}
2 changes: 1 addition & 1 deletion requirements_all.txt
Original file line number Diff line number Diff line change
Expand Up @@ -891,7 +891,7 @@ google-cloud-texttospeech==2.12.3
google-generativeai==0.1.0

# homeassistant.components.nest
google-nest-sdm==2.2.5
google-nest-sdm==3.0.2

# homeassistant.components.google_travel_time
googlemaps==2.5.1
Expand Down
2 changes: 1 addition & 1 deletion requirements_test_all.txt
Original file line number Diff line number Diff line change
Expand Up @@ -701,7 +701,7 @@ google-cloud-pubsub==2.13.11
google-generativeai==0.1.0

# homeassistant.components.nest
google-nest-sdm==2.2.5
google-nest-sdm==3.0.2

# homeassistant.components.google_travel_time
googlemaps==2.5.1
Expand Down
4 changes: 2 additions & 2 deletions tests/components/nest/test_diagnostics.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
"type": "sdm.devices.types.CAMERA",
"traits": {
"sdm.devices.traits.CameraLiveStream": {
"videoCodecs": "H264",
"videoCodecs": ["H264"],
"supportedProtocols": ["RTSP"],
},
},
Expand All @@ -71,7 +71,7 @@
"name": "**REDACTED**",
"traits": {
"sdm.devices.traits.CameraLiveStream": {
"videoCodecs": "H264",
"videoCodecs": ["H264"],
"supportedProtocols": ["RTSP"],
},
},
Expand Down
4 changes: 3 additions & 1 deletion tests/components/nest/test_media_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,9 @@ def create_battery_event_data(
(
"sdm.devices.types.THERMOSTAT",
{
"sdm.devices.traits.Temperature": {},
"sdm.devices.traits.Temperature": {
"ambientTemperatureCelsius": 22.0,
},
},
)
],
Expand Down