class AdaxRoom: """ Represents an Adax room. """ def __init__(self, room_data: dict): """ Initializes an AdaxRoom object from a dictionary. Args: room_data: A dictionary containing room information. """ self.id:int = room_data.get("id") self.home_id:int = room_data.get("homeId") self.name:str = room_data.get("name") self.heating_enabled:bool = room_data.get("heatingEnabled") self.target_temperature:int = room_data.get("targetTemperature") self.temperature:int = room_data.get("temperature")if room_data.get("temperature") else 0 def __repr__(self): """ Returns a string representation of the AdaxRoom object. """ return ( f"AdaxRoom(" f"id={self.id}, " f"home_id={self.home_id}, " f"name='{self.name}', " f"heating_enabled={self.heating_enabled}, " f"target_temperature={self.target_temperature / 100}, " f"temperature={self.temperature / 100}" f")" ) def to_payload(self): """ Returns a small dict of itself to use for a post request. """ return { "id": self.id, "heatingEnabled": self.heating_enabled, "targetTemperature": self.target_temperature, } def to_dict(self): """ Returns a dictionary representation of the AdaxRoom object. """ return { "id": self.id, "homeId": self.home_id, "name": self.name, "heatingEnabled": self.heating_enabled, "targetTemperature": self.target_temperature, "temperature": self.temperature, } class AdaxDevice: """ Represents an Adax device. """ def __init__(self, device_data: dict): """ Initializes an AdaxDevice object from a dictionary. Args: device_data: A dictionary containing device information. """ self.id = device_data.get("id") self.home_id = device_data.get("homeId") self.room_id = device_data.get("roomId") self.name = device_data.get("name") self.type = device_data.get("type") def __repr__(self): """ Returns a string representation of the AdaxDevice object. """ return ( f"AdaxDevice(" f"id={self.id}, " f"home_id={self.home_id}, " f"room_id={self.room_id}, " f"name='{self.name}', " f"type='{self.type}'" f")" ) def to_dict(self): """ Returns a dictionary representation of the AdaxDevice object. """ return { "id": self.id, "homeId": self.home_id, "roomId": self.room_id, "name": self.name, "type": self.type, }