### Get All Liebherr Devices Source: https://context7.com/iluvdata/pyliebherr/llms.txt Retrieve a list of all Liebherr appliances registered to your account. Returns a list of LiebherrDevice objects containing device ID, name, model, image URL, and device type. ```python import asyncio from pyliebherr import LiebherrAPI, LiebherrDevice async def list_all_devices(): api = LiebherrAPI(api_key="your-api-key-here") try: devices: list[LiebherrDevice] = await api.async_get_devices() for device in devices: print(f"Device ID: {device.device_id}") print(f"Name: {device.name}") print(f"Model: {device.model}") print(f"Type: {device.device_type}" ) # FRIDGE, FREEZER, WINE, COMBI print(f"Image: {device.image_url}") print("---") finally: await api.async_close() # Example output: # Device ID: abc123-def456 # Name: Kitchen Fridge # Model: CBNes 5775 # Type: COMBI # Image: https://example. liebherr.com/image.png asyncio.run(list_all_devices()) ``` -------------------------------- ### Get Liebherr Device Controls Source: https://context7.com/iluvdata/pyliebherr/llms.txt Retrieve all available controls for a specific appliance. Returns a dictionary mapping control names to LiebherrControl objects. Controls with zones return nested dictionaries keyed by zone_id. ```python import asyncio from pyliebherr import LiebherrAPI, LiebherrControls, LiebherrControl, ControlType async def get_device_controls(): api = LiebherrAPI(api_key="your-api-key-here") try: devices = await api.async_get_devices() device_id = devices[0].device_id controls: LiebherrControls = await api.async_get_controls(device_id) for control_name, control_data in controls.items(): if isinstance(control_data, dict): # Zoned control (e.g., temperature per zone) for zone_id, control in control_data.items(): print(f"Control: {control_name}, Zone: {zone_id}") print(f" Type: {control.type}") print(f" Value: {control.value}") print(f" Target: {control.target}") if control.min is not None: print(f" Range: {control.min} - {control.max}") else: # Non-zoned control control: LiebherrControl = control_data print(f"Control: {control_name}") print(f" Type: {control.type}") print(f" Value: {control.value}") finally: await api.async_close() # Example output: # Control: temperature, Zone: 1 # Type: TemperatureControl # Value: 4 # Target: 4 # Range: 2 - 8 # Control: supercool # Type: ToggleControl # Value: False asyncio.run(get_device_controls()) ``` -------------------------------- ### Integrate device discovery and control Source: https://context7.com/iluvdata/pyliebherr/llms.txt Perform full device discovery, monitor temperature and toggle states, and execute control requests using an aiohttp session. ```python import asyncio from aiohttp import ClientSession from pyliebherr import ( LiebherrAPI, LiebherrDevice, LiebherrControl, LiebherrControls, ControlType, ) from pyliebherr.models import TemperatureControlRequest from pyliebherr.exception import LiebherrAuthException, LiebherrFetchException async def main(): async with ClientSession() as session: api = LiebherrAPI(api_key="your-api-key-here", client_session=session) try: # Discover all devices devices = await api.async_get_devices() print(f"Discovered {len(devices)} Liebherr appliance(s)\n") for device in devices: print(f"=== {device.name} ({device.model}) ===") print(f"Type: {device.device_type}") # Get all controls for this device controls = await api.async_get_controls(device.device_id) # Process temperature controls if "temperature" in controls: temp_controls = controls["temperature"] if isinstance(temp_controls, dict): for zone_id, control in temp_controls.items(): print(f"Zone {zone_id}: {control.value}{control.unit_of_measurement}") print(f" Target: {control.target}{control.unit_of_measurement}") print(f" Range: {control.min} - {control.max}") # Check toggle states for toggle in ["supercool", "superfrost", "nightmode", "partymode"]: if toggle in controls: control = controls[toggle] if isinstance(control, LiebherrControl): status = "ON" if control.value else "OFF" print(f"{toggle.capitalize()}: {status}") # Check ice maker if "icemaker" in controls: ice_control = controls["icemaker"] if isinstance(ice_control, dict): for zone_id, control in ice_control.items(): print(f"Ice Maker (Zone {zone_id}): {control.ice_maker_mode}") print() # Example: Set temperature on first device if devices: first_device = devices[0] temp_request = TemperatureControlRequest( zone_id=1, target=5, unit="°C" ) await api.async_set_value(first_device.device_id, temp_request) print(f"Set {first_device.name} zone 1 to 5°C") except LiebherrAuthException: print("Invalid API key - please check your credentials") except LiebherrFetchException as e: print(f"Failed to communicate with Liebherr API: {e}") finally: await api.async_close() asyncio.run(main()) ``` -------------------------------- ### Initialize LiebherrAPI Source: https://context7.com/iluvdata/pyliebherr/llms.txt Initialize the LiebherrAPI with your API key. Optionally provide a custom aiohttp ClientSession for connection pooling or custom configuration. ```python import asyncio from aiohttp import ClientSession from pyliebherr import LiebherrAPI # Basic initialization - creates its own session api = LiebherrAPI(api_key="your-api-key-here") # With custom session for connection reuse async def setup_with_custom_session(): session = ClientSession() api = LiebherrAPI(api_key="your-api-key-here", client_session=session) try: # Use the API... devices = await api.async_get_devices() finally: await api.async_close() asyncio.run(setup_with_custom_session()) ``` -------------------------------- ### Control Presentation Light Intensity Source: https://context7.com/iluvdata/pyliebherr/llms.txt Adjust the intensity of internal presentation lighting. Set the `target` value to a percentage between 0 and 100. Requires API key and device ID. ```python import asyncio from pyliebherr import LiebherrAPI from pyliebherr.models import PresentationLightControlRequest async def control_presentation_light(): api = LiebherrAPI(api_key="your-api-key-here") try: devices = await api.async_get_devices() device_id = devices[0].device_id # Set presentation light to 75% intensity light_control = PresentationLightControlRequest(target=75) await api.async_set_value(device_id, light_control) print("Presentation light set to 75%") # Dim to 25% light_dim = PresentationLightControlRequest(target=25) await api.async_set_value(device_id, light_dim) print("Presentation light dimmed to 25%") finally: await api.async_close() asyncio.run(control_presentation_light()) ``` -------------------------------- ### Set Temperature Control in Python Source: https://context7.com/iluvdata/pyliebherr/llms.txt Adjusts the target temperature for specific appliance zones by providing a zone_id, target value, and unit. ```python import asyncio from pyliebherr import LiebherrAPI from pyliebherr.models import TemperatureControlRequest async def set_temperature(): api = LiebherrAPI(api_key="your-api-key-here") try: devices = await api.async_get_devices() device_id = devices[0].device_id # Set fridge zone (zone_id=1) to 4°C temp_request = TemperatureControlRequest( zone_id=1, target=4, unit="°C" ) await api.async_set_value(device_id, temp_request) print("Temperature updated successfully") # Set freezer zone (zone_id=2) to -18°C freezer_request = TemperatureControlRequest( zone_id=2, target=-18, unit="°C" ) await api.async_set_value(device_id, freezer_request) print("Freezer temperature updated successfully") finally: await api.async_close() asyncio.run(set_temperature()) ``` -------------------------------- ### Control Ice Maker Settings in Python Source: https://context7.com/iluvdata/pyliebherr/llms.txt Manages ice maker operation modes including ON, OFF, and MAX_ICE for accelerated production. ```python import asyncio from pyliebherr import LiebherrAPI from pyliebherr.models import IceMakerControlRequest async def control_ice_maker(): api = LiebherrAPI(api_key="your-api-key-here") try: devices = await api.async_get_devices() device_id = devices[0].device_id # Turn on ice maker in normal mode ice_maker_on = IceMakerControlRequest( zone_id=1, ice_maker_mode=IceMakerControlRequest.IceMakerMode.ON ) await api.async_set_value(device_id, ice_maker_on) print("Ice maker turned on") # Enable MAX_ICE for faster ice production max_ice = IceMakerControlRequest( zone_id=1, ice_maker_mode=IceMakerControlRequest.IceMakerMode.MAX_ICE ) await api.async_set_value(device_id, max_ice) print("Max ice mode enabled") # Turn off ice maker ice_maker_off = IceMakerControlRequest( zone_id=1, ice_maker_mode=IceMakerControlRequest.IceMakerMode.OFF ) await api.async_set_value(device_id, ice_maker_off) print("Ice maker turned off") finally: await api.async_close() asyncio.run(control_ice_maker()) ``` -------------------------------- ### Toggle Appliance Modes in Python Source: https://context7.com/iluvdata/pyliebherr/llms.txt Enables or disables appliance features such as SuperCool, SuperFrost, Party Mode, and Night Mode using boolean values. ```python import asyncio from pyliebherr import LiebherrAPI from pyliebherr.models import BaseToggleControlRequest, ZoneToggleControlRequest from pyliebherr.const import ControlName async def toggle_controls(): api = LiebherrAPI(api_key="your-api-key-here") try: devices = await api.async_get_devices() device_id = devices[0].device_id # Enable SuperCool mode (no zone required) class SuperCoolRequest(BaseToggleControlRequest): control_name = ControlName.SUPERCOOL supercool_on = SuperCoolRequest(value=True) await api.async_set_value(device_id, supercool_on) print("SuperCool enabled") # Enable SuperFrost mode class SuperFrostRequest(BaseToggleControlRequest): control_name = ControlName.SUPERFROST superfrost_on = SuperFrostRequest(value=True) await api.async_set_value(device_id, superfrost_on) print("SuperFrost enabled") # Enable Night Mode class NightModeRequest(BaseToggleControlRequest): control_name = ControlName.NIGHTMODE nightmode_on = NightModeRequest(value=True) await api.async_set_value(device_id, nightmode_on) print("Night mode enabled") # Disable Party Mode class PartyModeRequest(BaseToggleControlRequest): control_name = ControlName.PARTYMODE partymode_off = PartyModeRequest(value=False) await api.async_set_value(device_id, partymode_off) print("Party mode disabled") finally: await api.async_close() asyncio.run(toggle_controls()) ``` -------------------------------- ### Control BioFresh Plus Compartments Source: https://context7.com/iluvdata/pyliebherr/llms.txt Configure BioFresh Plus compartments with specific temperature modes. Supports ZERO_ZERO, ZERO_MINUS_TWO, MINUS_TWO_MINUS_TWO, and MINUS_TWO_ZERO. Requires API key and device ID. ```python import asyncio from pyliebherr import LiebherrAPI from pyliebherr.models import BioFreshPlusControlRequest async def control_biofresh_plus(): api = LiebherrAPI(api_key="your-api-key-here") try: devices = await api.async_get_devices() device_id = devices[0].device_id # Set BioFresh Plus to ZERO_ZERO mode (0°C / 0°C) # Ideal for general fresh food storage biofresh = BioFreshPlusControlRequest( zone_id=1, bio_fresh_plus_mode=BioFreshPlusControlRequest.BioFreshPlusMode.ZERO_ZERO ) await api.async_set_value(device_id, biofresh) print("BioFresh Plus set to 0°C / 0°C") # Set to MINUS_TWO_MINUS_TWO for fish and seafood biofresh_fish = BioFreshPlusControlRequest( zone_id=1, bio_fresh_plus_mode=BioFreshPlusControlRequest.BioFreshPlusMode.MINUS_TWO_MINUS_TWO ) await api.async_set_value(device_id, biofresh_fish) print("BioFresh Plus set to -2°C / -2°C") finally: await api.async_close() asyncio.run(control_biofresh_plus()) ``` -------------------------------- ### Handle API errors with exception types Source: https://context7.com/iluvdata/pyliebherr/llms.txt Use specific exception classes to catch authentication failures, rate limits, and general fetch errors during API communication. ```python import asyncio from pyliebherr import LiebherrAPI from pyliebherr.exception import ( LiebherrAuthException, LiebherrAPILimitExceededException, LiebherrFetchException, LiebherrException, ) async def robust_api_call(): api = LiebherrAPI(api_key="your-api-key-here") try: devices = await api.async_get_devices() print(f"Found {len(devices)} devices") except LiebherrAuthException: # HTTP 401 - Invalid API key print("Authentication failed: Invalid API key") except LiebherrAPILimitExceededException as e: # HTTP 429 - Rate limit exceeded print(f"Rate limit exceeded: {e.message}") print("Please wait before making more requests") except LiebherrFetchException as e: # Other API errors print(f"API error: {e.message}") except LiebherrException as e: # General Liebherr exception print(f"Liebherr error: {e.message}") finally: await api.async_close() asyncio.run(robust_api_call()) ``` -------------------------------- ### Control Appliance Door Source: https://context7.com/iluvdata/pyliebherr/llms.txt Remotely open or close appliance doors on models with automatic door functionality. Use `True` to open and `False` to close. Requires API key and device ID. ```python import asyncio from pyliebherr import LiebherrAPI from pyliebherr.models import AutoDoorControl async def control_auto_door(): api = LiebherrAPI(api_key="your-api-key-here") try: devices = await api.async_get_devices() device_id = devices[0].device_id # Open the door open_door = AutoDoorControl( zone_id=1, value=True # True = open ) await api.async_set_value(device_id, open_door) print("Door opened") # Close the door close_door = AutoDoorControl( zone_id=1, value=False # False = close ) await api.async_set_value(device_id, close_door) print("Door closed") finally: await api.async_close() asyncio.run(control_auto_door()) ``` -------------------------------- ### Control HydroBreeze Humidity Source: https://context7.com/iluvdata/pyliebherr/llms.txt Adjust HydroBreeze humidity levels in BioFresh compartments. Use OFF, LOW, MEDIUM, or HIGH modes. Requires API key and device ID. ```python import asyncio from pyliebherr import LiebherrAPI from pyliebherr.models import HydroBreezeControlRequest async def control_hydrobreeze(): api = LiebherrAPI(api_key="your-api-key-here") try: devices = await api.async_get_devices() device_id = devices[0].device_id # Set HydroBreeze to MEDIUM for optimal vegetable storage hydrobreeze = HydroBreezeControlRequest( zone_id=1, hydro_breeze_mode=HydroBreezeControlRequest.HydroBreezeMode.MEDIUM ) await api.async_set_value(device_id, hydrobreeze) print("HydroBreeze set to MEDIUM") # Set to HIGH for leafy greens hydrobreeze_high = HydroBreezeControlRequest( zone_id=1, hydro_breeze_mode=HydroBreezeControlRequest.HydroBreezeMode.HIGH ) await api.async_set_value(device_id, hydrobreeze_high) print("HydroBreeze set to HIGH") # Turn off HydroBreeze hydrobreeze_off = HydroBreezeControlRequest( zone_id=1, hydro_breeze_mode=HydroBreezeControlRequest.HydroBreezeMode.OFF ) await api.async_set_value(device_id, hydrobreeze_off) print("HydroBreeze turned off") finally: await api.async_close() asyncio.run(control_hydrobreeze()) ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.