From 1b2b9eb855fe5926828e508f97952d15f163c43f Mon Sep 17 00:00:00 2001 From: Aidan Timson Date: Mon, 1 Apr 2024 14:36:20 +0100 Subject: [PATCH] Change property names to use snake case standard (#76) --- aiolyric/__init__.py | 34 ++++---- aiolyric/objects/device.py | 143 ++++++++++++++++----------------- aiolyric/objects/location.py | 63 +++++++-------- aiolyric/objects/priority.py | 23 +++--- tests/objects/test_device.py | 108 +++++++++++++------------ tests/objects/test_location.py | 140 ++++++++++++++++---------------- tests/objects/test_priority.py | 30 +++---- 7 files changed, 274 insertions(+), 267 deletions(-) diff --git a/aiolyric/__init__.py b/aiolyric/__init__.py index a309d50..26168b1 100644 --- a/aiolyric/__init__.py +++ b/aiolyric/__init__.py @@ -73,7 +73,7 @@ async def get_devices( self._devices = [LyricDevice(self._client, device) for device in json or []] self._devices_dict: dict = {} for device in self._devices: - self._devices_dict[device.macID] = device + self._devices_dict[device.mac_id] = device async def get_locations(self) -> None: """Get Locations.""" @@ -87,7 +87,7 @@ async def get_locations(self) -> None: ] self._locations_dict: dict = {} for location in self._locations: - self._locations_dict[location.locationID] = location + self._locations_dict[location.location_id] = location async def get_thermostat_rooms( self, @@ -104,11 +104,11 @@ async def get_thermostat_rooms( priority = LyricPriority(json) # device id in the priority payload refers to the mac address of the device - mac_id = priority.deviceId + mac_id = priority.device_id self._rooms_dict[mac_id] = {} # add each room to the room dictionary. Rooms contain motion, temp, and humidity averages for all accessories in a room - for room in priority.currentPriority.rooms: + for room in priority.current_priority.rooms: self._rooms_dict[mac_id][room.id] = room async def update_thermostat( @@ -130,46 +130,48 @@ async def update_thermostat( if mode is not None: data["mode"] = mode else: - data["mode"] = device.changeableValues.mode + data["mode"] = device.changeable_values.mode if heat_setpoint is not None: data["heatSetpoint"] = heat_setpoint else: - data["heatSetpoint"] = device.changeableValues.heatSetpoint + data["heatSetpoint"] = device.changeable_values.heat_setpoint if cool_setpoint is not None: data["coolSetpoint"] = cool_setpoint else: - data["coolSetpoint"] = device.changeableValues.coolSetpoint + data["coolSetpoint"] = device.changeable_values.cool_setpoint # Only for TCC devices if auto_changeover_active is not None: data["autoChangeoverActive"] = auto_changeover_active - elif device.changeableValues.autoChangeoverActive is not None: - data["autoChangeoverActive"] = device.changeableValues.autoChangeoverActive + elif device.changeable_values.auto_changeover_active is not None: + data["autoChangeoverActive"] = ( + device.changeable_values.auto_changeover_active + ) # Only for LCC devices if thermostat_setpoint_status is not None: data["thermostatSetpointStatus"] = thermostat_setpoint_status - elif device.changeableValues.thermostatSetpointStatus is not None: - if device.changeableValues.thermostatSetpointStatus == "NoHold": + elif device.changeable_values.thermostat_setpoint_status is not None: + if device.changeable_values.thermostat_setpoint_status == "NoHold": data["thermostatSetpointStatus"] = "TemporaryHold" else: data["thermostatSetpointStatus"] = ( - device.changeableValues.thermostatSetpointStatus + device.changeable_values.thermostat_setpoint_status ) if data.get("thermostatSetpointStatus", "") == "HoldUntil": if next_period_time is not None: data["nextPeriodTime"] = next_period_time - elif device.changeableValues.nextPeriodTime == "NoHold" and mode is None: + elif device.changeable_values.next_period_time == "NoHold" and mode is None: data["nextPeriodTime"] = "TemporaryHold" else: - data["nextPeriodTime"] = device.changeableValues.nextPeriodTime + data["nextPeriodTime"] = device.changeable_values.next_period_time self.logger.debug(data) return await self._client.post( - f"{BASE_URL}/devices/thermostats/{device.deviceID}?apikey={self._client_id}&locationId={location.locationID}", + f"{BASE_URL}/devices/thermostats/{device.device_id}?apikey={self._client_id}&locationId={location.location_id}", json=data, ) @@ -187,6 +189,6 @@ async def update_fan( self.logger.debug(data) return await self._client.post( - f"{BASE_URL}/devices/thermostats/{device.deviceID}/fan?apikey={self._client_id}&locationId={location.locationID}", + f"{BASE_URL}/devices/thermostats/{device.device_id}/fan?apikey={self._client_id}&locationId={location.location_id}", json=data, ) diff --git a/aiolyric/objects/device.py b/aiolyric/objects/device.py index 8eaa236..113c73e 100644 --- a/aiolyric/objects/device.py +++ b/aiolyric/objects/device.py @@ -1,10 +1,9 @@ """Lyric device.""" -# pylint: disable=invalid-name from .base import LyricBaseClient, LyricBaseObject -class Vacationhold(LyricBaseObject): +class VacationHold(LyricBaseObject): """Vacation hold.""" @property @@ -13,7 +12,7 @@ def enabled(self): return self.attributes.get("enabled", False) -class Currentscheduleperiod(LyricBaseObject): +class CurrentSchedulePeriod(LyricBaseObject): """Current schedule period.""" @property @@ -27,35 +26,35 @@ def period(self): return self.attributes.get("period", None) -class Schedulecapabilities(LyricBaseObject): +class ScheduleCapabilities(LyricBaseObject): """Schedule capabilities.""" @property - def availableScheduleTypes(self): + def available_schedule_types(self): """Return available schedule types.""" return self.attributes.get("availableScheduleTypes", []) @property - def schedulableFan(self): + def schedulable_fan(self): """Return if fan is schedulable.""" return self.attributes.get("schedulableFan", False) -class Scheduletype(LyricBaseObject): +class ScheduleType(LyricBaseObject): """Schedule type.""" @property - def scheduleType(self): + def schedule_type(self): """Return the schedule type.""" return self.attributes.get("scheduleType", None) @property - def scheduleSubType(self): + def schedule_sub_type(self): """Return the schedule sub type.""" return self.attributes.get("scheduleSubType", None) -class SettingsHardwaresettings(LyricBaseObject): +class SettingsHardwareSettings(LyricBaseObject): """Hardware settings.""" @property @@ -64,12 +63,12 @@ def brightness(self): return self.attributes.get("brightness", None) @property - def maxBrightness(self): + def max_brightness(self): """Return the max brightness.""" return self.attributes.get("maxBrightness", None) -class SettingsTemperaturemode(LyricBaseObject): +class SettingsTemperatureMode(LyricBaseObject): """Temperature mode.""" @property @@ -78,7 +77,7 @@ def air(self): return self.attributes.get("air", True) -class SettingsSpecialmode(LyricBaseObject): +class SettingsSpecialMode(LyricBaseObject): """Special mode.""" @@ -86,27 +85,27 @@ class Settings(LyricBaseObject): """Settings.""" @property - def hardwareSettings(self): + def hardware_settings(self): """Return hardware settings.""" - return SettingsHardwaresettings(self.attributes.get("hardwareSettings", {})) + return SettingsHardwareSettings(self.attributes.get("hardwareSettings", {})) @property - def temperatureMode(self): + def temperature_mode(self): """Return temperature mode.""" - return SettingsTemperaturemode(self.attributes.get("temperatureMode", {})) + return SettingsTemperatureMode(self.attributes.get("temperatureMode", {})) @property - def specialMode(self): + def special_mode(self): """Return special mode.""" - return SettingsSpecialmode(self.attributes.get("specialMode", {})) + return SettingsSpecialMode(self.attributes.get("specialMode", {})) @property - def devicePairingEnabled(self): + def device_pairing_enabled(self): """Return if device pairing is enabled.""" return self.attributes.get("devicePairingEnabled", True) -class Devicesettings(LyricBaseObject): +class DeviceSettings(LyricBaseObject): """Device settings.""" @@ -119,7 +118,7 @@ def mode(self): return self.attributes.get("mode", None) -class Changeablevalues(LyricBaseObject): +class ChangeableValues(LyricBaseObject): """Changeable values.""" @property @@ -128,52 +127,52 @@ def mode(self): return self.attributes.get("mode", None) @property - def autoChangeoverActive(self): + def auto_changeover_active(self): """Return if auto changeover is active.""" return self.attributes.get("autoChangeoverActive", None) @property - def emergencyHeatActive(self): + def emergency_heat_active(self): """Return the thermostat setpoint status.""" return self.attributes.get("emergencyHeatActive", None) @property - def heatSetpoint(self): + def heat_setpoint(self): """Return the heat setpoint.""" return self.attributes.get("heatSetpoint", None) @property - def coolSetpoint(self): + def cool_setpoint(self): """Return the cool setpoint.""" return self.attributes.get("coolSetpoint", None) @property - def thermostatSetpointStatus(self): + def thermostat_setpoint_status(self): """Return the thermostat setpoint status.""" return self.attributes.get("thermostatSetpointStatus", None) @property - def nextPeriodTime(self): + def next_period_time(self): """Return the next period time.""" return self.attributes.get("nextPeriodTime", None) @property - def heatCoolMode(self): + def heat_cool_mode(self): """Return the heat cool mode.""" return self.attributes.get("heatCoolMode", None) @property - def endHeatSetpoint(self): + def end_heat_setpoint(self): """Return the end heat setpoint.""" return self.attributes.get("endHeatSetpoint", None) @property - def endCoolSetpoint(self): + def end_cool_setpoint(self): """Return the end cool setpoint.""" return self.attributes.get("endCoolSetpoint", None) -class Operationstatus(LyricBaseObject): +class OperationStatus(LyricBaseObject): """Operation status.""" @property @@ -182,12 +181,12 @@ def mode(self): return self.attributes.get("mode", None) @property - def fanRequest(self): + def fan_request(self): """Return the fan request.""" return self.attributes.get("fanRequest", False) @property - def circulationFanRequest(self): + def circulation_fan_request(self): """Return the circulation fan request.""" return self.attributes.get("circulationFanRequest", False) @@ -196,47 +195,47 @@ class LyricDevice(LyricBaseClient): """Lyric Device.""" @property - def locationID(self): + def location_id(self): """Return the location ID.""" return self.attributes.get("locationID", None) @property - def indoorHumidity(self): + def indoor_humidity(self): """Return the indoor humidity.""" return self.attributes.get("indoorHumidity", None) @property - def displayedOutdoorHumidity(self): + def displayed_outdoor_humidity(self): """Return the displayed outdoor humidity.""" return self.attributes.get("displayedOutdoorHumidity", None) @property - def vacationHold(self): + def vacation_hold(self): """Return the vacation hold.""" - return Vacationhold(self.attributes.get("vacationHold", {})) + return VacationHold(self.attributes.get("vacationHold", {})) @property - def currentSchedulePeriod(self): + def current_schedule_period(self): """Return the current schedule period.""" - return Currentscheduleperiod(self.attributes.get("currentSchedulePeriod", {})) + return CurrentSchedulePeriod(self.attributes.get("currentSchedulePeriod", {})) @property - def scheduleCapabilities(self): + def schedule_capabilities(self): """Return the schedule capabilities.""" - return Schedulecapabilities(self.attributes.get("scheduleCapabilities", {})) + return ScheduleCapabilities(self.attributes.get("scheduleCapabilities", {})) @property - def scheduleType(self): + def schedule_type(self): """Return the schedule type.""" - return Scheduletype(self.attributes.get("scheduleType", {})) + return ScheduleType(self.attributes.get("scheduleType", {})) @property - def scheduleStatus(self): + def schedule_status(self): """Return the schedule status.""" return self.attributes.get("scheduleStatus", None) @property - def allowedTimeIncrements(self): + def allowed_time_increments(self): """Return the allowed time increments.""" return self.attributes.get("allowedTimeIncrements", None) @@ -246,17 +245,17 @@ def settings(self): return Settings(self.attributes.get("settings", {})) @property - def deviceClass(self): + def device_class(self): """Return the device class.""" return self.attributes.get("deviceClass", None) @property - def deviceType(self): + def device_type(self): """Return the device type.""" return self.attributes.get("deviceType", None) @property - def deviceID(self): + def device_id(self): """Return the device ID.""" return self.attributes.get("deviceID", None) @@ -266,29 +265,29 @@ def name(self): return self.attributes.get("name", None) @property - def isAlive(self): + def is_alive(self): """Return if the device is alive.""" return self.attributes.get("isAlive", True) @property - def isUpgrading(self): + def is_upgrading(self): """Return if the device is upgrading.""" return self.attributes.get("isUpgrading", False) @property - def isProvisioned(self): + def is_provisioned(self): """Return if the device is provisioned.""" return self.attributes.get("isProvisioned", True) @property - def macID(self): + def mac_id(self): """Return the MAC ID.""" return self.attributes.get("macID", None) @property - def deviceSettings(self): + def device_settings(self): """Return the device settings.""" - return Devicesettings(self.attributes.get("deviceSettings", {})) + return DeviceSettings(self.attributes.get("deviceSettings", {})) @property def service(self): @@ -296,12 +295,12 @@ def service(self): return Service(self.attributes.get("service", {})) @property - def deviceRegistrationDate(self): + def device_registration_date(self): """Return the device registration date.""" return self.attributes.get("deviceRegistrationDate", None) @property - def dataSyncStatus(self): + def data_sync_status(self): """Return the data sync status.""" return self.attributes.get("dataSyncStatus", None) @@ -311,17 +310,17 @@ def units(self): return self.attributes.get("units", None) @property - def indoorTemperature(self): + def indoor_temperature(self): """Return the indoor temperature.""" return self.attributes.get("indoorTemperature", None) @property - def outdoorTemperature(self): + def outdoor_temperature(self): """Return the outdoor temperature.""" return self.attributes.get("outdoorTemperature", None) @property - def allowedModes(self): + def allowed_modes(self): """Return the allowed modes.""" return self.attributes.get("allowedModes", []) @@ -331,46 +330,46 @@ def deadband(self): return self.attributes.get("deadband", None) @property - def hasDualSetpointStatus(self): + def has_dual_setpoint_status(self): """Return if the device has dual setpoint status.""" return self.attributes.get("hasDualSetpointStatus", False) @property - def minHeatSetpoint(self): + def min_heat_setpoint(self): """Return the minimum heat setpoint.""" return self.attributes.get("minHeatSetpoint", None) @property - def maxHeatSetpoint(self): + def max_heat_setpoint(self): """Return the maximum heat setpoint.""" return self.attributes.get("maxHeatSetpoint", None) @property - def minCoolSetpoint(self): + def min_cool_setpoint(self): """Return the minimum cool setpoint.""" return self.attributes.get("minCoolSetpoint", None) @property - def maxCoolSetpoint(self): + def max_cool_setpoint(self): """Return the maximum cool setpoint.""" return self.attributes.get("maxCoolSetpoint", None) @property - def changeableValues(self): + def changeable_values(self): """Return the changeable values.""" - return Changeablevalues(self.attributes.get("changeableValues", {})) + return ChangeableValues(self.attributes.get("changeableValues", {})) @property - def operationStatus(self): + def operation_status(self): """Return the operation status.""" - return Operationstatus(self.attributes.get("operationStatus", {})) + return OperationStatus(self.attributes.get("operationStatus", {})) @property - def deviceModel(self): + def device_model(self): """Return the device model.""" return self.attributes.get("deviceModel", None) @property - def fanMode(self): + def fan_mode(self): """Return the fan mode.""" return self.attributes.get("fanMode", None) diff --git a/aiolyric/objects/location.py b/aiolyric/objects/location.py index 51d0734..6e10031 100644 --- a/aiolyric/objects/location.py +++ b/aiolyric/objects/location.py @@ -1,15 +1,14 @@ """Lyric location.""" -# pylint: disable=invalid-name from .base import LyricBaseClient, LyricBaseObject from .device import LyricDevice -class Locationrolemapping(LyricBaseObject): +class LocationRoleMapping(LyricBaseObject): """Represents a location role mapping.""" @property - def locationID(self): + def location_id(self): """The ID of the location.""" return self.attributes.get("locationID", None) @@ -19,7 +18,7 @@ def role(self): return self.attributes.get("role", None) @property - def locationName(self): + def location_name(self): """The name of the location.""" return self.attributes.get("locationName", None) @@ -29,11 +28,11 @@ def status(self): return self.attributes.get("status", None) -class Users(LyricBaseObject): +class User(LyricBaseObject): """Represents a user.""" @property - def userID(self): + def user_id(self): """The ID of the user.""" return self.attributes.get("userID", None) @@ -43,12 +42,12 @@ def username(self): return self.attributes.get("username", None) @property - def firstname(self): + def first_name(self): """The first name of the user.""" return self.attributes.get("firstname", None) @property - def lastname(self): + def last_name(self): """The last name of the user.""" return self.attributes.get("lastname", None) @@ -68,25 +67,25 @@ def activated(self): return self.attributes.get("activated", True) @property - def connectedHomeAccountExists(self): + def connected_home_account_exists(self): """Whether a connected home account exists for the user.""" return self.attributes.get("connectedHomeAccountExists", True) @property - def locationRoleMapping(self): + def location_role_mapping(self): """The location role mappings of the user.""" return [ - Locationrolemapping(x) + LocationRoleMapping(x) for x in self.attributes.get("locationRoleMapping", []) ] @property - def isOptOut(self): + def is_opt_out(self): """Whether the user has opted out.""" return self.attributes.get("isOptOut", None) @property - def isCurrentUser(self): + def is_current_user(self): """Whether the user is the current user.""" return self.attributes.get("isCurrentUser", True) @@ -119,7 +118,7 @@ def days(self): return self.attributes.get("days", []) -class ConfigurationFacerecognition(LyricBaseObject): +class ConfigurationFaceRecognition(LyricBaseObject): """Represents the face recognition configuration.""" @property @@ -128,17 +127,17 @@ def enabled(self): return self.attributes.get("enabled", False) @property - def maxPersons(self): + def max_persons(self): """The maximum number of persons for face recognition.""" return self.attributes.get("maxPersons", None) @property - def maxEtas(self): + def max_etas(self): """The maximum number of ETAs for face recognition.""" return self.attributes.get("maxEtas", None) @property - def maxEtaPersons(self): + def max_eta_persons(self): """The maximum number of ETA persons for face recognition.""" return self.attributes.get("maxEtaPersons", None) @@ -152,16 +151,16 @@ class Configuration(LyricBaseObject): """Represents the configuration of a location.""" @property - def faceRecognition(self): + def face_recognition(self): """The face recognition configuration.""" - return ConfigurationFacerecognition(self.attributes.get("faceRecognition", {})) + return ConfigurationFaceRecognition(self.attributes.get("faceRecognition", {})) class LyricLocation(LyricBaseClient): """Represents a Lyric location.""" @property - def locationID(self): + def location_id(self): """The ID of the location.""" return self.attributes.get("locationID", None) @@ -185,7 +184,7 @@ def devices(self) -> list[LyricDevice]: """The devices associated with the location.""" devices = [] for x in self.attributes.get("devices", []): - x["locationID"] = self.locationID + x["locationID"] = self.location_id devices.append(LyricDevice(self.client, x)) return devices @@ -194,51 +193,51 @@ def devices_dict(self) -> dict: """A dictionary of devices associated with the location.""" devices_dict: dict = {} for device in self.devices: - devices_dict[device.macID] = device + devices_dict[device.mac_id] = device return devices_dict @property def users(self): """The users associated with the location.""" - return [Users(x) for x in self.attributes.get("users", [])] + return [User(x) for x in self.attributes.get("users", [])] @property - def timeZone(self): + def time_zone(self): """The timezone of the location.""" return self.attributes.get("timeZone", None) @property - def ianaTimeZone(self): + def iana_time_zone(self): """The IANA timezone of the location.""" return self.attributes.get("ianaTimeZone", None) @property - def daylightSavingTimeEnabled(self): + def daylight_saving_time_enabled(self): """Whether daylight saving time is enabled for the location.""" return self.attributes.get("daylightSavingTimeEnabled", True) @property - def geoFenceEnabled(self): + def geo_fence_enabled(self): """Whether geofencing is enabled for the location.""" return self.attributes.get("geoFenceEnabled", False) @property - def predictiveAIREnabled(self): - """Whether predictive AI is enabled for the location.""" + def predictive_air_enabled(self): + """Whether predictive air is enabled for the location.""" return self.attributes.get("predictiveAIREnabled", False) @property - def comfortLevel(self): + def comfort_level(self): """The comfort level of the location.""" return self.attributes.get("comfortLevel", None) @property - def geoFenceNotificationEnabled(self): + def geo_fence_notification_enabled(self): """Whether geofence notifications are enabled for the location.""" return self.attributes.get("geoFenceNotificationEnabled", False) @property - def geoFenceNotificationTypeId(self): + def geo_fence_notification_type_id(self): """The ID of the geofence notification type for the location.""" return self.attributes.get("geoFenceNotificationTypeId", None) diff --git a/aiolyric/objects/priority.py b/aiolyric/objects/priority.py index 1c3c53d..df8d1ef 100644 --- a/aiolyric/objects/priority.py +++ b/aiolyric/objects/priority.py @@ -1,5 +1,4 @@ """Lyric priority.""" -# pylint: disable=invalid-name from .base import LyricBaseObject @@ -18,12 +17,12 @@ def type(self): return self.attributes.get("type", "") @property - def excludeTemp(self): + def exclude_temp(self): """Check if temperature is excluded for the accessory.""" return self.attributes.get("excludeTemp", False) @property - def excludeMotion(self): + def exclude_motion(self): """Check if motion is excluded for the accessory.""" return self.attributes.get("excludeMotion", False) @@ -38,7 +37,7 @@ def status(self): return self.attributes.get("status", "") @property - def detectMotion(self): + def detect_motion(self): """Check if motion is detected for the accessory.""" return self.attributes.get("detectMotion", False) @@ -52,22 +51,22 @@ def id(self): return self.attributes.get("id", None) @property - def roomName(self): + def room_name(self): """Get the name of the room.""" return self.attributes.get("roomName", "") @property - def roomAvgTemp(self): + def room_avg_temp(self): """Get the average temperature of the room.""" return self.attributes.get("roomAvgTemp", None) @property - def roomAvgHumidity(self): + def room_avg_humidity(self): """Get the average humidity of the room.""" return self.attributes.get("roomAvgHumidity", None) @property - def overallMotion(self): + def overall_motion(self): """Check if motion is detected in the room.""" return self.attributes.get("overallMotion", False) @@ -81,12 +80,12 @@ class CurrentPriority(LyricBaseObject): """Class representing the current priority.""" @property - def priorityType(self): + def priority_type(self): """Get the type of the priority.""" return self.attributes.get("priorityType", "") @property - def selectedRooms(self): + def selected_rooms(self): """Get the list of selected rooms for the priority.""" return self.attributes.get("selectedRooms", []) @@ -100,7 +99,7 @@ class LyricPriority(LyricBaseObject): """Class representing Lyric priority.""" @property - def deviceId(self): + def device_id(self): """Get the ID of the device.""" return self.attributes.get("deviceId", "") @@ -110,6 +109,6 @@ def status(self): return self.attributes.get("status", "") @property - def currentPriority(self): + def current_priority(self): """Get the current priority.""" return CurrentPriority(self.attributes.get("currentPriority", {})) diff --git a/tests/objects/test_device.py b/tests/objects/test_device.py index bba49be..5b81664 100644 --- a/tests/objects/test_device.py +++ b/tests/objects/test_device.py @@ -1,7 +1,7 @@ """Test device object.""" from aiolyric.client import LyricClient -from aiolyric.objects.device import Devicesettings, LyricDevice, SettingsSpecialmode +from aiolyric.objects.device import DeviceSettings, LyricDevice, SettingsSpecialMode def test_device( @@ -10,131 +10,137 @@ def test_device( ): """Test device object.""" obj = LyricDevice(lyric_client, device_fixture_response) - assert obj.locationID == device_fixture_response["locationID"] - assert obj.indoorHumidity == device_fixture_response["indoorHumidity"] + assert obj.location_id == device_fixture_response["locationID"] + assert obj.indoor_humidity == device_fixture_response["indoorHumidity"] assert ( - obj.displayedOutdoorHumidity + obj.displayed_outdoor_humidity == device_fixture_response["displayedOutdoorHumidity"] ) assert ( - obj.vacationHold.enabled == device_fixture_response["vacationHold"]["enabled"] + obj.vacation_hold.enabled == device_fixture_response["vacationHold"]["enabled"] ) assert ( - obj.currentSchedulePeriod.day + obj.current_schedule_period.day == device_fixture_response["currentSchedulePeriod"]["day"] ) assert ( - obj.currentSchedulePeriod.period + obj.current_schedule_period.period == device_fixture_response["currentSchedulePeriod"]["period"] ) assert ( - obj.scheduleCapabilities.availableScheduleTypes[0] + obj.schedule_capabilities.available_schedule_types[0] == device_fixture_response["scheduleCapabilities"]["availableScheduleTypes"][0] ) assert ( - obj.scheduleCapabilities.schedulableFan + obj.schedule_capabilities.schedulable_fan == device_fixture_response["scheduleCapabilities"]["schedulableFan"] ) assert ( - obj.scheduleType.scheduleType + obj.schedule_type.schedule_type == device_fixture_response["scheduleType"]["scheduleType"] ) assert ( - obj.scheduleType.scheduleSubType + obj.schedule_type.schedule_sub_type == device_fixture_response["scheduleType"]["scheduleSubType"] ) - assert obj.scheduleStatus == device_fixture_response["scheduleStatus"] - assert obj.allowedTimeIncrements == device_fixture_response["allowedTimeIncrements"] + assert obj.schedule_status == device_fixture_response["scheduleStatus"] assert ( - obj.settings.hardwareSettings.brightness + obj.allowed_time_increments == device_fixture_response["allowedTimeIncrements"] + ) + assert ( + obj.settings.hardware_settings.brightness == device_fixture_response["settings"]["hardwareSettings"]["brightness"] ) assert ( - obj.settings.hardwareSettings.maxBrightness + obj.settings.hardware_settings.max_brightness == device_fixture_response["settings"]["hardwareSettings"]["maxBrightness"] ) assert ( - obj.settings.temperatureMode.air + obj.settings.temperature_mode.air == device_fixture_response["settings"]["temperatureMode"]["air"] ) - assert isinstance(obj.settings.specialMode, SettingsSpecialmode) + assert isinstance(obj.settings.special_mode, SettingsSpecialMode) assert ( - obj.settings.devicePairingEnabled + obj.settings.device_pairing_enabled == device_fixture_response["settings"]["devicePairingEnabled"] ) - assert obj.deviceClass == device_fixture_response["deviceClass"] - assert obj.deviceType == device_fixture_response["deviceType"] - assert obj.deviceID == device_fixture_response["deviceID"] + assert obj.device_class == device_fixture_response["deviceClass"] + assert obj.device_type == device_fixture_response["deviceType"] + assert obj.device_id == device_fixture_response["deviceID"] assert obj.name == device_fixture_response["name"] - assert obj.isAlive == device_fixture_response["isAlive"] - assert obj.isUpgrading == device_fixture_response["isUpgrading"] - assert obj.isProvisioned == device_fixture_response["isProvisioned"] - assert obj.macID == device_fixture_response["macID"] - assert isinstance(obj.deviceSettings, Devicesettings) + assert obj.is_alive == device_fixture_response["isAlive"] + assert obj.is_upgrading == device_fixture_response["isUpgrading"] + assert obj.is_provisioned == device_fixture_response["isProvisioned"] + assert obj.mac_id == device_fixture_response["macID"] + assert isinstance(obj.device_settings, DeviceSettings) assert obj.service.mode == device_fixture_response["service"]["mode"] assert ( - obj.deviceRegistrationDate == device_fixture_response["deviceRegistrationDate"] + obj.device_registration_date + == device_fixture_response["deviceRegistrationDate"] ) - assert obj.dataSyncStatus == device_fixture_response["dataSyncStatus"] + assert obj.data_sync_status == device_fixture_response["dataSyncStatus"] assert obj.units == device_fixture_response["units"] - assert obj.indoorTemperature == device_fixture_response["indoorTemperature"] - assert obj.outdoorTemperature == device_fixture_response["outdoorTemperature"] - assert obj.allowedModes[0] == device_fixture_response["allowedModes"][0] + assert obj.indoor_temperature == device_fixture_response["indoorTemperature"] + assert obj.outdoor_temperature == device_fixture_response["outdoorTemperature"] + assert obj.allowed_modes[0] == device_fixture_response["allowedModes"][0] assert obj.deadband == device_fixture_response["deadband"] - assert obj.hasDualSetpointStatus == device_fixture_response["hasDualSetpointStatus"] - assert obj.minHeatSetpoint == device_fixture_response["minHeatSetpoint"] - assert obj.maxHeatSetpoint == device_fixture_response["maxHeatSetpoint"] - assert obj.minCoolSetpoint == device_fixture_response["minCoolSetpoint"] - assert obj.maxCoolSetpoint == device_fixture_response["maxCoolSetpoint"] assert ( - obj.changeableValues.autoChangeoverActive + obj.has_dual_setpoint_status == device_fixture_response["hasDualSetpointStatus"] + ) + assert obj.min_heat_setpoint == device_fixture_response["minHeatSetpoint"] + assert obj.max_heat_setpoint == device_fixture_response["maxHeatSetpoint"] + assert obj.min_cool_setpoint == device_fixture_response["minCoolSetpoint"] + assert obj.max_cool_setpoint == device_fixture_response["maxCoolSetpoint"] + assert ( + obj.changeable_values.auto_changeover_active == device_fixture_response["changeableValues"]["autoChangeoverActive"] ) assert ( - obj.changeableValues.emergencyHeatActive + obj.changeable_values.emergency_heat_active == device_fixture_response["changeableValues"]["emergencyHeatActive"] ) assert ( - obj.changeableValues.mode == device_fixture_response["changeableValues"]["mode"] + obj.changeable_values.mode + == device_fixture_response["changeableValues"]["mode"] ) assert ( - obj.changeableValues.heatSetpoint + obj.changeable_values.heat_setpoint == device_fixture_response["changeableValues"]["heatSetpoint"] ) assert ( - obj.changeableValues.coolSetpoint + obj.changeable_values.cool_setpoint == device_fixture_response["changeableValues"]["coolSetpoint"] ) assert ( - obj.changeableValues.thermostatSetpointStatus + obj.changeable_values.thermostat_setpoint_status == device_fixture_response["changeableValues"]["thermostatSetpointStatus"] ) assert ( - obj.changeableValues.nextPeriodTime + obj.changeable_values.next_period_time == device_fixture_response["changeableValues"]["nextPeriodTime"] ) assert ( - obj.changeableValues.heatCoolMode + obj.changeable_values.heat_cool_mode == device_fixture_response["changeableValues"]["heatCoolMode"] ) assert ( - obj.changeableValues.endHeatSetpoint + obj.changeable_values.end_heat_setpoint == device_fixture_response["changeableValues"]["endHeatSetpoint"] ) assert ( - obj.changeableValues.endCoolSetpoint + obj.changeable_values.end_cool_setpoint == device_fixture_response["changeableValues"]["endCoolSetpoint"] ) assert ( - obj.operationStatus.mode == device_fixture_response["operationStatus"]["mode"] + obj.operation_status.mode == device_fixture_response["operationStatus"]["mode"] ) assert ( - obj.operationStatus.fanRequest + obj.operation_status.fan_request == device_fixture_response["operationStatus"]["fanRequest"] ) assert ( - obj.operationStatus.circulationFanRequest + obj.operation_status.circulation_fan_request == device_fixture_response["operationStatus"]["circulationFanRequest"] ) - assert obj.deviceModel == device_fixture_response["deviceModel"] - assert obj.fanMode == device_fixture_response["fanMode"] + assert obj.device_model == device_fixture_response["deviceModel"] + assert obj.fan_mode == device_fixture_response["fanMode"] diff --git a/tests/objects/test_location.py b/tests/objects/test_location.py index 82d47ec..095cfcb 100644 --- a/tests/objects/test_location.py +++ b/tests/objects/test_location.py @@ -13,284 +13,286 @@ def test_location( lyric_client, location_fixture_response, ) - assert obj.locationID == location_fixture_response["locationID"] + assert obj.location_id == location_fixture_response["locationID"] assert obj.name == location_fixture_response["name"] assert obj.country == location_fixture_response["country"] assert obj.zipcode == location_fixture_response["zipcode"] assert isinstance(obj.devices_dict, dict) assert ( - obj.devices[0].displayedOutdoorHumidity + obj.devices[0].displayed_outdoor_humidity == location_fixture_response["devices"][0]["displayedOutdoorHumidity"] ) assert ( - obj.devices[0].vacationHold.enabled + obj.devices[0].vacation_hold.enabled == location_fixture_response["devices"][0]["vacationHold"]["enabled"] ) assert ( - obj.devices[0].currentSchedulePeriod.day + obj.devices[0].current_schedule_period.day == location_fixture_response["devices"][0]["currentSchedulePeriod"]["day"] ) assert ( - obj.devices[0].currentSchedulePeriod.period + obj.devices[0].current_schedule_period.period == location_fixture_response["devices"][0]["currentSchedulePeriod"]["period"] ) assert ( - obj.devices[0].scheduleCapabilities.availableScheduleTypes + obj.devices[0].schedule_capabilities.available_schedule_types == location_fixture_response["devices"][0]["scheduleCapabilities"][ "availableScheduleTypes" ] ) assert ( - obj.devices[0].scheduleCapabilities.schedulableFan + obj.devices[0].schedule_capabilities.schedulable_fan == location_fixture_response["devices"][0]["scheduleCapabilities"][ "schedulableFan" ] ) assert ( - obj.devices[0].scheduleType.scheduleType + obj.devices[0].schedule_type.schedule_type == location_fixture_response["devices"][0]["scheduleType"]["scheduleType"] ) assert ( - obj.devices[0].scheduleType.scheduleSubType + obj.devices[0].schedule_type.schedule_sub_type == location_fixture_response["devices"][0]["scheduleType"]["scheduleSubType"] ) assert ( - obj.devices[0].scheduleStatus + obj.devices[0].schedule_status == location_fixture_response["devices"][0]["scheduleStatus"] ) assert ( - obj.devices[0].allowedTimeIncrements + obj.devices[0].allowed_time_increments == location_fixture_response["devices"][0]["allowedTimeIncrements"] ) assert ( - obj.devices[0].settings.hardwareSettings.brightness + obj.devices[0].settings.hardware_settings.brightness == location_fixture_response["devices"][0]["settings"]["hardwareSettings"][ "brightness" ] ) assert ( - obj.devices[0].settings.hardwareSettings.maxBrightness + obj.devices[0].settings.hardware_settings.max_brightness == location_fixture_response["devices"][0]["settings"]["hardwareSettings"][ "maxBrightness" ] ) assert ( - obj.devices[0].settings.temperatureMode.air + obj.devices[0].settings.temperature_mode.air == location_fixture_response["devices"][0]["settings"]["temperatureMode"]["air"] ) assert ( - obj.devices[0].settings.devicePairingEnabled + obj.devices[0].settings.device_pairing_enabled == location_fixture_response["devices"][0]["settings"]["devicePairingEnabled"] ) assert ( - obj.devices[0].deviceClass + obj.devices[0].device_class == location_fixture_response["devices"][0]["deviceClass"] ) assert ( - obj.devices[0].deviceType + obj.devices[0].device_type == location_fixture_response["devices"][0]["deviceType"] ) assert ( - obj.devices[0].deviceID == location_fixture_response["devices"][0]["deviceID"] + obj.devices[0].device_id == location_fixture_response["devices"][0]["deviceID"] ) assert obj.devices[0].name == location_fixture_response["devices"][0]["name"] - assert obj.devices[0].isAlive == location_fixture_response["devices"][0]["isAlive"] + assert obj.devices[0].is_alive == location_fixture_response["devices"][0]["isAlive"] assert ( - obj.devices[0].isUpgrading + obj.devices[0].is_upgrading == location_fixture_response["devices"][0]["isUpgrading"] ) assert ( - obj.devices[0].isProvisioned + obj.devices[0].is_provisioned == location_fixture_response["devices"][0]["isProvisioned"] ) - assert obj.devices[0].macID == location_fixture_response["devices"][0]["macID"] + assert obj.devices[0].mac_id == location_fixture_response["devices"][0]["macID"] assert ( obj.devices[0].service.mode == location_fixture_response["devices"][0]["service"]["mode"] ) assert ( - obj.devices[0].deviceRegistrationDate + obj.devices[0].device_registration_date == location_fixture_response["devices"][0]["deviceRegistrationDate"] ) assert ( - obj.devices[0].dataSyncStatus + obj.devices[0].data_sync_status == location_fixture_response["devices"][0]["dataSyncStatus"] ) assert obj.devices[0].units == location_fixture_response["devices"][0]["units"] assert ( - obj.devices[0].indoorTemperature + obj.devices[0].indoor_temperature == location_fixture_response["devices"][0]["indoorTemperature"] ) assert ( - obj.devices[0].outdoorTemperature + obj.devices[0].outdoor_temperature == location_fixture_response["devices"][0]["outdoorTemperature"] ) assert ( - obj.devices[0].allowedModes + obj.devices[0].allowed_modes == location_fixture_response["devices"][0]["allowedModes"] ) assert ( obj.devices[0].deadband == location_fixture_response["devices"][0]["deadband"] ) assert ( - obj.devices[0].hasDualSetpointStatus + obj.devices[0].has_dual_setpoint_status == location_fixture_response["devices"][0]["hasDualSetpointStatus"] ) assert ( - obj.devices[0].minHeatSetpoint + obj.devices[0].min_heat_setpoint == location_fixture_response["devices"][0]["minHeatSetpoint"] ) assert ( - obj.devices[0].maxHeatSetpoint + obj.devices[0].max_heat_setpoint == location_fixture_response["devices"][0]["maxHeatSetpoint"] ) assert ( - obj.devices[0].minCoolSetpoint + obj.devices[0].min_cool_setpoint == location_fixture_response["devices"][0]["minCoolSetpoint"] ) assert ( - obj.devices[0].maxCoolSetpoint + obj.devices[0].max_cool_setpoint == location_fixture_response["devices"][0]["maxCoolSetpoint"] ) assert ( - obj.devices[0].changeableValues.mode + obj.devices[0].changeable_values.mode == location_fixture_response["devices"][0]["changeableValues"]["mode"] ) assert ( - obj.devices[0].changeableValues.heatSetpoint + obj.devices[0].changeable_values.heat_setpoint == location_fixture_response["devices"][0]["changeableValues"]["heatSetpoint"] ) assert ( - obj.devices[0].changeableValues.coolSetpoint + obj.devices[0].changeable_values.cool_setpoint == location_fixture_response["devices"][0]["changeableValues"]["coolSetpoint"] ) assert ( - obj.devices[0].changeableValues.thermostatSetpointStatus + obj.devices[0].changeable_values.thermostat_setpoint_status == location_fixture_response["devices"][0]["changeableValues"][ "thermostatSetpointStatus" ] ) assert ( - obj.devices[0].changeableValues.nextPeriodTime + obj.devices[0].changeable_values.next_period_time == location_fixture_response["devices"][0]["changeableValues"]["nextPeriodTime"] ) assert ( - obj.devices[0].changeableValues.heatCoolMode + obj.devices[0].changeable_values.heat_cool_mode == location_fixture_response["devices"][0]["changeableValues"]["heatCoolMode"] ) assert ( - obj.devices[0].changeableValues.endHeatSetpoint + obj.devices[0].changeable_values.end_heat_setpoint == location_fixture_response["devices"][0]["changeableValues"][ "endHeatSetpoint" ] ) assert ( - obj.devices[0].changeableValues.endCoolSetpoint + obj.devices[0].changeable_values.end_cool_setpoint == location_fixture_response["devices"][0]["changeableValues"][ "endCoolSetpoint" ] ) assert ( - obj.devices[0].operationStatus.mode + obj.devices[0].operation_status.mode == location_fixture_response["devices"][0]["operationStatus"]["mode"] ) assert ( - obj.devices[0].operationStatus.fanRequest + obj.devices[0].operation_status.fan_request == location_fixture_response["devices"][0]["operationStatus"]["fanRequest"] ) assert ( - obj.devices[0].operationStatus.circulationFanRequest + obj.devices[0].operation_status.circulation_fan_request == location_fixture_response["devices"][0]["operationStatus"][ "circulationFanRequest" ] ) assert ( - obj.devices[0].deviceModel + obj.devices[0].device_model == location_fixture_response["devices"][0]["deviceModel"] ) - assert obj.users[0].userID == location_fixture_response["users"][0]["userID"] + assert obj.users[0].user_id == location_fixture_response["users"][0]["userID"] assert obj.users[0].username == location_fixture_response["users"][0]["username"] - assert obj.users[0].firstname == location_fixture_response["users"][0]["firstname"] - assert obj.users[0].lastname == location_fixture_response["users"][0]["lastname"] + assert obj.users[0].first_name == location_fixture_response["users"][0]["firstname"] + assert obj.users[0].last_name == location_fixture_response["users"][0]["lastname"] assert obj.users[0].created == location_fixture_response["users"][0]["created"] assert obj.users[0].deleted == location_fixture_response["users"][0]["deleted"] assert obj.users[0].activated == location_fixture_response["users"][0]["activated"] assert ( - obj.users[0].connectedHomeAccountExists + obj.users[0].connected_home_account_exists == location_fixture_response["users"][0]["connectedHomeAccountExists"] ) assert ( - obj.users[0].locationRoleMapping[0].locationID + obj.users[0].location_role_mapping[0].location_id == location_fixture_response["users"][0]["locationRoleMapping"][0]["locationID"] ) assert ( - obj.users[0].locationRoleMapping[0].role + obj.users[0].location_role_mapping[0].role == location_fixture_response["users"][0]["locationRoleMapping"][0]["role"] ) assert ( - obj.users[0].locationRoleMapping[0].locationName + obj.users[0].location_role_mapping[0].location_name == location_fixture_response["users"][0]["locationRoleMapping"][0][ "locationName" ] ) assert ( - obj.users[0].locationRoleMapping[0].status + obj.users[0].location_role_mapping[0].status == location_fixture_response["users"][0]["locationRoleMapping"][0]["status"] ) - assert obj.users[0].isOptOut == location_fixture_response["users"][0]["isOptOut"] + assert obj.users[0].is_opt_out == location_fixture_response["users"][0]["isOptOut"] assert ( - obj.users[0].isCurrentUser + obj.users[0].is_current_user == location_fixture_response["users"][0]["isCurrentUser"] ) - assert obj.timeZone == location_fixture_response["timeZone"] - assert obj.ianaTimeZone == location_fixture_response["ianaTimeZone"] + assert obj.time_zone == location_fixture_response["timeZone"] + assert obj.iana_time_zone == location_fixture_response["ianaTimeZone"] assert ( - obj.daylightSavingTimeEnabled + obj.daylight_saving_time_enabled == location_fixture_response["daylightSavingTimeEnabled"] ) - assert obj.geoFenceEnabled == location_fixture_response["geoFenceEnabled"] - assert obj.predictiveAIREnabled == location_fixture_response["predictiveAIREnabled"] - assert obj.comfortLevel == location_fixture_response["comfortLevel"] + assert obj.geo_fence_enabled == location_fixture_response["geoFenceEnabled"] assert ( - obj.geoFenceNotificationEnabled + obj.predictive_air_enabled == location_fixture_response["predictiveAIREnabled"] + ) + assert obj.comfort_level == location_fixture_response["comfortLevel"] + assert ( + obj.geo_fence_notification_enabled == location_fixture_response["geoFenceNotificationEnabled"] ) assert ( - obj.geoFenceNotificationTypeId + obj.geo_fence_notification_type_id == location_fixture_response["geoFenceNotificationTypeId"] ) assert ( - obj.configuration.faceRecognition.enabled + obj.configuration.face_recognition.enabled == location_fixture_response["configuration"]["faceRecognition"]["enabled"] ) assert ( - obj.configuration.faceRecognition.maxPersons + obj.configuration.face_recognition.max_persons == location_fixture_response["configuration"]["faceRecognition"]["maxPersons"] ) assert ( - obj.configuration.faceRecognition.maxEtas + obj.configuration.face_recognition.max_etas == location_fixture_response["configuration"]["faceRecognition"]["maxEtas"] ) assert ( - obj.configuration.faceRecognition.maxEtaPersons + obj.configuration.face_recognition.max_eta_persons == location_fixture_response["configuration"]["faceRecognition"][ "maxEtaPersons" ] ) assert ( - obj.configuration.faceRecognition.schedules[0].time[0].start + obj.configuration.face_recognition.schedules[0].time[0].start == location_fixture_response["configuration"]["faceRecognition"]["schedules"][ 0 ]["time"][0]["start"] ) assert ( - obj.configuration.faceRecognition.schedules[0].time[0].end + obj.configuration.face_recognition.schedules[0].time[0].end == location_fixture_response["configuration"]["faceRecognition"]["schedules"][ 0 ]["time"][0]["end"] ) assert ( - obj.configuration.faceRecognition.schedules[0].days + obj.configuration.face_recognition.schedules[0].days == location_fixture_response["configuration"]["faceRecognition"]["schedules"][ 0 ]["days"] diff --git a/tests/objects/test_priority.py b/tests/objects/test_priority.py index e07666b..4eaa5bd 100644 --- a/tests/objects/test_priority.py +++ b/tests/objects/test_priority.py @@ -6,74 +6,74 @@ def test_priority(priority_fixture_response: dict): """Test priority object.""" obj = LyricPriority(priority_fixture_response) - assert obj.deviceId == priority_fixture_response["deviceId"] + assert obj.device_id == priority_fixture_response["deviceId"] assert obj.status == priority_fixture_response["status"] assert ( - obj.currentPriority.priorityType + obj.current_priority.priority_type == priority_fixture_response["currentPriority"]["priorityType"] ) assert ( - obj.currentPriority.selectedRooms[0] + obj.current_priority.selected_rooms[0] == priority_fixture_response["currentPriority"]["selectedRooms"][0] ) assert ( - obj.currentPriority.rooms[0].id + obj.current_priority.rooms[0].id == priority_fixture_response["currentPriority"]["rooms"][0]["id"] ) assert ( - obj.currentPriority.rooms[0].roomName + obj.current_priority.rooms[0].room_name == priority_fixture_response["currentPriority"]["rooms"][0]["roomName"] ) assert ( - obj.currentPriority.rooms[0].roomAvgTemp + obj.current_priority.rooms[0].room_avg_temp == priority_fixture_response["currentPriority"]["rooms"][0]["roomAvgTemp"] ) assert ( - obj.currentPriority.rooms[0].roomAvgHumidity + obj.current_priority.rooms[0].room_avg_humidity == priority_fixture_response["currentPriority"]["rooms"][0]["roomAvgHumidity"] ) assert ( - obj.currentPriority.rooms[0].overallMotion + obj.current_priority.rooms[0].overall_motion == priority_fixture_response["currentPriority"]["rooms"][0]["overallMotion"] ) assert ( - obj.currentPriority.rooms[0].accessories[0].id + obj.current_priority.rooms[0].accessories[0].id == priority_fixture_response["currentPriority"]["rooms"][0]["accessories"][0][ "id" ] ) assert ( - obj.currentPriority.rooms[0].accessories[0].type + obj.current_priority.rooms[0].accessories[0].type == priority_fixture_response["currentPriority"]["rooms"][0]["accessories"][0][ "type" ] ) assert ( - obj.currentPriority.rooms[0].accessories[0].excludeTemp + obj.current_priority.rooms[0].accessories[0].exclude_temp == priority_fixture_response["currentPriority"]["rooms"][0]["accessories"][0][ "excludeTemp" ] ) assert ( - obj.currentPriority.rooms[0].accessories[0].excludeMotion + obj.current_priority.rooms[0].accessories[0].exclude_motion == priority_fixture_response["currentPriority"]["rooms"][0]["accessories"][0][ "excludeMotion" ] ) assert ( - obj.currentPriority.rooms[0].accessories[0].temperature + obj.current_priority.rooms[0].accessories[0].temperature == priority_fixture_response["currentPriority"]["rooms"][0]["accessories"][0][ "temperature" ] ) assert ( - obj.currentPriority.rooms[0].accessories[0].status + obj.current_priority.rooms[0].accessories[0].status == priority_fixture_response["currentPriority"]["rooms"][0]["accessories"][0][ "status" ] ) assert ( - obj.currentPriority.rooms[0].accessories[0].detectMotion + obj.current_priority.rooms[0].accessories[0].detect_motion == priority_fixture_response["currentPriority"]["rooms"][0]["accessories"][0][ "detectMotion" ]