diff --git a/package-lock.json b/package-lock.json index facb866d..e6244d39 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11,9 +11,9 @@ "devDependencies": { "@prettier/plugin-php": "^0.25.0", "@seamapi/blueprint": "^1.13.2", - "@seamapi/fake-seam-connect": "2.0.6", + "@seamapi/fake-seam-connect": "2.0.8", "@seamapi/smith": "^1.2.0", - "@seamapi/types": "1.1186.0", + "@seamapi/types": "1.1189.0", "change-case": "^5.4.4", "execa": "^10.0.1", "prettier": "^3.9.6" @@ -838,9 +838,9 @@ } }, "node_modules/@seamapi/fake-seam-connect": { - "version": "2.0.6", - "resolved": "https://registry.npmjs.org/@seamapi/fake-seam-connect/-/fake-seam-connect-2.0.6.tgz", - "integrity": "sha512-lwesSVm0AhQ57QuV52iGTI2qkK++phcY0K/xkalsUWdbwyPK4cj2VfJuW3yes32HuTaXkwPWlT9lrIhLJzZOnQ==", + "version": "2.0.8", + "resolved": "https://registry.npmjs.org/@seamapi/fake-seam-connect/-/fake-seam-connect-2.0.8.tgz", + "integrity": "sha512-6/yvddZfoTQKoB90uSLINY9pdYdTLlVAhtiUhf3AyRUwgk3bTwAvfs8dowtyk2q8LjO+3LlHw38YS1BifHck8Q==", "dev": true, "license": "MIT", "bin": { @@ -889,9 +889,9 @@ } }, "node_modules/@seamapi/types": { - "version": "1.1186.0", - "resolved": "https://registry.npmjs.org/@seamapi/types/-/types-1.1186.0.tgz", - "integrity": "sha512-TS8MlcvUImYMFpKv8GRu7h6LEbWnlZnXslRTT17Pcj47NMjYF86JbycfKAiaM6qtZCqXMAEUB5COhYmLtOMVig==", + "version": "1.1189.0", + "resolved": "https://registry.npmjs.org/@seamapi/types/-/types-1.1189.0.tgz", + "integrity": "sha512-b4elCtQSd54yz8vtgDXw3dBXwX6RP2T+C8hkfbZ4NWGiq5VXCXE6iiNFLCXhZh4ecWY6QHD3cK9+lt+SEIkG3g==", "dev": true, "license": "MIT", "engines": { diff --git a/package.json b/package.json index b6e3d9a5..a40033d3 100644 --- a/package.json +++ b/package.json @@ -34,9 +34,9 @@ "devDependencies": { "@prettier/plugin-php": "^0.25.0", "@seamapi/blueprint": "^1.13.2", - "@seamapi/fake-seam-connect": "2.0.6", + "@seamapi/fake-seam-connect": "2.0.8", "@seamapi/smith": "^1.2.0", - "@seamapi/types": "1.1186.0", + "@seamapi/types": "1.1189.0", "change-case": "^5.4.4", "execa": "^10.0.1", "prettier": "^3.9.6" diff --git a/src/Resources/Device.php b/src/Resources/Device.php index 2f1d4730..18f89caf 100644 --- a/src/Resources/Device.php +++ b/src/Resources/Device.php @@ -24,17 +24,13 @@ public static function from_json(mixed $json): Device|null $json->errors ?? [], ), is_managed: $json->is_managed ?? null, - properties: isset($json->properties) - ? \Seam\Resources\Device\Properties::from_json( - $json->properties, - ) - : null, space_ids: $json->space_ids ?? null, warnings: array_map( fn($w) => \Seam\Resources\Device\Warnings::from_json($w), $json->warnings ?? [], ), workspace_id: $json->workspace_id ?? null, + air_quality_index: $json->air_quality_index ?? null, can_activate_weekly_program: $json->can_activate_weekly_program ?? null, can_configure_auto_lock: $json->can_configure_auto_lock ?? null, @@ -68,6 +64,8 @@ public static function from_json(mixed $json): Device|null can_stream_live_video: $json->can_stream_live_video ?? null, can_turn_off_hvac: $json->can_turn_off_hvac ?? null, can_unlock_with_code: $json->can_unlock_with_code ?? null, + co_ppm: $json->co_ppm ?? null, + co2_ppm: $json->co2_ppm ?? null, device_manufacturer: isset($json->device_manufacturer) ? \Seam\Resources\Device\DeviceManufacturer::from_json( $json->device_manufacturer, @@ -78,12 +76,32 @@ public static function from_json(mixed $json): Device|null $json->device_provider, ) : null, + is_occupied: $json->is_occupied ?? null, + is_smoking_detected: $json->is_smoking_detected ?? null, location: isset($json->location) ? \Seam\Resources\Device\Location::from_json( $json->location, ) : null, + mold_risk_level: $json->mold_risk_level ?? null, + named_sensors: array_map( + fn($n) => \Seam\Resources\Device\NamedSensors::from_json( + $n, + ), + $json->named_sensors ?? [], + ), nickname: $json->nickname ?? null, + noise_level_decibels: $json->noise_level_decibels ?? null, + noise_level_nrs: $json->noise_level_nrs ?? null, + occupant_count: $json->occupant_count ?? null, + properties: isset($json->properties) + ? \Seam\Resources\Device\Properties::from_json( + $json->properties, + ) + : null, + relative_humidity: $json->relative_humidity ?? null, + temperature_celsius: $json->temperature_celsius ?? null, + temperature_fahrenheit: $json->temperature_fahrenheit ?? null, ); } @@ -132,10 +150,6 @@ public function __construct( * Indicates whether Seam manages the device. See also [Managed and Unmanaged Devices](https://www.seam.co/docs/core-concepts/devices/managed-and-unmanaged-devices). */ public true|null $is_managed, - /** - * Properties of the device. - */ - public \Seam\Resources\Device\Properties|null $properties, /** * IDs of the spaces the device is in. * @@ -152,6 +166,10 @@ public function __construct( * Unique identifier for the Seam workspace associated with the device. */ public string|null $workspace_id, + /** + * Air quality index, if the device measures it. + */ + public float|null $air_quality_index = null, /** * Indicates whether the thermostat can be returned to its weekly program, the schedule that is configured on the device itself, releasing any hold that Seam has set. */ @@ -240,6 +258,14 @@ public function __construct( * Indicates whether the lock supports unlocking with an access code. */ public bool|null $can_unlock_with_code = null, + /** + * Carbon monoxide concentration in parts per million, if the device measures it. + */ + public float|null $co_ppm = null, + /** + * Carbon dioxide concentration in parts per million, if the device measures it. + */ + public float|null $co2_ppm = null, /** * Manufacturer of the device. Represents the hardware brand, which may differ from the provider. */ @@ -248,14 +274,60 @@ public function __construct( * Provider of the device. Represents the third-party service through which the device is controlled. */ public \Seam\Resources\Device\DeviceProvider|null $device_provider = null, + /** + * Indicates whether the device detects that the space is occupied, if the device measures occupancy. + */ + public bool|null $is_occupied = null, + /** + * Indicates whether the device detects smoking, if the device measures it. + */ + public bool|null $is_smoking_detected = null, /** * Location information for the device. */ public \Seam\Resources\Device\Location|null $location = null, + /** + * Mold risk level as reported by the device, if the device measures it. + */ + public string|null $mold_risk_level = null, + /** + * Additional sensors of the same kind on the device, each with a stable `sensor_name`. Present only when the device has more than one sensor of a kind or no single main sensor. + * + * @var list<\Seam\Resources\Device\NamedSensors>|null + */ + public array|null $named_sensors = null, /** * Optional nickname to describe the device, settable through Seam. */ public string|null $nickname = null, + /** + * Noise level in decibels, if the device measures noise. + */ + public float|null $noise_level_decibels = null, + /** + * Noise level as a Noise Risk Score (NRS), if the device reports one. + */ + public float|null $noise_level_nrs = null, + /** + * Number of occupants the device detects, if the device counts occupants. + */ + public float|null $occupant_count = null, + /** + * Properties of the device. + */ + public \Seam\Resources\Device\Properties|null $properties = null, + /** + * Relative humidity, as a value between 0 and 1, inclusive, if the device measures humidity. + */ + public float|null $relative_humidity = null, + /** + * Temperature in °C, if the device measures temperature. + */ + public float|null $temperature_celsius = null, + /** + * Temperature in °F, if the device measures temperature. + */ + public float|null $temperature_fahrenheit = null, ) {} } } @@ -471,6 +543,94 @@ public function __construct( ) {} } + /** + * Additional sensors of the same kind on the device, each with a stable `sensor_name`. Present only when the device has more than one sensor of a kind or no single main sensor. + */ + class NamedSensors + { + public static function from_json(mixed $json): NamedSensors|null + { + if (!$json) { + return null; + } + return new self( + display_name: $json->display_name ?? null, + sensor_name: $json->sensor_name ?? null, + air_quality_index: $json->air_quality_index ?? null, + co_ppm: $json->co_ppm ?? null, + co2_ppm: $json->co2_ppm ?? null, + is_occupied: $json->is_occupied ?? null, + is_smoking_detected: $json->is_smoking_detected ?? null, + mold_risk_level: $json->mold_risk_level ?? null, + noise_level_decibels: $json->noise_level_decibels ?? null, + noise_level_nrs: $json->noise_level_nrs ?? null, + occupant_count: $json->occupant_count ?? null, + relative_humidity: $json->relative_humidity ?? null, + temperature_celsius: $json->temperature_celsius ?? null, + temperature_fahrenheit: $json->temperature_fahrenheit ?? null, + ); + } + + public function __construct( + /** + * Display name of the sensor. Defaults to `sensor_name`. + */ + public string|null $display_name, + /** + * Stable, hardware-defined name of the sensor, such as a port number. + */ + public string|null $sensor_name, + /** + * Air quality index, if the device measures it. + */ + public float|null $air_quality_index = null, + /** + * Carbon monoxide concentration in parts per million, if the device measures it. + */ + public float|null $co_ppm = null, + /** + * Carbon dioxide concentration in parts per million, if the device measures it. + */ + public float|null $co2_ppm = null, + /** + * Indicates whether the device detects that the space is occupied, if the device measures occupancy. + */ + public bool|null $is_occupied = null, + /** + * Indicates whether the device detects smoking, if the device measures it. + */ + public bool|null $is_smoking_detected = null, + /** + * Mold risk level as reported by the device, if the device measures it. + */ + public string|null $mold_risk_level = null, + /** + * Noise level in decibels, if the device measures noise. + */ + public float|null $noise_level_decibels = null, + /** + * Noise level as a Noise Risk Score (NRS), if the device reports one. + */ + public float|null $noise_level_nrs = null, + /** + * Number of occupants the device detects, if the device counts occupants. + */ + public float|null $occupant_count = null, + /** + * Relative humidity, as a value between 0 and 1, inclusive, if the device measures humidity. + */ + public float|null $relative_humidity = null, + /** + * Temperature in °C, if the device measures temperature. + */ + public float|null $temperature_celsius = null, + /** + * Temperature in °F, if the device measures temperature. + */ + public float|null $temperature_fahrenheit = null, + ) {} + } + /** * Properties of the device. */ @@ -508,7 +668,6 @@ public static function from_json(mixed $json): Properties|null : null, active_thermostat_schedule_id: $json->active_thermostat_schedule_id ?? null, - air_quality_index: $json->air_quality_index ?? null, akiles_metadata: isset($json->akiles_metadata) ? \Seam\Resources\Device\Properties\AkilesMetadata::from_json( $json->akiles_metadata, @@ -577,8 +736,6 @@ public static function from_json(mixed $json): Properties|null $json->brivo_metadata, ) : null, - co_ppm: $json->co_ppm ?? null, - co2_ppm: $json->co2_ppm ?? null, code_constraints: array_map( fn( $c, @@ -666,8 +823,6 @@ public static function from_json(mixed $json): Properties|null is_cooling: $json->is_cooling ?? null, is_fan_running: $json->is_fan_running ?? null, is_heating: $json->is_heating ?? null, - is_occupied: $json->is_occupied ?? null, - is_smoking_detected: $json->is_smoking_detected ?? null, is_temporary_manual_override_active: $json->is_temporary_manual_override_active ?? null, keynest_metadata: isset($json->keynest_metadata) @@ -733,22 +888,12 @@ public static function from_json(mixed $json): Properties|null $json->minut_metadata, ) : null, - mold_risk_level: $json->mold_risk_level ?? null, - named_sensors: array_map( - fn( - $n, - ) => \Seam\Resources\Device\Properties\NamedSensors::from_json( - $n, - ), - $json->named_sensors ?? [], - ), nest_metadata: isset($json->nest_metadata) ? \Seam\Resources\Device\Properties\NestMetadata::from_json( $json->nest_metadata, ) : null, noise_level_decibels: $json->noise_level_decibels ?? null, - noise_level_nrs: $json->noise_level_nrs ?? null, noiseaware_metadata: isset($json->noiseaware_metadata) ? \Seam\Resources\Device\Properties\NoiseawareMetadata::from_json( $json->noiseaware_metadata, @@ -759,7 +904,6 @@ public static function from_json(mixed $json): Properties|null $json->nuki_metadata, ) : null, - occupant_count: $json->occupant_count ?? null, offline_access_codes_enabled: $json->offline_access_codes_enabled ?? null, offline_time_frame_options: array_map( @@ -956,10 +1100,6 @@ public function __construct( * ID of the active [thermostat schedule](https://www.seam.co/docs/capability-guides/thermostats/creating-and-managing-thermostat-schedules). */ public string|null $active_thermostat_schedule_id = null, - /** - * Air quality index, if the device measures it. `null` until the first value arrives. - */ - public float|null $air_quality_index = null, /** * Metadata for an Akiles device. */ @@ -1036,14 +1176,6 @@ public function __construct( * Metadata for a Brivo device. */ public \Seam\Resources\Device\Properties\BrivoMetadata|null $brivo_metadata = null, - /** - * Carbon monoxide concentration in parts per million, if the device measures it. `null` until the first value arrives. - */ - public float|null $co_ppm = null, - /** - * Carbon dioxide concentration in parts per million, if the device measures it. `null` until the first value arrives. - */ - public float|null $co2_ppm = null, /** * Constraints on access codes for the device. Seam represents each constraint as an object with a `constraint_type` property. Depending on the constraint type, there may also be additional properties. Note that some constraints are manufacturer- or device-specific. * @@ -1145,14 +1277,6 @@ public function __construct( * Indicates whether the connected HVAC system is currently heating, as reported by the thermostat. */ public bool|null $is_heating = null, - /** - * Indicates whether the device detects that the space is occupied, if the device measures occupancy. `null` until the first value arrives. - */ - public bool|null $is_occupied = null, - /** - * Indicates whether the device detects smoking, if the device measures it. `null` until the first value arrives. - */ - public bool|null $is_smoking_detected = null, /** * Indicates whether the current thermostat settings differ from the most recent active program or schedule that Seam activated. For this condition to occur, `current_climate_setting.manual_override_allowed` must also be `true`. */ @@ -1245,16 +1369,6 @@ public function __construct( * Metadata for a Minut device. */ public \Seam\Resources\Device\Properties\MinutMetadata|null $minut_metadata = null, - /** - * Mold risk level as reported by the device, if the device measures it. `null` until the first value arrives. - */ - public string|null $mold_risk_level = null, - /** - * Additional sensors of the same kind on the device, each with a stable `sensor_name`. Present only when the device has more than one sensor of a kind or no single main sensor. - * - * @var list<\Seam\Resources\Device\Properties\NamedSensors>|null - */ - public array|null $named_sensors = null, /** * Metadata for a Google Nest device. */ @@ -1263,10 +1377,6 @@ public function __construct( * Indicates current noise level in decibels, if the device supports noise detection. */ public float|null $noise_level_decibels = null, - /** - * Noise level as a Noise Risk Score (NRS), if the device reports one. `null` until the first value arrives. - */ - public float|null $noise_level_nrs = null, /** * Metadata for a NoiseAware device. */ @@ -1275,10 +1385,6 @@ public function __construct( * Metadata for a Nuki device. */ public \Seam\Resources\Device\Properties\NukiMetadata|null $nuki_metadata = null, - /** - * Number of occupants the device detects, if the device counts occupants. `null` until the first value arrives. - */ - public float|null $occupant_count = null, /** * Indicates whether it is currently possible to use offline access codes for the device. * @@ -2504,94 +2610,6 @@ public function __construct( ) {} } - /** - * Additional sensors of the same kind on the device, each with a stable `sensor_name`. Present only when the device has more than one sensor of a kind or no single main sensor. - */ - class NamedSensors - { - public static function from_json(mixed $json): NamedSensors|null - { - if (!$json) { - return null; - } - return new self( - display_name: $json->display_name ?? null, - sensor_name: $json->sensor_name ?? null, - air_quality_index: $json->air_quality_index ?? null, - co_ppm: $json->co_ppm ?? null, - co2_ppm: $json->co2_ppm ?? null, - is_occupied: $json->is_occupied ?? null, - is_smoking_detected: $json->is_smoking_detected ?? null, - mold_risk_level: $json->mold_risk_level ?? null, - noise_level_decibels: $json->noise_level_decibels ?? null, - noise_level_nrs: $json->noise_level_nrs ?? null, - occupant_count: $json->occupant_count ?? null, - relative_humidity: $json->relative_humidity ?? null, - temperature_celsius: $json->temperature_celsius ?? null, - temperature_fahrenheit: $json->temperature_fahrenheit ?? null, - ); - } - - public function __construct( - /** - * Display name of the sensor. Defaults to `sensor_name`. - */ - public string|null $display_name, - /** - * Stable, hardware-defined name of the sensor, such as a port number. - */ - public string|null $sensor_name, - /** - * Air quality index, if the device measures it. `null` until the first value arrives. - */ - public float|null $air_quality_index = null, - /** - * Carbon monoxide concentration in parts per million, if the device measures it. `null` until the first value arrives. - */ - public float|null $co_ppm = null, - /** - * Carbon dioxide concentration in parts per million, if the device measures it. `null` until the first value arrives. - */ - public float|null $co2_ppm = null, - /** - * Indicates whether the device detects that the space is occupied, if the device measures occupancy. `null` until the first value arrives. - */ - public bool|null $is_occupied = null, - /** - * Indicates whether the device detects smoking, if the device measures it. `null` until the first value arrives. - */ - public bool|null $is_smoking_detected = null, - /** - * Mold risk level as reported by the device, if the device measures it. `null` until the first value arrives. - */ - public string|null $mold_risk_level = null, - /** - * Noise level in decibels. `null` until the first value arrives. - */ - public float|null $noise_level_decibels = null, - /** - * Noise level as a Noise Risk Score (NRS), if the device reports one. `null` until the first value arrives. - */ - public float|null $noise_level_nrs = null, - /** - * Number of occupants the device detects, if the device counts occupants. `null` until the first value arrives. - */ - public float|null $occupant_count = null, - /** - * Reported relative humidity, as a value between 0 and 1, inclusive. `null` until the first value arrives. - */ - public float|null $relative_humidity = null, - /** - * Reported temperature in °C. `null` until the first value arrives. - */ - public float|null $temperature_celsius = null, - /** - * Reported temperature in °F. `null` until the first value arrives. - */ - public float|null $temperature_fahrenheit = null, - ) {} - } - /** * ASSA ABLOY Credential Service metadata for the phone. */ diff --git a/src/Resources/UnmanagedDevice.php b/src/Resources/UnmanagedDevice.php index 7e5f4280..915b3af7 100644 --- a/src/Resources/UnmanagedDevice.php +++ b/src/Resources/UnmanagedDevice.php @@ -26,11 +26,6 @@ public static function from_json(mixed $json): UnmanagedDevice|null $json->errors ?? [], ), is_managed: $json->is_managed ?? null, - properties: isset($json->properties) - ? \Seam\Resources\UnmanagedDevice\Properties::from_json( - $json->properties, - ) - : null, warnings: array_map( fn( $w, @@ -78,6 +73,11 @@ public static function from_json(mixed $json): UnmanagedDevice|null $json->location, ) : null, + properties: isset($json->properties) + ? \Seam\Resources\UnmanagedDevice\Properties::from_json( + $json->properties, + ) + : null, ); } @@ -126,10 +126,6 @@ public function __construct( * Indicates that Seam does not manage the device. */ public false|null $is_managed, - /** - * properties of the device. - */ - public \Seam\Resources\UnmanagedDevice\Properties|null $properties, /** * Array of warnings associated with the device. Each warning object within the array contains two fields: `warning_code` and `message`. `warning_code` is a string that uniquely identifies the type of warning, enabling quick recognition and categorization of the issue. `message` provides a more detailed description of the warning, offering insights into the issue and potentially how to rectify it. * @@ -232,6 +228,10 @@ public function __construct( * Location information for the device. */ public \Seam\Resources\UnmanagedDevice\Location|null $location = null, + /** + * properties of the device. + */ + public \Seam\Resources\UnmanagedDevice\Properties|null $properties = null, ) {} } }