@seamapi/react 2.20.0 → 3.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -4
- package/dist/elements.js +19676 -25734
- package/dist/elements.js.map +1 -1
- package/lib/object.d.ts +5 -0
- package/lib/object.js +14 -0
- package/lib/object.js.map +1 -0
- package/lib/seam/SeamProvider.d.ts +5 -4
- package/lib/seam/SeamProvider.js.map +1 -1
- package/lib/seam/access-codes/use-access-code.d.ts +3 -2
- package/lib/seam/access-codes/use-access-code.js +2 -3
- package/lib/seam/access-codes/use-access-code.js.map +1 -1
- package/lib/seam/access-codes/use-access-codes.d.ts +3 -2
- package/lib/seam/access-codes/use-access-codes.js +3 -5
- package/lib/seam/access-codes/use-access-codes.js.map +1 -1
- package/lib/seam/access-codes/use-create-access-code.d.ts +4 -3
- package/lib/seam/access-codes/use-create-access-code.js +5 -4
- package/lib/seam/access-codes/use-create-access-code.js.map +1 -1
- package/lib/seam/access-codes/use-delete-access-code.d.ts +4 -6
- package/lib/seam/access-codes/use-delete-access-code.js +10 -8
- package/lib/seam/access-codes/use-delete-access-code.js.map +1 -1
- package/lib/seam/access-codes/use-generate-access-code-code.d.ts +4 -4
- package/lib/seam/access-codes/use-generate-access-code-code.js +3 -2
- package/lib/seam/access-codes/use-generate-access-code-code.js.map +1 -1
- package/lib/seam/access-codes/use-update-access-code.d.ts +4 -4
- package/lib/seam/access-codes/use-update-access-code.js +9 -7
- package/lib/seam/access-codes/use-update-access-code.js.map +1 -1
- package/lib/seam/client-sessions/use-client-session.d.ts +1 -1
- package/lib/seam/client-sessions/use-client-session.js +1 -1
- package/lib/seam/client-sessions/use-client-session.js.map +1 -1
- package/lib/seam/components/AccessCodeDetails/AccessCodeDetails.d.ts +1 -1
- package/lib/seam/components/AccessCodeDetails/AccessCodeDetails.js +14 -6
- package/lib/seam/components/AccessCodeDetails/AccessCodeDetails.js.map +1 -1
- package/lib/seam/components/AccessCodeDetails/AccessCodeDevice.d.ts +1 -1
- package/lib/seam/components/AccessCodeDetails/AccessCodeDevice.js +9 -6
- package/lib/seam/components/AccessCodeDetails/AccessCodeDevice.js.map +1 -1
- package/lib/seam/components/AccessCodeTable/AccessCodeHealthBar.d.ts +3 -4
- package/lib/seam/components/AccessCodeTable/AccessCodeHealthBar.js.map +1 -1
- package/lib/seam/components/AccessCodeTable/AccessCodeMainIcon.d.ts +3 -3
- package/lib/seam/components/AccessCodeTable/AccessCodeMainIcon.js.map +1 -1
- package/lib/seam/components/AccessCodeTable/AccessCodeMenu.d.ts +3 -3
- package/lib/seam/components/AccessCodeTable/AccessCodeMenu.js +1 -1
- package/lib/seam/components/AccessCodeTable/AccessCodeMenu.js.map +1 -1
- package/lib/seam/components/AccessCodeTable/AccessCodeRow.d.ts +3 -3
- package/lib/seam/components/AccessCodeTable/AccessCodeRow.js.map +1 -1
- package/lib/seam/components/AccessCodeTable/AccessCodeTable.d.ts +2 -4
- package/lib/seam/components/AccessCodeTable/AccessCodeTable.js +1 -1
- package/lib/seam/components/AccessCodeTable/AccessCodeTable.js.map +1 -1
- package/lib/seam/components/AccessCodeTable/CodeDetails.d.ts +2 -2
- package/lib/seam/components/AccessCodeTable/CodeDetails.js +5 -2
- package/lib/seam/components/AccessCodeTable/CodeDetails.js.map +1 -1
- package/lib/seam/components/ClimateSettingScheduleDetails/ClimateSettingScheduleCard.d.ts +1 -1
- package/lib/seam/components/ClimateSettingScheduleDetails/ClimateSettingScheduleCard.js +3 -1
- package/lib/seam/components/ClimateSettingScheduleDetails/ClimateSettingScheduleCard.js.map +1 -1
- package/lib/seam/components/ClimateSettingScheduleDetails/ClimateSettingScheduleDetails.d.ts +1 -1
- package/lib/seam/components/ClimateSettingScheduleDetails/ClimateSettingScheduleDetails.js +3 -1
- package/lib/seam/components/ClimateSettingScheduleDetails/ClimateSettingScheduleDetails.js.map +1 -1
- package/lib/seam/components/ClimateSettingScheduleDetails/ClimateSettingScheduleDeviceBar.d.ts +1 -1
- package/lib/seam/components/ClimateSettingScheduleDetails/ClimateSettingScheduleDeviceBar.js +3 -3
- package/lib/seam/components/ClimateSettingScheduleDetails/ClimateSettingScheduleDeviceBar.js.map +1 -1
- package/lib/seam/components/ClimateSettingScheduleTable/ClimateSettingScheduleRow.d.ts +3 -3
- package/lib/seam/components/ClimateSettingScheduleTable/ClimateSettingScheduleRow.js.map +1 -1
- package/lib/seam/components/ClimateSettingScheduleTable/ClimateSettingScheduleRowDetails.d.ts +2 -2
- package/lib/seam/components/ClimateSettingScheduleTable/ClimateSettingScheduleRowDetails.js.map +1 -1
- package/lib/seam/components/ClimateSettingScheduleTable/ClimateSettingScheduleTable.d.ts +2 -2
- package/lib/seam/components/ClimateSettingScheduleTable/ClimateSettingScheduleTable.js +1 -1
- package/lib/seam/components/ClimateSettingScheduleTable/ClimateSettingScheduleTable.js.map +1 -1
- package/lib/seam/components/ConnectAccountButton/ConnectAccountButton.d.ts +1 -1
- package/lib/seam/components/ConnectAccountButton/ConnectAccountButton.js +2 -2
- package/lib/seam/components/CreateAccessCodeForm/CreateAccessCodeForm.d.ts +3 -3
- package/lib/seam/components/CreateAccessCodeForm/CreateAccessCodeForm.js +12 -9
- package/lib/seam/components/CreateAccessCodeForm/CreateAccessCodeForm.js.map +1 -1
- package/lib/seam/components/CreateClimateSettingScheduleForm/CreateClimateSettingScheduleForm.d.ts +1 -1
- package/lib/seam/components/CreateClimateSettingScheduleForm/CreateClimateSettingScheduleForm.js +1 -1
- package/lib/seam/components/DeviceDetails/DeviceDetails.d.ts +1 -1
- package/lib/seam/components/DeviceDetails/DeviceDetails.js +3 -1
- package/lib/seam/components/DeviceDetails/DeviceDetails.js.map +1 -1
- package/lib/seam/components/DeviceDetails/DeviceInfo.d.ts +3 -3
- package/lib/seam/components/DeviceDetails/DeviceInfo.js +3 -1
- package/lib/seam/components/DeviceDetails/DeviceInfo.js.map +1 -1
- package/lib/seam/components/DeviceDetails/DeviceModel.d.ts +3 -3
- package/lib/seam/components/DeviceDetails/LockDeviceDetails.d.ts +2 -2
- package/lib/seam/components/DeviceDetails/LockDeviceDetails.js +5 -5
- package/lib/seam/components/DeviceDetails/LockDeviceDetails.js.map +1 -1
- package/lib/seam/components/DeviceDetails/NoiseSensorDeviceDetails.d.ts +2 -2
- package/lib/seam/components/DeviceDetails/NoiseSensorDeviceDetails.js.map +1 -1
- package/lib/seam/components/DeviceDetails/ThermostatDeviceDetails.d.ts +2 -2
- package/lib/seam/components/DeviceDetails/ThermostatDeviceDetails.js +3 -3
- package/lib/seam/components/DeviceDetails/ThermostatDeviceDetails.js.map +1 -1
- package/lib/seam/components/DeviceTable/DeviceHealthBar.d.ts +3 -4
- package/lib/seam/components/DeviceTable/DeviceHealthBar.js.map +1 -1
- package/lib/seam/components/DeviceTable/DeviceRow.d.ts +4 -3
- package/lib/seam/components/DeviceTable/DeviceRow.js +2 -2
- package/lib/seam/components/DeviceTable/DeviceRow.js.map +1 -1
- package/lib/seam/components/DeviceTable/DeviceTable.d.ts +3 -6
- package/lib/seam/components/DeviceTable/DeviceTable.js +4 -2
- package/lib/seam/components/DeviceTable/DeviceTable.js.map +1 -1
- package/lib/seam/components/EditAccessCodeForm/EditAccessCodeForm.d.ts +1 -1
- package/lib/seam/components/EditAccessCodeForm/EditAccessCodeForm.js +2 -2
- package/lib/seam/components/EditAccessCodeForm/EditAccessCodeForm.js.map +1 -1
- package/lib/seam/components/SupportedDeviceTable/FilterCategoryMenu.d.ts +1 -1
- package/lib/seam/components/SupportedDeviceTable/HiddenDevicesOverlay.d.ts +1 -1
- package/lib/seam/components/SupportedDeviceTable/ShowAllDevicesButton.d.ts +1 -1
- package/lib/seam/components/SupportedDeviceTable/SupportedDeviceContent.d.ts +1 -1
- package/lib/seam/components/SupportedDeviceTable/SupportedDeviceContent.js +2 -2
- package/lib/seam/components/SupportedDeviceTable/SupportedDeviceContent.js.map +1 -1
- package/lib/seam/components/SupportedDeviceTable/SupportedDeviceContentRows.d.ts +3 -3
- package/lib/seam/components/SupportedDeviceTable/SupportedDeviceContentRows.js.map +1 -1
- package/lib/seam/components/SupportedDeviceTable/SupportedDeviceManufacturerSection.d.ts +1 -1
- package/lib/seam/components/SupportedDeviceTable/SupportedDeviceRow.d.ts +1 -1
- package/lib/seam/components/SupportedDeviceTable/SupportedDeviceTable.d.ts +1 -1
- package/lib/seam/components/SupportedDeviceTable/SupportedDeviceTableManufacturerKeys.d.ts +1 -1
- package/lib/seam/components/SupportedDeviceTable/use-device-model.d.ts +2 -2
- package/lib/seam/components/SupportedDeviceTable/use-device-model.js +3 -4
- package/lib/seam/components/SupportedDeviceTable/use-device-model.js.map +1 -1
- package/lib/seam/components/SupportedDeviceTable/use-device-models.js +2 -4
- package/lib/seam/components/SupportedDeviceTable/use-device-models.js.map +1 -1
- package/lib/seam/components/SupportedDeviceTable/use-manufacturer.d.ts +2 -2
- package/lib/seam/components/SupportedDeviceTable/use-manufacturer.js +2 -3
- package/lib/seam/components/SupportedDeviceTable/use-manufacturer.js.map +1 -1
- package/lib/seam/components/SupportedDeviceTable/use-manufacturers.js +1 -3
- package/lib/seam/components/SupportedDeviceTable/use-manufacturers.js.map +1 -1
- package/lib/seam/components/common-props.d.ts +2 -2
- package/lib/seam/components/common-props.js.map +1 -1
- package/lib/seam/connect-webviews/use-create-connect-webview.d.ts +4 -3
- package/lib/seam/connect-webviews/use-create-connect-webview.js +3 -3
- package/lib/seam/connect-webviews/use-create-connect-webview.js.map +1 -1
- package/lib/seam/connected-accounts/use-connected-account.d.ts +3 -2
- package/lib/seam/connected-accounts/use-connected-account.js +2 -3
- package/lib/seam/connected-accounts/use-connected-account.js.map +1 -1
- package/lib/seam/devices/use-device-providers.d.ts +3 -2
- package/lib/seam/devices/use-device-providers.js.map +1 -1
- package/lib/seam/devices/use-device.d.ts +5 -4
- package/lib/seam/devices/use-device.js +2 -3
- package/lib/seam/devices/use-device.js.map +1 -1
- package/lib/seam/devices/use-devices.d.ts +4 -3
- package/lib/seam/devices/use-devices.js +2 -3
- package/lib/seam/devices/use-devices.js.map +1 -1
- package/lib/seam/events/use-events.d.ts +5 -4
- package/lib/seam/events/use-events.js +5 -5
- package/lib/seam/events/use-events.js.map +1 -1
- package/lib/seam/filters.d.ts +7 -7
- package/lib/seam/filters.js.map +1 -1
- package/lib/seam/locks/lock-device.d.ts +5 -0
- package/lib/seam/locks/lock-device.js +2 -0
- package/lib/seam/locks/lock-device.js.map +1 -0
- package/lib/seam/locks/use-toggle-lock.d.ts +16 -0
- package/lib/seam/locks/use-toggle-lock.js +59 -0
- package/lib/seam/locks/use-toggle-lock.js.map +1 -0
- package/lib/seam/noise-sensors/noise-sensor-device.d.ts +5 -0
- package/lib/seam/noise-sensors/noise-sensor-device.js +2 -0
- package/lib/seam/noise-sensors/noise-sensor-device.js.map +1 -0
- package/lib/seam/noise-sensors/use-noise-thresholds.d.ts +4 -3
- package/lib/seam/noise-sensors/use-noise-thresholds.js +2 -3
- package/lib/seam/noise-sensors/use-noise-thresholds.js.map +1 -1
- package/lib/seam/thermostats/climate-setting-schedules/use-climate-setting-schedule.d.ts +3 -2
- package/lib/seam/thermostats/climate-setting-schedules/use-climate-setting-schedule.js +2 -10
- package/lib/seam/thermostats/climate-setting-schedules/use-climate-setting-schedule.js.map +1 -1
- package/lib/seam/thermostats/climate-setting-schedules/use-climate-setting-schedules.d.ts +3 -2
- package/lib/seam/thermostats/climate-setting-schedules/use-climate-setting-schedules.js +3 -4
- package/lib/seam/thermostats/climate-setting-schedules/use-climate-setting-schedules.js.map +1 -1
- package/lib/seam/thermostats/climate-setting-schedules/use-create-climate-setting-schedule.d.ts +5 -3
- package/lib/seam/thermostats/climate-setting-schedules/use-create-climate-setting-schedule.js +10 -6
- package/lib/seam/thermostats/climate-setting-schedules/use-create-climate-setting-schedule.js.map +1 -1
- package/lib/seam/thermostats/climate-setting-schedules/use-delete-climate-setting-schedule.d.ts +5 -4
- package/lib/seam/thermostats/climate-setting-schedules/use-delete-climate-setting-schedule.js +13 -13
- package/lib/seam/thermostats/climate-setting-schedules/use-delete-climate-setting-schedule.js.map +1 -1
- package/lib/seam/thermostats/climate-setting-schedules/use-update-climate-setting-schedule.d.ts +5 -5
- package/lib/seam/thermostats/climate-setting-schedules/use-update-climate-setting-schedule.js +12 -17
- package/lib/seam/thermostats/climate-setting-schedules/use-update-climate-setting-schedule.js.map +1 -1
- package/lib/{temperature-bounds.d.ts → seam/thermostats/temperature-bounds.d.ts} +1 -1
- package/lib/{temperature-bounds.js → seam/thermostats/temperature-bounds.js} +4 -4
- package/lib/seam/thermostats/temperature-bounds.js.map +1 -0
- package/lib/seam/thermostats/thermostat-device.d.ts +17 -0
- package/lib/seam/thermostats/thermostat-device.js +2 -0
- package/lib/seam/thermostats/thermostat-device.js.map +1 -0
- package/lib/seam/thermostats/unit-conversion.d.ts +19 -0
- package/lib/seam/thermostats/unit-conversion.js +43 -0
- package/lib/seam/thermostats/unit-conversion.js.map +1 -0
- package/lib/seam/thermostats/use-cool-thermostat.d.ts +10 -4
- package/lib/seam/thermostats/use-cool-thermostat.js +34 -27
- package/lib/seam/thermostats/use-cool-thermostat.js.map +1 -1
- package/lib/seam/thermostats/use-heat-cool-thermostat.d.ts +10 -4
- package/lib/seam/thermostats/use-heat-cool-thermostat.js +34 -22
- package/lib/seam/thermostats/use-heat-cool-thermostat.js.map +1 -1
- package/lib/seam/thermostats/use-heat-thermostat.d.ts +10 -4
- package/lib/seam/thermostats/use-heat-thermostat.js +34 -27
- package/lib/seam/thermostats/use-heat-thermostat.js.map +1 -1
- package/lib/seam/thermostats/use-set-thermostat-fan-mode.d.ts +12 -0
- package/lib/seam/thermostats/use-set-thermostat-fan-mode.js +46 -0
- package/lib/seam/thermostats/use-set-thermostat-fan-mode.js.map +1 -0
- package/lib/seam/thermostats/use-set-thermostat-off.d.ts +10 -4
- package/lib/seam/thermostats/use-set-thermostat-off.js +36 -25
- package/lib/seam/thermostats/use-set-thermostat-off.js.map +1 -1
- package/lib/seam/thermostats/use-update-thermostat.d.ts +5 -5
- package/lib/seam/thermostats/use-update-thermostat.js +28 -27
- package/lib/seam/thermostats/use-update-thermostat.js.map +1 -1
- package/lib/seam/use-seam-client.d.ts +3 -3
- package/lib/seam/use-seam-client.js +5 -21
- package/lib/seam/use-seam-client.js.map +1 -1
- package/lib/seam/use-seam-query-result.d.ts +2 -2
- package/lib/ui/AccessCodeForm/AccessCodeForm.d.ts +5 -7
- package/lib/ui/AccessCodeForm/AccessCodeForm.js +9 -14
- package/lib/ui/AccessCodeForm/AccessCodeForm.js.map +1 -1
- package/lib/ui/AccessCodeForm/AccessCodeFormDatePicker.d.ts +1 -1
- package/lib/ui/AccessCodeForm/AccessCodeFormTimeZonePicker.d.ts +1 -1
- package/lib/ui/AccessCodeForm/AccessCodeFormTimes.d.ts +1 -1
- package/lib/ui/Checkbox.d.ts +1 -1
- package/lib/ui/ClimateSettingForm/ClimateSettingScheduleForm.d.ts +2 -2
- package/lib/ui/ClimateSettingForm/ClimateSettingScheduleForm.js +1 -1
- package/lib/ui/ClimateSettingForm/ClimateSettingScheduleForm.js.map +1 -1
- package/lib/ui/ClimateSettingForm/ClimateSettingScheduleFormClimateSetting.d.ts +1 -1
- package/lib/ui/ClimateSettingForm/ClimateSettingScheduleFormClimateSetting.js +3 -3
- package/lib/ui/ClimateSettingForm/ClimateSettingScheduleFormClimateSetting.js.map +1 -1
- package/lib/ui/ClimateSettingForm/ClimateSettingScheduleFormDefaultClimateSetting.d.ts +1 -1
- package/lib/ui/ClimateSettingForm/ClimateSettingScheduleFormDefaultClimateSetting.js.map +1 -1
- package/lib/ui/ClimateSettingForm/ClimateSettingScheduleFormDeviceSelect.d.ts +1 -1
- package/lib/ui/ClimateSettingForm/ClimateSettingScheduleFormNameAndSchedule.d.ts +1 -1
- package/lib/ui/ClimateSettingForm/ClimateSettingScheduleFormTimeZonePicker.d.ts +1 -1
- package/lib/ui/ClimateSettingForm/set-point-bounds.d.ts +4 -0
- package/lib/ui/ClimateSettingForm/set-point-bounds.js +17 -0
- package/lib/ui/ClimateSettingForm/set-point-bounds.js.map +1 -0
- package/lib/ui/DateTimePicker/DateTimePicker.d.ts +1 -1
- package/lib/ui/FormField.d.ts +1 -1
- package/lib/ui/IconButton.d.ts +1 -1
- package/lib/ui/LoadingToast/LoadingToast.d.ts +1 -1
- package/lib/ui/RadioField/Radio.d.ts +1 -1
- package/lib/ui/RadioField/RadioField.d.ts +1 -1
- package/lib/ui/Snackbar/Snackbar.d.ts +1 -1
- package/lib/ui/Spinner/Spinner.d.ts +1 -1
- package/lib/ui/Switch/Switch.d.ts +1 -1
- package/lib/ui/TabSet.d.ts +1 -1
- package/lib/ui/Table/EmptyPlaceholder.d.ts +1 -1
- package/lib/ui/Table/TableCell.d.ts +1 -1
- package/lib/ui/Table/TableFilterBar/TableFilterBar.d.ts +1 -1
- package/lib/ui/Table/TableFilterBar/TableFilterItem.d.ts +1 -1
- package/lib/ui/Table/TableRow.d.ts +1 -1
- package/lib/ui/TextButton.d.ts +1 -1
- package/lib/ui/TextField/SearchTextField.d.ts +1 -1
- package/lib/ui/TimeZonePicker/TimeZonePicker.d.ts +1 -1
- package/lib/ui/clipboard.d.ts +1 -1
- package/lib/ui/clipboard.js +2 -2
- package/lib/ui/clipboard.js.map +1 -1
- package/lib/ui/device/BatteryStatusIndicator.d.ts +7 -0
- package/lib/ui/device/{BatteryStatus.js → BatteryStatusIndicator.js} +2 -2
- package/lib/ui/device/BatteryStatusIndicator.js.map +1 -0
- package/lib/ui/device/DeviceImage.d.ts +2 -2
- package/lib/ui/device/LockStatus.d.ts +3 -3
- package/lib/ui/device/LockStatus.js +1 -1
- package/lib/ui/device/LockStatus.js.map +1 -1
- package/lib/ui/device/NoiseLevelStatus.d.ts +2 -2
- package/lib/ui/device/NoiseLevelStatus.js +4 -4
- package/lib/ui/device/NoiseLevelStatus.js.map +1 -1
- package/lib/ui/device/OnlineStatus.d.ts +4 -4
- package/lib/ui/device/OnlineStatus.js.map +1 -1
- package/lib/ui/layout/ContentHeader.d.ts +1 -1
- package/lib/ui/layout/DotDivider.d.ts +1 -1
- package/lib/ui/noise-sensor/NoiseSensorActivityList.d.ts +2 -2
- package/lib/ui/noise-sensor/NoiseSensorActivityList.js +4 -2
- package/lib/ui/noise-sensor/NoiseSensorActivityList.js.map +1 -1
- package/lib/ui/noise-sensor/NoiseSensorEventItem.d.ts +6 -3
- package/lib/ui/noise-sensor/NoiseSensorEventItem.js +4 -7
- package/lib/ui/noise-sensor/NoiseSensorEventItem.js.map +1 -1
- package/lib/ui/noise-sensor/NoiseThresholdsList.d.ts +2 -2
- package/lib/ui/noise-sensor/NoiseThresholdsList.js.map +1 -1
- package/lib/ui/thermostat/ClimateModeMenu.d.ts +2 -2
- package/lib/ui/thermostat/ClimateModeMenu.js.map +1 -1
- package/lib/ui/thermostat/ClimateSettingControlGroup.d.ts +2 -2
- package/lib/ui/thermostat/ClimateSettingControlGroup.js.map +1 -1
- package/lib/ui/thermostat/ClimateSettingStatus.d.ts +2 -2
- package/lib/ui/thermostat/ClimateSettingStatus.js +2 -2
- package/lib/ui/thermostat/ClimateSettingStatus.js.map +1 -1
- package/lib/ui/thermostat/FanModeMenu.d.ts +2 -2
- package/lib/ui/thermostat/FanModeMenu.js.map +1 -1
- package/lib/ui/thermostat/Temperature.d.ts +1 -1
- package/lib/ui/thermostat/TemperatureControl.d.ts +1 -1
- package/lib/ui/thermostat/TemperatureControlGroup.d.ts +2 -2
- package/lib/ui/thermostat/TemperatureControlGroup.js +1 -1
- package/lib/ui/thermostat/TemperatureControlGroup.js.map +1 -1
- package/lib/ui/thermostat/ThermoModeMenuOption.d.ts +1 -1
- package/lib/ui/thermostat/ThermostatCard.d.ts +2 -2
- package/lib/ui/thermostat/ThermostatCard.js +5 -4
- package/lib/ui/thermostat/ThermostatCard.js.map +1 -1
- package/lib/ui/thermostat/ThermostatSelect.d.ts +1 -1
- package/lib/ui/thermostat/ThermostatSelect.js +2 -2
- package/lib/ui/thermostat/ThermostatSelect.js.map +1 -1
- package/lib/ui/typography/Title.d.ts +1 -1
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/lib/version.js.map +1 -1
- package/package.json +8 -9
- package/src/index.scss +1 -1
- package/src/lib/object.ts +13 -0
- package/src/lib/seam/SeamProvider.tsx +9 -4
- package/src/lib/seam/access-codes/use-access-code.ts +10 -16
- package/src/lib/seam/access-codes/use-access-codes.ts +11 -18
- package/src/lib/seam/access-codes/use-create-access-code.ts +21 -16
- package/src/lib/seam/access-codes/use-delete-access-code.ts +22 -22
- package/src/lib/seam/access-codes/use-generate-access-code-code.ts +17 -21
- package/src/lib/seam/access-codes/use-update-access-code.ts +33 -25
- package/src/lib/seam/client-sessions/use-client-session.ts +5 -10
- package/src/lib/seam/components/AccessCodeDetails/AccessCodeDetails.tsx +36 -23
- package/src/lib/seam/components/AccessCodeDetails/AccessCodeDevice.tsx +10 -7
- package/src/lib/seam/components/AccessCodeTable/AccessCodeHealthBar.tsx +2 -3
- package/src/lib/seam/components/AccessCodeTable/AccessCodeMainIcon.tsx +3 -2
- package/src/lib/seam/components/AccessCodeTable/AccessCodeMenu.tsx +5 -4
- package/src/lib/seam/components/AccessCodeTable/AccessCodeRow.tsx +3 -2
- package/src/lib/seam/components/AccessCodeTable/AccessCodeTable.tsx +3 -7
- package/src/lib/seam/components/AccessCodeTable/CodeDetails.tsx +12 -8
- package/src/lib/seam/components/ClimateSettingScheduleDetails/ClimateSettingScheduleCard.tsx +4 -4
- package/src/lib/seam/components/ClimateSettingScheduleDetails/ClimateSettingScheduleDetails.tsx +3 -3
- package/src/lib/seam/components/ClimateSettingScheduleDetails/ClimateSettingScheduleDeviceBar.tsx +6 -4
- package/src/lib/seam/components/ClimateSettingScheduleTable/ClimateSettingScheduleRow.tsx +3 -2
- package/src/lib/seam/components/ClimateSettingScheduleTable/ClimateSettingScheduleRowDetails.tsx +1 -1
- package/src/lib/seam/components/ClimateSettingScheduleTable/ClimateSettingScheduleTable.tsx +3 -6
- package/src/lib/seam/components/ConnectAccountButton/ConnectAccountButton.tsx +2 -2
- package/src/lib/seam/components/CreateAccessCodeForm/CreateAccessCodeForm.tsx +20 -16
- package/src/lib/seam/components/CreateClimateSettingScheduleForm/CreateClimateSettingScheduleForm.tsx +1 -1
- package/src/lib/seam/components/DeviceDetails/DeviceDetails.tsx +3 -2
- package/src/lib/seam/components/DeviceDetails/DeviceInfo.tsx +5 -3
- package/src/lib/seam/components/DeviceDetails/DeviceModel.tsx +2 -2
- package/src/lib/seam/components/DeviceDetails/LockDeviceDetails.tsx +6 -6
- package/src/lib/seam/components/DeviceDetails/NoiseSensorDeviceDetails.tsx +1 -1
- package/src/lib/seam/components/DeviceDetails/ThermostatDeviceDetails.tsx +7 -4
- package/src/lib/seam/components/DeviceTable/DeviceHealthBar.tsx +6 -3
- package/src/lib/seam/components/DeviceTable/DeviceRow.tsx +5 -7
- package/src/lib/seam/components/DeviceTable/DeviceTable.tsx +7 -14
- package/src/lib/seam/components/EditAccessCodeForm/EditAccessCodeForm.tsx +6 -7
- package/src/lib/seam/components/SupportedDeviceTable/SupportedDeviceContent.tsx +3 -4
- package/src/lib/seam/components/SupportedDeviceTable/SupportedDeviceContentRows.tsx +3 -2
- package/src/lib/seam/components/SupportedDeviceTable/use-device-model.ts +9 -14
- package/src/lib/seam/components/SupportedDeviceTable/use-device-models.ts +5 -9
- package/src/lib/seam/components/SupportedDeviceTable/use-manufacturer.ts +7 -12
- package/src/lib/seam/components/SupportedDeviceTable/use-manufacturers.ts +4 -8
- package/src/lib/seam/components/common-props.tsx +8 -4
- package/src/lib/seam/connect-webviews/use-create-connect-webview.ts +15 -17
- package/src/lib/seam/connected-accounts/use-connected-account.ts +17 -21
- package/src/lib/seam/devices/use-device-providers.ts +8 -11
- package/src/lib/seam/devices/use-device.ts +9 -18
- package/src/lib/seam/devices/use-devices.ts +20 -26
- package/src/lib/seam/events/use-events.ts +12 -14
- package/src/lib/seam/filters.ts +9 -8
- package/src/lib/seam/locks/lock-device.ts +9 -0
- package/src/lib/seam/locks/use-toggle-lock.ts +103 -0
- package/src/lib/seam/noise-sensors/noise-sensor-device.ts +10 -0
- package/src/lib/seam/noise-sensors/use-noise-thresholds.ts +12 -15
- package/src/lib/seam/thermostats/climate-setting-schedules/use-climate-setting-schedule.ts +10 -23
- package/src/lib/seam/thermostats/climate-setting-schedules/use-climate-setting-schedules.ts +13 -13
- package/src/lib/seam/thermostats/climate-setting-schedules/use-create-climate-setting-schedule.ts +30 -25
- package/src/lib/seam/thermostats/climate-setting-schedules/use-delete-climate-setting-schedule.ts +26 -28
- package/src/lib/seam/thermostats/climate-setting-schedules/use-update-climate-setting-schedule.ts +32 -41
- package/src/lib/{temperature-bounds.ts → seam/thermostats/temperature-bounds.ts} +8 -5
- package/src/lib/seam/thermostats/thermostat-device.ts +43 -0
- package/src/lib/seam/thermostats/unit-conversion.ts +89 -0
- package/src/lib/seam/thermostats/use-cool-thermostat.ts +77 -47
- package/src/lib/seam/thermostats/use-heat-cool-thermostat.ts +89 -40
- package/src/lib/seam/thermostats/use-heat-thermostat.ts +77 -47
- package/src/lib/seam/thermostats/use-set-thermostat-fan-mode.ts +95 -0
- package/src/lib/seam/thermostats/use-set-thermostat-off.ts +64 -40
- package/src/lib/seam/thermostats/use-update-thermostat.ts +47 -49
- package/src/lib/seam/use-seam-client.ts +11 -22
- package/src/lib/seam/use-seam-query-result.ts +2 -2
- package/src/lib/ui/AccessCodeForm/AccessCodeForm.tsx +18 -24
- package/src/lib/ui/ClimateSettingForm/ClimateSettingScheduleForm.tsx +4 -4
- package/src/lib/ui/ClimateSettingForm/ClimateSettingScheduleFormClimateSetting.tsx +6 -3
- package/src/lib/ui/ClimateSettingForm/ClimateSettingScheduleFormDefaultClimateSetting.tsx +1 -1
- package/src/lib/ui/ClimateSettingForm/set-point-bounds.ts +31 -0
- package/src/lib/ui/clipboard.ts +1 -1
- package/src/lib/ui/device/{BatteryStatus.tsx → BatteryStatusIndicator.tsx} +10 -5
- package/src/lib/ui/device/DeviceImage.tsx +2 -2
- package/src/lib/ui/device/LockStatus.tsx +3 -2
- package/src/lib/ui/device/NoiseLevelStatus.tsx +3 -3
- package/src/lib/ui/device/OnlineStatus.tsx +3 -3
- package/src/lib/ui/noise-sensor/NoiseSensorActivityList.tsx +15 -6
- package/src/lib/ui/noise-sensor/NoiseSensorEventItem.tsx +13 -9
- package/src/lib/ui/noise-sensor/NoiseThresholdsList.tsx +4 -3
- package/src/lib/ui/thermostat/ClimateModeMenu.tsx +1 -2
- package/src/lib/ui/thermostat/ClimateSettingControlGroup.tsx +1 -2
- package/src/lib/ui/thermostat/ClimateSettingStatus.tsx +2 -3
- package/src/lib/ui/thermostat/FanModeMenu.tsx +1 -2
- package/src/lib/ui/thermostat/TemperatureControlGroup.tsx +2 -2
- package/src/lib/ui/thermostat/ThermostatCard.tsx +11 -8
- package/src/lib/ui/thermostat/ThermostatSelect.tsx +4 -10
- package/src/lib/version.ts +1 -1
- package/lib/seam/devices/use-toggle-lock.d.ts +0 -5
- package/lib/seam/devices/use-toggle-lock.js +0 -56
- package/lib/seam/devices/use-toggle-lock.js.map +0 -1
- package/lib/seam/error-handlers.d.ts +0 -5
- package/lib/seam/error-handlers.js +0 -12
- package/lib/seam/error-handlers.js.map +0 -1
- package/lib/seam/thermostats/use-update-fan-mode.d.ts +0 -6
- package/lib/seam/thermostats/use-update-fan-mode.js +0 -42
- package/lib/seam/thermostats/use-update-fan-mode.js.map +0 -1
- package/lib/set-point-bounds.d.ts +0 -4
- package/lib/set-point-bounds.js +0 -24
- package/lib/set-point-bounds.js.map +0 -1
- package/lib/temperature-bounds.js.map +0 -1
- package/lib/ui/device/BatteryStatus.d.ts +0 -7
- package/lib/ui/device/BatteryStatus.js.map +0 -1
- package/src/lib/seam/devices/use-toggle-lock.ts +0 -84
- package/src/lib/seam/error-handlers.ts +0 -19
- package/src/lib/seam/thermostats/use-update-fan-mode.ts +0 -81
- package/src/lib/set-point-bounds.ts +0 -39
package/src/lib/seam/thermostats/climate-setting-schedules/use-create-climate-setting-schedule.ts
CHANGED
|
@@ -1,48 +1,53 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
SeamHttpApiError,
|
|
3
|
+
ThermostatsClimateSettingSchedulesCreateBody,
|
|
4
|
+
} from '@seamapi/http/connect'
|
|
5
|
+
import type { ClimateSettingSchedule } from '@seamapi/types/connect'
|
|
1
6
|
import {
|
|
2
7
|
useMutation,
|
|
3
8
|
type UseMutationResult,
|
|
4
9
|
useQueryClient,
|
|
5
10
|
} from '@tanstack/react-query'
|
|
6
|
-
import type {
|
|
7
|
-
ClimateSettingSchedule,
|
|
8
|
-
ClimateSettingScheduleCreateRequest,
|
|
9
|
-
ClimateSettingScheduleCreateResponse,
|
|
10
|
-
SeamError,
|
|
11
|
-
} from 'seamapi'
|
|
12
11
|
|
|
13
12
|
import { NullSeamClientError, useSeamClient } from 'lib/seam/use-seam-client.js'
|
|
14
13
|
|
|
14
|
+
export type UseCreateClimateSettingScheduleParams = never
|
|
15
|
+
|
|
15
16
|
export type UseCreateClimateSettingScheduleData = ClimateSettingSchedule
|
|
16
|
-
|
|
17
|
-
|
|
17
|
+
|
|
18
|
+
export type UseCreateClimateSettingScheduleMutationVariables =
|
|
19
|
+
ThermostatsClimateSettingSchedulesCreateBody
|
|
18
20
|
|
|
19
21
|
export function useCreateClimateSettingSchedule(): UseMutationResult<
|
|
20
22
|
UseCreateClimateSettingScheduleData,
|
|
21
|
-
|
|
22
|
-
|
|
23
|
+
SeamHttpApiError,
|
|
24
|
+
UseCreateClimateSettingScheduleMutationVariables
|
|
23
25
|
> {
|
|
24
26
|
const { client } = useSeamClient()
|
|
25
27
|
const queryClient = useQueryClient()
|
|
26
28
|
|
|
27
29
|
return useMutation<
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
30
|
+
UseCreateClimateSettingScheduleData,
|
|
31
|
+
SeamHttpApiError,
|
|
32
|
+
UseCreateClimateSettingScheduleMutationVariables
|
|
31
33
|
>({
|
|
32
|
-
mutationFn: async (
|
|
33
|
-
mutationParams: UseCreateClimateSettingScheduleMutationParams
|
|
34
|
-
) => {
|
|
34
|
+
mutationFn: async (variables) => {
|
|
35
35
|
if (client === null) throw new NullSeamClientError()
|
|
36
|
-
return await client.thermostats.climateSettingSchedules.create(
|
|
37
|
-
mutationParams
|
|
38
|
-
)
|
|
36
|
+
return await client.thermostats.climateSettingSchedules.create(variables)
|
|
39
37
|
},
|
|
40
|
-
onSuccess: () => {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
38
|
+
onSuccess: (data) => {
|
|
39
|
+
queryClient.setQueryData(
|
|
40
|
+
[
|
|
41
|
+
'thermostats',
|
|
42
|
+
'climate_setting_schedules',
|
|
43
|
+
'get',
|
|
44
|
+
{ climate_setting_schedules: data.climate_setting_schedule_id },
|
|
45
|
+
],
|
|
46
|
+
data
|
|
47
|
+
)
|
|
48
|
+
void queryClient.invalidateQueries({
|
|
49
|
+
queryKey: ['thermostats', 'climate_setting_schedules', 'list'],
|
|
50
|
+
})
|
|
46
51
|
},
|
|
47
52
|
})
|
|
48
53
|
}
|
package/src/lib/seam/thermostats/climate-setting-schedules/use-delete-climate-setting-schedule.ts
CHANGED
|
@@ -1,53 +1,51 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
SeamHttpApiError,
|
|
3
|
+
ThermostatsClimateSettingSchedulesDeleteParams,
|
|
4
|
+
} from '@seamapi/http/connect'
|
|
1
5
|
import {
|
|
2
6
|
useMutation,
|
|
3
7
|
type UseMutationResult,
|
|
4
8
|
useQueryClient,
|
|
5
9
|
} from '@tanstack/react-query'
|
|
6
|
-
import type {
|
|
7
|
-
ClimateSettingScheduleDeleteRequest,
|
|
8
|
-
ClimateSettingScheduleDeleteResponse,
|
|
9
|
-
SeamError,
|
|
10
|
-
} from 'seamapi'
|
|
11
10
|
|
|
12
11
|
import { NullSeamClientError, useSeamClient } from 'lib/seam/use-seam-client.js'
|
|
13
12
|
|
|
14
|
-
export type
|
|
15
|
-
|
|
13
|
+
export type UseDeleteClimateSettingScheduleParams = never
|
|
14
|
+
|
|
15
|
+
export type UseDeleteClimateSettingScheduleData = undefined
|
|
16
16
|
|
|
17
|
-
export type
|
|
18
|
-
|
|
17
|
+
export type UseDeleteClimateSettingScheduleMutationVariables =
|
|
18
|
+
ThermostatsClimateSettingSchedulesDeleteParams
|
|
19
19
|
|
|
20
20
|
export function useDeleteClimateSettingSchedule(): UseMutationResult<
|
|
21
21
|
UseDeleteClimateSettingScheduleData,
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
SeamHttpApiError,
|
|
23
|
+
UseDeleteClimateSettingScheduleMutationVariables
|
|
24
24
|
> {
|
|
25
25
|
const { client } = useSeamClient()
|
|
26
26
|
const queryClient = useQueryClient()
|
|
27
27
|
|
|
28
28
|
return useMutation<
|
|
29
29
|
UseDeleteClimateSettingScheduleData,
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
SeamHttpApiError,
|
|
31
|
+
UseDeleteClimateSettingScheduleMutationVariables
|
|
32
32
|
>({
|
|
33
|
-
mutationFn: async (
|
|
34
|
-
mutationParams: UseDeleteClimateSettingScheduleMutationParams
|
|
35
|
-
) => {
|
|
33
|
+
mutationFn: async (variables) => {
|
|
36
34
|
if (client === null) throw new NullSeamClientError()
|
|
37
|
-
await client.thermostats.climateSettingSchedules.delete(
|
|
35
|
+
await client.thermostats.climateSettingSchedules.delete(variables)
|
|
38
36
|
},
|
|
39
37
|
onSuccess: (_data, variables) => {
|
|
40
|
-
void queryClient.invalidateQueries(
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
'list',
|
|
50
|
-
|
|
38
|
+
void queryClient.invalidateQueries({
|
|
39
|
+
queryKey: [
|
|
40
|
+
'thermostats',
|
|
41
|
+
'climate_setting_schedules',
|
|
42
|
+
'get',
|
|
43
|
+
{ climate_setting_schedules: variables.climate_setting_schedule_id },
|
|
44
|
+
],
|
|
45
|
+
})
|
|
46
|
+
void queryClient.invalidateQueries({
|
|
47
|
+
queryKey: ['thermostats', 'climate_setting_schedules', 'list'],
|
|
48
|
+
})
|
|
51
49
|
},
|
|
52
50
|
})
|
|
53
51
|
}
|
package/src/lib/seam/thermostats/climate-setting-schedules/use-update-climate-setting-schedule.ts
CHANGED
|
@@ -1,53 +1,48 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
SeamHttpApiError,
|
|
3
|
+
ThermostatsClimateSettingSchedulesUpdateBody,
|
|
4
|
+
} from '@seamapi/http/connect'
|
|
5
|
+
import type { ClimateSettingSchedule } from '@seamapi/types/connect'
|
|
1
6
|
import {
|
|
2
7
|
useMutation,
|
|
3
8
|
type UseMutationResult,
|
|
4
9
|
useQueryClient,
|
|
5
10
|
} from '@tanstack/react-query'
|
|
6
|
-
import type {
|
|
7
|
-
ClimateSettingSchedule,
|
|
8
|
-
ClimateSettingSchedulesListResponse,
|
|
9
|
-
ClimateSettingScheduleUpdateRequest,
|
|
10
|
-
ClimateSettingScheduleUpdateResponse,
|
|
11
|
-
SeamError,
|
|
12
|
-
} from 'seamapi'
|
|
13
11
|
|
|
14
|
-
import {
|
|
12
|
+
import { shake } from 'lib/object.js'
|
|
13
|
+
import { NullSeamClientError, useSeamClient } from 'lib/seam/use-seam-client.js'
|
|
14
|
+
|
|
15
|
+
export type UseUpdateClimateSettingScheduleParams = never
|
|
15
16
|
|
|
16
|
-
type UseUpdateClimateSettingScheduleData =
|
|
17
|
-
|
|
18
|
-
type
|
|
19
|
-
|
|
17
|
+
export type UseUpdateClimateSettingScheduleData = undefined
|
|
18
|
+
|
|
19
|
+
export type UseUpdateClimateSettingScheduleMutationVariables =
|
|
20
|
+
ThermostatsClimateSettingSchedulesUpdateBody
|
|
20
21
|
|
|
21
22
|
export function useUpdateClimateSettingSchedule(): UseMutationResult<
|
|
22
23
|
UseUpdateClimateSettingScheduleData,
|
|
23
|
-
|
|
24
|
-
|
|
24
|
+
SeamHttpApiError,
|
|
25
|
+
UseUpdateClimateSettingScheduleMutationVariables
|
|
25
26
|
> {
|
|
26
27
|
const { client } = useSeamClient()
|
|
27
28
|
const queryClient = useQueryClient()
|
|
28
29
|
|
|
29
30
|
return useMutation<
|
|
30
31
|
UseUpdateClimateSettingScheduleData,
|
|
31
|
-
|
|
32
|
-
|
|
32
|
+
SeamHttpApiError,
|
|
33
|
+
UseUpdateClimateSettingScheduleMutationVariables
|
|
33
34
|
>({
|
|
34
|
-
mutationFn: async (
|
|
35
|
-
mutationPararms: UseUpdateClimateSettingScheduleMutationParams
|
|
36
|
-
) => {
|
|
35
|
+
mutationFn: async (variables) => {
|
|
37
36
|
if (client === null) throw new NullSeamClientError()
|
|
38
|
-
|
|
39
|
-
mutationPararms
|
|
40
|
-
)
|
|
37
|
+
await client.thermostats.climateSettingSchedules.update(variables)
|
|
41
38
|
},
|
|
42
|
-
onSuccess: (
|
|
43
|
-
queryClient.setQueryData<ClimateSettingSchedule>(
|
|
39
|
+
onSuccess: (_data, variables) => {
|
|
40
|
+
queryClient.setQueryData<ClimateSettingSchedule | null>(
|
|
44
41
|
[
|
|
45
42
|
'thermostats',
|
|
46
43
|
'climate_setting_schedules',
|
|
47
44
|
'get',
|
|
48
|
-
{
|
|
49
|
-
climate_setting_schedule_id: updated.climate_setting_schedule_id,
|
|
50
|
-
},
|
|
45
|
+
{ climate_setting_schedules: variables.climate_setting_schedule_id },
|
|
51
46
|
],
|
|
52
47
|
(climateSettingSchedule) => {
|
|
53
48
|
if (climateSettingSchedule == null) {
|
|
@@ -56,30 +51,26 @@ export function useUpdateClimateSettingSchedule(): UseMutationResult<
|
|
|
56
51
|
|
|
57
52
|
return {
|
|
58
53
|
...climateSettingSchedule,
|
|
59
|
-
...
|
|
54
|
+
...shake(variables),
|
|
60
55
|
}
|
|
61
56
|
}
|
|
62
57
|
)
|
|
63
58
|
|
|
64
|
-
queryClient.setQueryData<
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
[
|
|
68
|
-
'thermostats',
|
|
69
|
-
'climate_setting_schedules',
|
|
70
|
-
'list',
|
|
71
|
-
{ device_id: updated.device_id },
|
|
72
|
-
],
|
|
73
|
-
(climateSettingSchedules): ClimateSettingSchedule[] => {
|
|
59
|
+
queryClient.setQueryData<ClimateSettingSchedule[]>(
|
|
60
|
+
['thermostats', 'climate_setting_schedules', 'list'],
|
|
61
|
+
(climateSettingSchedules) => {
|
|
74
62
|
if (climateSettingSchedules == null) {
|
|
75
|
-
return
|
|
63
|
+
return climateSettingSchedules
|
|
76
64
|
}
|
|
77
65
|
|
|
78
66
|
return climateSettingSchedules.map((climateSettingSchedule) => {
|
|
79
|
-
if (
|
|
67
|
+
if (
|
|
68
|
+
climateSettingSchedule.climate_setting_schedule_id ===
|
|
69
|
+
variables.climate_setting_schedule_id
|
|
70
|
+
) {
|
|
80
71
|
return {
|
|
81
72
|
...climateSettingSchedule,
|
|
82
|
-
...
|
|
73
|
+
...shake(variables),
|
|
83
74
|
}
|
|
84
75
|
}
|
|
85
76
|
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type {
|
|
2
|
+
HvacModeSetting,
|
|
3
|
+
ThermostatDevice,
|
|
4
|
+
} from 'lib/seam/thermostats/thermostat-device.js'
|
|
2
5
|
|
|
3
6
|
export interface ControlBounds {
|
|
4
7
|
mode: Exclude<HvacModeSetting, 'off'>
|
|
@@ -60,13 +63,13 @@ export const getSupportedThermostatModes = (
|
|
|
60
63
|
return allModes.filter((mode) => {
|
|
61
64
|
switch (mode) {
|
|
62
65
|
case 'cool':
|
|
63
|
-
return device.properties.is_cooling_available
|
|
66
|
+
return device.properties.is_cooling_available ?? false
|
|
64
67
|
case 'heat':
|
|
65
|
-
return device.properties.is_heating_available
|
|
68
|
+
return device.properties.is_heating_available ?? false
|
|
66
69
|
case 'heat_cool':
|
|
67
70
|
return (
|
|
68
|
-
device.properties.is_heating_available &&
|
|
69
|
-
device.properties.is_cooling_available
|
|
71
|
+
(device.properties.is_heating_available ?? false) &&
|
|
72
|
+
(device.properties.is_cooling_available ?? false)
|
|
70
73
|
)
|
|
71
74
|
default:
|
|
72
75
|
return true
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { Device } from '@seamapi/types/connect'
|
|
2
|
+
|
|
3
|
+
export type ThermostatDevice = Omit<Device, 'properties'> & {
|
|
4
|
+
properties: Device['properties'] &
|
|
5
|
+
Required<
|
|
6
|
+
Pick<
|
|
7
|
+
Device['properties'],
|
|
8
|
+
| 'temperature_celsius'
|
|
9
|
+
| 'temperature_fahrenheit'
|
|
10
|
+
| 'is_heating'
|
|
11
|
+
| 'is_cooling'
|
|
12
|
+
| 'is_fan_running'
|
|
13
|
+
| 'is_cooling_available'
|
|
14
|
+
| 'is_heating_available'
|
|
15
|
+
| 'available_hvac_mode_settings'
|
|
16
|
+
| 'fan_mode_setting'
|
|
17
|
+
| 'current_climate_setting'
|
|
18
|
+
>
|
|
19
|
+
>
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
// UPSTREAM: FanModeSetting missing in @seamapi/types.
|
|
23
|
+
export type FanModeSetting = ThermostatDevice['properties']['fan_mode_setting']
|
|
24
|
+
|
|
25
|
+
// UPSTREAM: HvacModeSetting missing in @seamapi/types.
|
|
26
|
+
export type HvacModeSetting =
|
|
27
|
+
ThermostatDevice['properties']['available_hvac_mode_settings'][number]
|
|
28
|
+
|
|
29
|
+
// UPSTREAM: ClimateSetting missing in @seamapi/types.
|
|
30
|
+
export interface ClimateSetting {
|
|
31
|
+
automatic_heating_enabled?: boolean
|
|
32
|
+
automatic_cooling_enabled?: boolean
|
|
33
|
+
hvac_mode_setting?: HvacModeSetting
|
|
34
|
+
cooling_set_point_celsius?: number
|
|
35
|
+
heating_set_point_celsius?: number
|
|
36
|
+
cooling_set_point_fahrenheit?: number
|
|
37
|
+
heating_set_point_fahrenheit?: number
|
|
38
|
+
manual_override_allowed?: boolean
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export const isThermostatDevice = (
|
|
42
|
+
device: Device
|
|
43
|
+
): device is ThermostatDevice => 'is_fan_running' in device.properties
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import type { Device } from '@seamapi/types/connect'
|
|
2
|
+
|
|
3
|
+
export const celsiusToFahrenheit = (t: number): number => (t * 9) / 5 + 32
|
|
4
|
+
|
|
5
|
+
export const fahrenheitToCelsius = (t: number): number => (t - 32) * (5 / 9)
|
|
6
|
+
|
|
7
|
+
export const getCoolingSetPointCelsius = (
|
|
8
|
+
variables: {
|
|
9
|
+
cooling_set_point_celsius?: number
|
|
10
|
+
cooling_set_point_fahrenheit?: number
|
|
11
|
+
},
|
|
12
|
+
device: Device
|
|
13
|
+
): number | undefined => {
|
|
14
|
+
if (variables.cooling_set_point_celsius != null) {
|
|
15
|
+
return variables.cooling_set_point_celsius
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
if (variables.cooling_set_point_fahrenheit != null) {
|
|
19
|
+
return fahrenheitToCelsius(variables.cooling_set_point_fahrenheit)
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
return (
|
|
23
|
+
device.properties.current_climate_setting?.cooling_set_point_celsius ??
|
|
24
|
+
undefined
|
|
25
|
+
)
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export const getCoolingSetPointFahrenheit = (
|
|
29
|
+
variables: {
|
|
30
|
+
cooling_set_point_celsius?: number
|
|
31
|
+
cooling_set_point_fahrenheit?: number
|
|
32
|
+
},
|
|
33
|
+
device: Device
|
|
34
|
+
): number | undefined => {
|
|
35
|
+
if (variables.cooling_set_point_fahrenheit != null) {
|
|
36
|
+
return variables.cooling_set_point_fahrenheit
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
if (variables.cooling_set_point_celsius != null) {
|
|
40
|
+
return celsiusToFahrenheit(variables.cooling_set_point_celsius)
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
return (
|
|
44
|
+
device.properties.current_climate_setting?.cooling_set_point_fahrenheit ??
|
|
45
|
+
undefined
|
|
46
|
+
)
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export const getHeatingSetPointCelsius = (
|
|
50
|
+
variables: {
|
|
51
|
+
heating_set_point_celsius?: number
|
|
52
|
+
heating_set_point_fahrenheit?: number
|
|
53
|
+
},
|
|
54
|
+
device: Device
|
|
55
|
+
): number | undefined => {
|
|
56
|
+
if (variables.heating_set_point_celsius != null) {
|
|
57
|
+
return variables.heating_set_point_celsius
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
if (variables.heating_set_point_fahrenheit != null) {
|
|
61
|
+
return fahrenheitToCelsius(variables.heating_set_point_fahrenheit)
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
return (
|
|
65
|
+
device.properties.current_climate_setting?.heating_set_point_celsius ??
|
|
66
|
+
undefined
|
|
67
|
+
)
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export const getHeatingSetPointFahrenheit = (
|
|
71
|
+
variables: {
|
|
72
|
+
heating_set_point_celsius?: number
|
|
73
|
+
heating_set_point_fahrenheit?: number
|
|
74
|
+
},
|
|
75
|
+
device: Device
|
|
76
|
+
): number | undefined => {
|
|
77
|
+
if (variables.heating_set_point_fahrenheit != null) {
|
|
78
|
+
return variables.heating_set_point_fahrenheit
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
if (variables.heating_set_point_celsius != null) {
|
|
82
|
+
return celsiusToFahrenheit(variables.heating_set_point_celsius)
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
return (
|
|
86
|
+
device.properties.current_climate_setting?.heating_set_point_fahrenheit ??
|
|
87
|
+
undefined
|
|
88
|
+
)
|
|
89
|
+
}
|
|
@@ -1,64 +1,82 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
SeamActionAttemptFailedError,
|
|
3
|
+
SeamActionAttemptTimeoutError,
|
|
4
|
+
SeamHttpApiError,
|
|
5
|
+
ThermostatsCoolBody,
|
|
6
|
+
} from '@seamapi/http/connect'
|
|
7
|
+
import type { ActionAttempt, Device } from '@seamapi/types/connect'
|
|
1
8
|
import {
|
|
2
9
|
useMutation,
|
|
3
10
|
type UseMutationResult,
|
|
4
11
|
useQueryClient,
|
|
5
12
|
} from '@tanstack/react-query'
|
|
6
|
-
import type {
|
|
7
|
-
SeamError,
|
|
8
|
-
ThermostatCoolRequest,
|
|
9
|
-
ThermostatDevice,
|
|
10
|
-
ThermostatsListResponse,
|
|
11
|
-
} from 'seamapi'
|
|
12
13
|
|
|
14
|
+
import {
|
|
15
|
+
getCoolingSetPointCelsius,
|
|
16
|
+
getCoolingSetPointFahrenheit,
|
|
17
|
+
} from 'lib/seam/thermostats/unit-conversion.js'
|
|
13
18
|
import { NullSeamClientError, useSeamClient } from 'lib/seam/use-seam-client.js'
|
|
14
19
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
type
|
|
20
|
+
export type UseCoolThermostatParams = never
|
|
21
|
+
|
|
22
|
+
export type UseCoolThermostatData = undefined
|
|
23
|
+
|
|
24
|
+
export type UseCoolThermostatMutationVariables = Pick<
|
|
25
|
+
ThermostatsCoolBody,
|
|
26
|
+
'device_id' | 'cooling_set_point_celsius' | 'cooling_set_point_fahrenheit'
|
|
27
|
+
>
|
|
28
|
+
|
|
29
|
+
type CoolThermostatActionAttempt = Extract<
|
|
30
|
+
ActionAttempt,
|
|
31
|
+
{ action_type: 'SET_COOL' }
|
|
32
|
+
>
|
|
33
|
+
|
|
34
|
+
type MutationError =
|
|
35
|
+
| SeamHttpApiError
|
|
36
|
+
| SeamActionAttemptFailedError<CoolThermostatActionAttempt>
|
|
37
|
+
| SeamActionAttemptTimeoutError<CoolThermostatActionAttempt>
|
|
18
38
|
|
|
19
39
|
export function useCoolThermostat(): UseMutationResult<
|
|
20
40
|
UseCoolThermostatData,
|
|
21
|
-
|
|
22
|
-
|
|
41
|
+
MutationError,
|
|
42
|
+
UseCoolThermostatMutationVariables
|
|
23
43
|
> {
|
|
24
44
|
const { client } = useSeamClient()
|
|
25
45
|
const queryClient = useQueryClient()
|
|
26
46
|
|
|
27
47
|
return useMutation<
|
|
28
48
|
UseCoolThermostatData,
|
|
29
|
-
|
|
30
|
-
|
|
49
|
+
MutationError,
|
|
50
|
+
UseCoolThermostatMutationVariables
|
|
31
51
|
>({
|
|
32
|
-
mutationFn: async (
|
|
52
|
+
mutationFn: async (variables) => {
|
|
33
53
|
if (client === null) throw new NullSeamClientError()
|
|
34
|
-
|
|
35
|
-
return await client.thermostats.cool(mutationParams)
|
|
54
|
+
await client.thermostats.cool(variables)
|
|
36
55
|
},
|
|
37
56
|
onSuccess: (_data, variables) => {
|
|
38
|
-
queryClient.setQueryData<
|
|
57
|
+
queryClient.setQueryData<Device | null>(
|
|
39
58
|
['devices', 'get', { device_id: variables.device_id }],
|
|
40
|
-
(
|
|
41
|
-
if (
|
|
59
|
+
(device) => {
|
|
60
|
+
if (device == null) {
|
|
42
61
|
return
|
|
43
62
|
}
|
|
44
|
-
|
|
45
|
-
return getUpdatedThermostat(thermostat, variables)
|
|
63
|
+
return getUpdatedDevice(device, variables)
|
|
46
64
|
}
|
|
47
65
|
)
|
|
48
66
|
|
|
49
|
-
queryClient.setQueryData<
|
|
67
|
+
queryClient.setQueryData<Device[]>(
|
|
50
68
|
['devices', 'list', { device_id: variables.device_id }],
|
|
51
|
-
(
|
|
52
|
-
if (
|
|
69
|
+
(devices): Device[] => {
|
|
70
|
+
if (devices == null) {
|
|
53
71
|
return []
|
|
54
72
|
}
|
|
55
73
|
|
|
56
|
-
return
|
|
57
|
-
if (
|
|
58
|
-
return
|
|
74
|
+
return devices.map((device) => {
|
|
75
|
+
if (device.device_id === variables.device_id) {
|
|
76
|
+
return getUpdatedDevice(device, variables)
|
|
59
77
|
}
|
|
60
78
|
|
|
61
|
-
return
|
|
79
|
+
return device
|
|
62
80
|
})
|
|
63
81
|
}
|
|
64
82
|
)
|
|
@@ -66,25 +84,37 @@ export function useCoolThermostat(): UseMutationResult<
|
|
|
66
84
|
})
|
|
67
85
|
}
|
|
68
86
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
variables:
|
|
72
|
-
):
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
properties
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
+
const getUpdatedDevice = (
|
|
88
|
+
device: Device,
|
|
89
|
+
variables: UseCoolThermostatMutationVariables
|
|
90
|
+
): Device => {
|
|
91
|
+
const { properties } = device
|
|
92
|
+
if (
|
|
93
|
+
'current_climate_setting' in properties &&
|
|
94
|
+
properties.current_climate_setting != null
|
|
95
|
+
) {
|
|
96
|
+
return {
|
|
97
|
+
...device,
|
|
98
|
+
properties: {
|
|
99
|
+
...properties,
|
|
100
|
+
current_climate_setting: {
|
|
101
|
+
...properties.current_climate_setting,
|
|
102
|
+
hvac_mode_setting: 'cool',
|
|
103
|
+
automatic_heating_enabled: false,
|
|
104
|
+
automatic_cooling_enabled: true,
|
|
105
|
+
heating_set_point_celsius: undefined,
|
|
106
|
+
heating_set_point_fahrenheit: undefined,
|
|
107
|
+
cooling_set_point_celsius: getCoolingSetPointCelsius(
|
|
108
|
+
variables,
|
|
109
|
+
device
|
|
110
|
+
),
|
|
111
|
+
cooling_set_point_fahrenheit: getCoolingSetPointFahrenheit(
|
|
112
|
+
variables,
|
|
113
|
+
device
|
|
114
|
+
),
|
|
115
|
+
},
|
|
87
116
|
},
|
|
88
|
-
}
|
|
117
|
+
}
|
|
89
118
|
}
|
|
119
|
+
return device
|
|
90
120
|
}
|