Updatable

interface Updatable<IMMUTABLE : Any?, MUTABLE : Any?>

Known direct subclasses
ActivatedCarbonFilterMonitoring

API for the ActivatedCarbonFilterMonitoring trait.

Automation

The main representation an automation, composed of various types of Automation nodes, including Starter instances, Condition instances, Action instances, and more.

BasicInformation

API for the BasicInformation trait.

Binding

API for the Binding trait.

BooleanStateConfiguration

API for the BooleanStateConfiguration trait.

ColorControl

API for the ColorControl trait.

DeviceEnergyManagementMode

API for the DeviceEnergyManagementMode trait.

DishwasherMode

API for the DishwasherMode trait.

DoorLock

API for the DoorLock trait.

EnergyEvseMode

API for the EnergyEvseMode trait.

EnergyEvse

API for the EnergyEvse trait.

EnergyPreference

API for the EnergyPreference trait.

ExtendedFanControl

API for the ExtendedFanControl trait.

ExtendedThermostat

API for the ExtendedThermostat trait.

FanControl

API for the FanControl trait.

HepaFilterMonitoring

API for the HepaFilterMonitoring trait.

Identify

API for the Identify trait.

LaundryDryerControls

API for the LaundryDryerControls trait.

LaundryWasherControls

API for the LaundryWasherControls trait.

LaundryWasherMode

API for the LaundryWasherMode trait.

LevelControl

API for the LevelControl trait.

ModeSelect

API for the ModeSelect trait.

OccupancySensing

API for the OccupancySensing trait.

OnOff

API for the OnOff trait.

OtaSoftwareUpdateRequestor

API for the OtaSoftwareUpdateRequestor trait.

OvenMode

API for the OvenMode trait.

PumpConfigurationAndControl

API for the PumpConfigurationAndControl trait.

RefrigeratorAndTemperatureControlledCabinetMode

API for the RefrigeratorAndTemperatureControlledCabinetMode trait.

SoftwareUpdate

API for the SoftwareUpdate trait.

ThermostatUserInterfaceConfiguration

API for the ThermostatUserInterfaceConfiguration trait.

Thermostat

API for the Thermostat trait.

UnitTesting

API for the UnitTesting trait.

UserLabel

API for the UserLabel trait.

ValveConfigurationAndControl

API for the ValveConfigurationAndControl trait.

WindowCovering

API for the WindowCovering trait.

Known indirect subclasses
MutableAutomation

Mutable attributes for an Automation.


This interface keeps the lifecycle of mutable objects within the scope of the update function.

Summary

Public functions

suspend IMMUTABLE
update(optimisticReturn: (IMMUTABLE) -> Unit, init: MUTABLE.() -> Unit)

Creates a mutable copy of an object and calls the given function to mutate it, then saves it and returns a new immutable copy with the updated state.

Public functions

update

suspend fun update(optimisticReturn: (IMMUTABLE) -> Unit = {}, init: MUTABLE.() -> Unit): IMMUTABLE

Creates a mutable copy of an object and calls the given function to mutate it, then saves it and returns a new immutable copy with the updated state.

For example:

device.getTrait(OnOff).update { this.onTime = OptionalValue.present(10u) }
Parameters
optimisticReturn: (IMMUTABLE) -> Unit = {}

the function that is passed a version of the Trait that has the optimistic mutations blended with its current state.

init: MUTABLE.() -> Unit

the function which mutates the object.