@@ -275,30 +275,30 @@ of the cloud response's keys but fills in `None` for the ones it cannot serve
275275locally, so a consumer that wants "local readings where available, cloud
276276otherwise" needs to merge the two responses itself, field by field.
277277
278- ` tesla_fleet_api.router.energysite ` provides that merge as a plain function ,
279- independent of ` Router ` :
278+ ` tesla_fleet_api.router.energysite ` provides that merge via two entry points ,
279+ one per response shape :
280280
281281``` python
282- from tesla_fleet_api.router.energysite import (
283- LOCAL_LIVE_STATUS_KEYS ,
284- LOCAL_SITE_INFO_KEYS ,
285- merge_local_into_cloud,
286- )
282+ from tesla_fleet_api.router.energysite import merge_live_status, merge_site_info
287283
288284cloud_status = await teslemetry_energysite.live_status()
289285local_status = await local_energysite.live_status()
290- merged = merge_local_into_cloud (cloud_status, local_status, LOCAL_LIVE_STATUS_KEYS )
286+ merged = merge_live_status (cloud_status, local_status)
291287```
292288
293- - ` LOCAL_LIVE_STATUS_KEYS ` are the ` live_status() ` fields the local gateway can
294- actually serve; ` LOCAL_SITE_INFO_KEYS ` are the ` site_info() ` equivalent
289+ - ` merge_live_status ` overlays the ` live_status() ` fields the local gateway can
290+ actually serve; ` merge_site_info ` does the same for ` site_info() `
295291 (` backup_reserve_percent ` , ` default_real_mode ` ).
296- - Only keys in the given set ** and** present in ` local ` are overlaid onto a
292+ - Only keys the wrapper owns ** and** present in ` local ` are overlaid onto a
297293 copy of ` cloud ` ; every other key keeps its cloud value.
298294- If the local read failed entirely (` local is None ` , e.g. the LAN call
299295 raised), the result is just ` cloud ` - the same fallback-to-cloud behavior
300296 ` Router ` gives non-merged commands.
301297
298+ Both wrappers call the underlying primitive, `merge_local_into_cloud(cloud,
299+ local, owned_keys)`, which is still public for a caller with its own key set
300+ (` LOCAL_LIVE_STATUS_KEYS ` /` LOCAL_SITE_INFO_KEYS ` are also exported).
301+
302302## See also
303303
304304- [ Fleet API for Energy Sites] ( fleet_api_energy_sites.md ) - the cloud
0 commit comments