@seamapi/react 2.20.0 → 3.0.0-beta.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 +7 -8
- 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
|
@@ -1,64 +1,88 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
SeamActionAttemptFailedError,
|
|
3
|
+
SeamActionAttemptTimeoutError,
|
|
4
|
+
SeamHttpApiError,
|
|
5
|
+
ThermostatsHeatCoolBody,
|
|
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
|
-
ThermostatDevice,
|
|
9
|
-
ThermostatHeatCoolRequest,
|
|
10
|
-
ThermostatsListResponse,
|
|
11
|
-
} from 'seamapi'
|
|
12
13
|
|
|
14
|
+
import {
|
|
15
|
+
getCoolingSetPointCelsius,
|
|
16
|
+
getCoolingSetPointFahrenheit,
|
|
17
|
+
getHeatingSetPointCelsius,
|
|
18
|
+
getHeatingSetPointFahrenheit,
|
|
19
|
+
} from 'lib/seam/thermostats/unit-conversion.js'
|
|
13
20
|
import { NullSeamClientError, useSeamClient } from 'lib/seam/use-seam-client.js'
|
|
14
21
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
type
|
|
22
|
+
export type UseHeatCoolThermostatParams = never
|
|
23
|
+
|
|
24
|
+
export type UseHeatCoolThermostatData = undefined
|
|
25
|
+
|
|
26
|
+
export type UseHeatCoolThermostatMutationVariables = Pick<
|
|
27
|
+
ThermostatsHeatCoolBody,
|
|
28
|
+
| 'device_id'
|
|
29
|
+
| 'heating_set_point_celsius'
|
|
30
|
+
| 'heating_set_point_fahrenheit'
|
|
31
|
+
| 'cooling_set_point_celsius'
|
|
32
|
+
| 'cooling_set_point_fahrenheit'
|
|
33
|
+
>
|
|
34
|
+
|
|
35
|
+
type HeatCoolThermostatActionAttempt = Extract<
|
|
36
|
+
ActionAttempt,
|
|
37
|
+
{ action_type: 'SET_HEAT_COOL' }
|
|
38
|
+
>
|
|
39
|
+
|
|
40
|
+
type MutationError =
|
|
41
|
+
| SeamHttpApiError
|
|
42
|
+
| SeamActionAttemptFailedError<HeatCoolThermostatActionAttempt>
|
|
43
|
+
| SeamActionAttemptTimeoutError<HeatCoolThermostatActionAttempt>
|
|
18
44
|
|
|
19
45
|
export function useHeatCoolThermostat(): UseMutationResult<
|
|
20
46
|
UseHeatCoolThermostatData,
|
|
21
|
-
|
|
22
|
-
|
|
47
|
+
MutationError,
|
|
48
|
+
UseHeatCoolThermostatMutationVariables
|
|
23
49
|
> {
|
|
24
50
|
const { client } = useSeamClient()
|
|
25
51
|
const queryClient = useQueryClient()
|
|
26
52
|
|
|
27
53
|
return useMutation<
|
|
28
54
|
UseHeatCoolThermostatData,
|
|
29
|
-
|
|
30
|
-
|
|
55
|
+
MutationError,
|
|
56
|
+
UseHeatCoolThermostatMutationVariables
|
|
31
57
|
>({
|
|
32
|
-
mutationFn: async (
|
|
58
|
+
mutationFn: async (variables) => {
|
|
33
59
|
if (client === null) throw new NullSeamClientError()
|
|
34
|
-
|
|
35
|
-
return await client.thermostats.heatCool(mutationParams)
|
|
60
|
+
await client.thermostats.heatCool(variables)
|
|
36
61
|
},
|
|
37
62
|
onSuccess: (_data, variables) => {
|
|
38
|
-
queryClient.setQueryData<
|
|
63
|
+
queryClient.setQueryData<Device | null>(
|
|
39
64
|
['devices', 'get', { device_id: variables.device_id }],
|
|
40
|
-
(
|
|
41
|
-
if (
|
|
65
|
+
(device) => {
|
|
66
|
+
if (device == null) {
|
|
42
67
|
return
|
|
43
68
|
}
|
|
44
|
-
|
|
45
|
-
return getUpdatedThermostat(thermostat, variables)
|
|
69
|
+
return getUpdatedDevice(device, variables)
|
|
46
70
|
}
|
|
47
71
|
)
|
|
48
72
|
|
|
49
|
-
queryClient.setQueryData<
|
|
73
|
+
queryClient.setQueryData<Device[]>(
|
|
50
74
|
['devices', 'list', { device_id: variables.device_id }],
|
|
51
|
-
(
|
|
52
|
-
if (
|
|
75
|
+
(devices): Device[] => {
|
|
76
|
+
if (devices == null) {
|
|
53
77
|
return []
|
|
54
78
|
}
|
|
55
79
|
|
|
56
|
-
return
|
|
57
|
-
if (
|
|
58
|
-
return
|
|
80
|
+
return devices.map((device) => {
|
|
81
|
+
if (device.device_id === variables.device_id) {
|
|
82
|
+
return getUpdatedDevice(device, variables)
|
|
59
83
|
}
|
|
60
84
|
|
|
61
|
-
return
|
|
85
|
+
return device
|
|
62
86
|
})
|
|
63
87
|
}
|
|
64
88
|
)
|
|
@@ -66,18 +90,43 @@ export function useHeatCoolThermostat(): UseMutationResult<
|
|
|
66
90
|
})
|
|
67
91
|
}
|
|
68
92
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
variables:
|
|
72
|
-
):
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
properties
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
93
|
+
const getUpdatedDevice = (
|
|
94
|
+
device: Device,
|
|
95
|
+
variables: UseHeatCoolThermostatMutationVariables
|
|
96
|
+
): Device => {
|
|
97
|
+
const { properties } = device
|
|
98
|
+
if (
|
|
99
|
+
'current_climate_setting' in properties &&
|
|
100
|
+
properties.current_climate_setting != null
|
|
101
|
+
) {
|
|
102
|
+
return {
|
|
103
|
+
...device,
|
|
104
|
+
properties: {
|
|
105
|
+
...properties,
|
|
106
|
+
current_climate_setting: {
|
|
107
|
+
...properties.current_climate_setting,
|
|
108
|
+
hvac_mode_setting: 'heat_cool',
|
|
109
|
+
automatic_heating_enabled: true,
|
|
110
|
+
automatic_cooling_enabled: true,
|
|
111
|
+
heating_set_point_celsius: getHeatingSetPointCelsius(
|
|
112
|
+
variables,
|
|
113
|
+
device
|
|
114
|
+
),
|
|
115
|
+
heating_set_point_fahrenheit: getHeatingSetPointFahrenheit(
|
|
116
|
+
variables,
|
|
117
|
+
device
|
|
118
|
+
),
|
|
119
|
+
cooling_set_point_celsius: getCoolingSetPointCelsius(
|
|
120
|
+
variables,
|
|
121
|
+
device
|
|
122
|
+
),
|
|
123
|
+
cooling_set_point_fahrenheit: getCoolingSetPointFahrenheit(
|
|
124
|
+
variables,
|
|
125
|
+
device
|
|
126
|
+
),
|
|
127
|
+
},
|
|
80
128
|
},
|
|
81
|
-
}
|
|
129
|
+
}
|
|
82
130
|
}
|
|
131
|
+
return device
|
|
83
132
|
}
|
|
@@ -1,64 +1,82 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
SeamActionAttemptFailedError,
|
|
3
|
+
SeamActionAttemptTimeoutError,
|
|
4
|
+
SeamHttpApiError,
|
|
5
|
+
ThermostatsHeatBody,
|
|
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
|
-
ThermostatDevice,
|
|
9
|
-
ThermostatHeatRequest,
|
|
10
|
-
ThermostatsListResponse,
|
|
11
|
-
} from 'seamapi'
|
|
12
13
|
|
|
14
|
+
import {
|
|
15
|
+
getHeatingSetPointCelsius,
|
|
16
|
+
getHeatingSetPointFahrenheit,
|
|
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 UseHeatThermostatParams = never
|
|
21
|
+
|
|
22
|
+
export type UseHeatThermostatData = undefined
|
|
23
|
+
|
|
24
|
+
export type UseHeatThermostatMutationVariables = Pick<
|
|
25
|
+
ThermostatsHeatBody,
|
|
26
|
+
'device_id' | 'heating_set_point_celsius' | 'heating_set_point_fahrenheit'
|
|
27
|
+
>
|
|
28
|
+
|
|
29
|
+
type HeatThermostatActionAttempt = Extract<
|
|
30
|
+
ActionAttempt,
|
|
31
|
+
{ action_type: 'SET_HEAT' }
|
|
32
|
+
>
|
|
33
|
+
|
|
34
|
+
type MutationError =
|
|
35
|
+
| SeamHttpApiError
|
|
36
|
+
| SeamActionAttemptFailedError<HeatThermostatActionAttempt>
|
|
37
|
+
| SeamActionAttemptTimeoutError<HeatThermostatActionAttempt>
|
|
18
38
|
|
|
19
39
|
export function useHeatThermostat(): UseMutationResult<
|
|
20
40
|
UseHeatThermostatData,
|
|
21
|
-
|
|
22
|
-
|
|
41
|
+
MutationError,
|
|
42
|
+
UseHeatThermostatMutationVariables
|
|
23
43
|
> {
|
|
24
44
|
const { client } = useSeamClient()
|
|
25
45
|
const queryClient = useQueryClient()
|
|
26
46
|
|
|
27
47
|
return useMutation<
|
|
28
48
|
UseHeatThermostatData,
|
|
29
|
-
|
|
30
|
-
|
|
49
|
+
MutationError,
|
|
50
|
+
UseHeatThermostatMutationVariables
|
|
31
51
|
>({
|
|
32
|
-
mutationFn: async (
|
|
52
|
+
mutationFn: async (variables) => {
|
|
33
53
|
if (client === null) throw new NullSeamClientError()
|
|
34
|
-
|
|
35
|
-
return await client.thermostats.heat(mutationParams)
|
|
54
|
+
await client.thermostats.heat(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 useHeatThermostat(): 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: UseHeatThermostatMutationVariables
|
|
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: 'heat',
|
|
103
|
+
automatic_heating_enabled: true,
|
|
104
|
+
automatic_cooling_enabled: false,
|
|
105
|
+
cooling_set_point_celsius: undefined,
|
|
106
|
+
cooling_set_point_fahrenheit: undefined,
|
|
107
|
+
heating_set_point_celsius: getHeatingSetPointCelsius(
|
|
108
|
+
variables,
|
|
109
|
+
device
|
|
110
|
+
),
|
|
111
|
+
heating_set_point_fahrenheit: getHeatingSetPointFahrenheit(
|
|
112
|
+
variables,
|
|
113
|
+
device
|
|
114
|
+
),
|
|
115
|
+
},
|
|
87
116
|
},
|
|
88
|
-
}
|
|
117
|
+
}
|
|
89
118
|
}
|
|
119
|
+
return device
|
|
90
120
|
}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
SeamActionAttemptFailedError,
|
|
3
|
+
SeamActionAttemptTimeoutError,
|
|
4
|
+
SeamHttpApiError,
|
|
5
|
+
ThermostatsSetFanModeBody,
|
|
6
|
+
} from '@seamapi/http/connect'
|
|
7
|
+
import type { ActionAttempt, Device } from '@seamapi/types/connect'
|
|
8
|
+
import {
|
|
9
|
+
useMutation,
|
|
10
|
+
type UseMutationResult,
|
|
11
|
+
useQueryClient,
|
|
12
|
+
} from '@tanstack/react-query'
|
|
13
|
+
|
|
14
|
+
import { NullSeamClientError, useSeamClient } from 'lib/seam/use-seam-client.js'
|
|
15
|
+
|
|
16
|
+
export type UseSetThermostatFanModeParams = never
|
|
17
|
+
|
|
18
|
+
export type UseSetThermostatFanModeData = undefined
|
|
19
|
+
|
|
20
|
+
export type UseSetThermostatFanModeMutationVariables = ThermostatsSetFanModeBody
|
|
21
|
+
|
|
22
|
+
type SetThermostatFanModeActionAttempt = Extract<
|
|
23
|
+
ActionAttempt,
|
|
24
|
+
{ action_type: 'SET_FAN_MODE' }
|
|
25
|
+
>
|
|
26
|
+
|
|
27
|
+
type MutationError =
|
|
28
|
+
| SeamHttpApiError
|
|
29
|
+
| SeamActionAttemptFailedError<SetThermostatFanModeActionAttempt>
|
|
30
|
+
| SeamActionAttemptTimeoutError<SetThermostatFanModeActionAttempt>
|
|
31
|
+
|
|
32
|
+
export function useSetThermostatFanMode(): UseMutationResult<
|
|
33
|
+
UseSetThermostatFanModeData,
|
|
34
|
+
MutationError,
|
|
35
|
+
UseSetThermostatFanModeMutationVariables
|
|
36
|
+
> {
|
|
37
|
+
const { client } = useSeamClient()
|
|
38
|
+
const queryClient = useQueryClient()
|
|
39
|
+
|
|
40
|
+
return useMutation<
|
|
41
|
+
UseSetThermostatFanModeData,
|
|
42
|
+
MutationError,
|
|
43
|
+
UseSetThermostatFanModeMutationVariables
|
|
44
|
+
>({
|
|
45
|
+
mutationFn: async (variables) => {
|
|
46
|
+
if (client === null) throw new NullSeamClientError()
|
|
47
|
+
await client.thermostats.setFanMode(variables)
|
|
48
|
+
},
|
|
49
|
+
onSuccess: (_data, variables) => {
|
|
50
|
+
queryClient.setQueryData<Device | null>(
|
|
51
|
+
['devices', 'get', { device_id: variables.device_id }],
|
|
52
|
+
(device) => {
|
|
53
|
+
if (device == null) {
|
|
54
|
+
return
|
|
55
|
+
}
|
|
56
|
+
return getUpdatedDevice(device, variables)
|
|
57
|
+
}
|
|
58
|
+
)
|
|
59
|
+
|
|
60
|
+
queryClient.setQueryData<Device[]>(
|
|
61
|
+
['devices', 'list', { device_id: variables.device_id }],
|
|
62
|
+
(devices): Device[] => {
|
|
63
|
+
if (devices == null) {
|
|
64
|
+
return []
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
return devices.map((device) => {
|
|
68
|
+
if (device.device_id === variables.device_id) {
|
|
69
|
+
return getUpdatedDevice(device, variables)
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
return device
|
|
73
|
+
})
|
|
74
|
+
}
|
|
75
|
+
)
|
|
76
|
+
},
|
|
77
|
+
})
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
const getUpdatedDevice = (
|
|
81
|
+
device: Device,
|
|
82
|
+
variables: UseSetThermostatFanModeMutationVariables
|
|
83
|
+
): Device => {
|
|
84
|
+
const { properties } = device
|
|
85
|
+
if ('fan_mode_setting' in properties && properties.fan_mode_setting != null) {
|
|
86
|
+
return {
|
|
87
|
+
...device,
|
|
88
|
+
properties: {
|
|
89
|
+
...properties,
|
|
90
|
+
fan_mode_setting: variables.fan_mode_setting,
|
|
91
|
+
},
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
return device
|
|
95
|
+
}
|
|
@@ -1,64 +1,75 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
SeamActionAttemptFailedError,
|
|
3
|
+
SeamActionAttemptTimeoutError,
|
|
4
|
+
SeamHttpApiError,
|
|
5
|
+
ThermostatsOffBody,
|
|
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
|
-
ThermostatDevice,
|
|
9
|
-
ThermostatOffRequest,
|
|
10
|
-
ThermostatsListResponse,
|
|
11
|
-
} from 'seamapi'
|
|
12
13
|
|
|
13
14
|
import { NullSeamClientError, useSeamClient } from 'lib/seam/use-seam-client.js'
|
|
14
15
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
type
|
|
16
|
+
export type UseSetThermostatOffParams = never
|
|
17
|
+
|
|
18
|
+
export type UseSetThermostatOffData = undefined
|
|
19
|
+
|
|
20
|
+
export type UseSetThermostatOffMutationVariables = ThermostatsOffBody
|
|
21
|
+
|
|
22
|
+
type SetThermostatOffActionAttempt = Extract<
|
|
23
|
+
ActionAttempt,
|
|
24
|
+
{ action_type: 'SET_THERMOSTAT_OFF' }
|
|
25
|
+
>
|
|
26
|
+
|
|
27
|
+
type MutationError =
|
|
28
|
+
| SeamHttpApiError
|
|
29
|
+
| SeamActionAttemptFailedError<SetThermostatOffActionAttempt>
|
|
30
|
+
| SeamActionAttemptTimeoutError<SetThermostatOffActionAttempt>
|
|
18
31
|
|
|
19
32
|
export function useSetThermostatOff(): UseMutationResult<
|
|
20
33
|
UseSetThermostatOffData,
|
|
21
|
-
|
|
22
|
-
|
|
34
|
+
MutationError,
|
|
35
|
+
UseSetThermostatOffMutationVariables
|
|
23
36
|
> {
|
|
24
37
|
const { client } = useSeamClient()
|
|
25
38
|
const queryClient = useQueryClient()
|
|
26
39
|
|
|
27
40
|
return useMutation<
|
|
28
41
|
UseSetThermostatOffData,
|
|
29
|
-
|
|
30
|
-
|
|
42
|
+
MutationError,
|
|
43
|
+
UseSetThermostatOffMutationVariables
|
|
31
44
|
>({
|
|
32
|
-
mutationFn: async (
|
|
45
|
+
mutationFn: async (variables) => {
|
|
33
46
|
if (client === null) throw new NullSeamClientError()
|
|
34
|
-
|
|
35
|
-
return await client.thermostats.off(mutationParams)
|
|
47
|
+
await client.thermostats.off(variables)
|
|
36
48
|
},
|
|
37
49
|
onSuccess: (_data, variables) => {
|
|
38
|
-
queryClient.setQueryData<
|
|
50
|
+
queryClient.setQueryData<Device | null>(
|
|
39
51
|
['devices', 'get', { device_id: variables.device_id }],
|
|
40
|
-
(
|
|
41
|
-
if (
|
|
52
|
+
(device) => {
|
|
53
|
+
if (device == null) {
|
|
42
54
|
return
|
|
43
55
|
}
|
|
44
|
-
|
|
45
|
-
return getUpdatedThermostat(thermostat)
|
|
56
|
+
return getUpdatedDevice(device)
|
|
46
57
|
}
|
|
47
58
|
)
|
|
48
59
|
|
|
49
|
-
queryClient.setQueryData<
|
|
60
|
+
queryClient.setQueryData<Device[]>(
|
|
50
61
|
['devices', 'list', { device_id: variables.device_id }],
|
|
51
|
-
(
|
|
52
|
-
if (
|
|
62
|
+
(devices): Device[] => {
|
|
63
|
+
if (devices == null) {
|
|
53
64
|
return []
|
|
54
65
|
}
|
|
55
66
|
|
|
56
|
-
return
|
|
57
|
-
if (
|
|
58
|
-
return
|
|
67
|
+
return devices.map((device) => {
|
|
68
|
+
if (device.device_id === variables.device_id) {
|
|
69
|
+
return getUpdatedDevice(device)
|
|
59
70
|
}
|
|
60
71
|
|
|
61
|
-
return
|
|
72
|
+
return device
|
|
62
73
|
})
|
|
63
74
|
}
|
|
64
75
|
)
|
|
@@ -66,18 +77,31 @@ export function useSetThermostatOff(): UseMutationResult<
|
|
|
66
77
|
})
|
|
67
78
|
}
|
|
68
79
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
properties
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
+
const getUpdatedDevice = (device: Device): Device => {
|
|
81
|
+
const { properties } = device
|
|
82
|
+
if (
|
|
83
|
+
'current_climate_setting' in properties &&
|
|
84
|
+
properties.current_climate_setting != null
|
|
85
|
+
) {
|
|
86
|
+
return {
|
|
87
|
+
...device,
|
|
88
|
+
properties: {
|
|
89
|
+
...properties,
|
|
90
|
+
is_fan_running: false,
|
|
91
|
+
is_cooling: false,
|
|
92
|
+
is_heating: false,
|
|
93
|
+
current_climate_setting: {
|
|
94
|
+
...properties.current_climate_setting,
|
|
95
|
+
automatic_cooling_enabled: false,
|
|
96
|
+
automatic_heating_enabled: false,
|
|
97
|
+
hvac_mode_setting: 'off',
|
|
98
|
+
heating_set_point_celsius: undefined,
|
|
99
|
+
heating_set_point_fahrenheit: undefined,
|
|
100
|
+
cooling_set_point_celsius: undefined,
|
|
101
|
+
cooling_set_point_fahrenheit: undefined,
|
|
102
|
+
},
|
|
80
103
|
},
|
|
81
|
-
}
|
|
104
|
+
}
|
|
82
105
|
}
|
|
106
|
+
return device
|
|
83
107
|
}
|