mirror of
https://github.com/home-assistant/core.git
synced 2025-04-25 09:47:52 +00:00
Check vehicle metadata (#134381)
This commit is contained in:
parent
031de8da51
commit
513c8487c5
@ -85,6 +85,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: TeslemetryConfigEntry) -
|
|||||||
|
|
||||||
scopes = calls[0]["scopes"]
|
scopes = calls[0]["scopes"]
|
||||||
region = calls[0]["region"]
|
region = calls[0]["region"]
|
||||||
|
vehicle_metadata = calls[0]["vehicles"]
|
||||||
products = calls[1]["response"]
|
products = calls[1]["response"]
|
||||||
|
|
||||||
device_registry = dr.async_get(hass)
|
device_registry = dr.async_get(hass)
|
||||||
@ -102,7 +103,11 @@ async def async_setup_entry(hass: HomeAssistant, entry: TeslemetryConfigEntry) -
|
|||||||
)
|
)
|
||||||
|
|
||||||
for product in products:
|
for product in products:
|
||||||
if "vin" in product and Scope.VEHICLE_DEVICE_DATA in scopes:
|
if (
|
||||||
|
"vin" in product
|
||||||
|
and vehicle_metadata.get(product["vin"], {}).get("access")
|
||||||
|
and Scope.VEHICLE_DEVICE_DATA in scopes
|
||||||
|
):
|
||||||
# Remove the protobuff 'cached_data' that we do not use to save memory
|
# Remove the protobuff 'cached_data' that we do not use to save memory
|
||||||
product.pop("cached_data", None)
|
product.pop("cached_data", None)
|
||||||
vin = product["vin"]
|
vin = product["vin"]
|
||||||
|
@ -46,9 +46,25 @@ METADATA = {
|
|||||||
"energy_device_data",
|
"energy_device_data",
|
||||||
"energy_cmds",
|
"energy_cmds",
|
||||||
],
|
],
|
||||||
|
"vehicles": {
|
||||||
|
"LRW3F7EK4NC700000": {
|
||||||
|
"proxy": False,
|
||||||
|
"access": True,
|
||||||
|
"polling": True,
|
||||||
|
"firmware": "2024.44.25",
|
||||||
|
}
|
||||||
|
},
|
||||||
}
|
}
|
||||||
METADATA_NOSCOPE = {
|
METADATA_NOSCOPE = {
|
||||||
"uid": "abc-123",
|
"uid": "abc-123",
|
||||||
"region": "NA",
|
"region": "NA",
|
||||||
"scopes": ["openid", "offline_access", "vehicle_device_data"],
|
"scopes": ["openid", "offline_access", "vehicle_device_data"],
|
||||||
|
"vehicles": {
|
||||||
|
"LRW3F7EK4NC700000": {
|
||||||
|
"proxy": False,
|
||||||
|
"access": True,
|
||||||
|
"polling": True,
|
||||||
|
"firmware": "2024.44.25",
|
||||||
|
}
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user