WaterLevel
caution
This service is rc and may change in the future.
A sensor that measures liquid/water level.
import { WaterLevel } from "@devicescript/core"
const waterLevel = new WaterLevel()
Registers
reading
The reported water level.
type:
Register<number>
(packing formatu0.16
)read only
import { WaterLevel } from "@devicescript/core"
const waterLevel = new WaterLevel()
// ...
const value = await waterLevel.reading.read()
- track incoming values
import { WaterLevel } from "@devicescript/core"
const waterLevel = new WaterLevel()
// ...
waterLevel.reading.subscribe(async (value) => {
...
})
note
write
and read
will block until a server is bound to the client.
readingError
The error rage on the current reading
type:
Register<number>
(packing formatu0.16
)optional: this register may not be implemented
read only
import { WaterLevel } from "@devicescript/core"
const waterLevel = new WaterLevel()
// ...
const value = await waterLevel.readingError.read()
- track incoming values
import { WaterLevel } from "@devicescript/core"
const waterLevel = new WaterLevel()
// ...
waterLevel.readingError.subscribe(async (value) => {
...
})
note
write
and read
will block until a server is bound to the client.
variant
The type of physical sensor.
type:
Register<number>
(packing formatu8
)optional: this register may not be implemented
constant: the register value will not change (until the next reset)
read only
import { WaterLevel } from "@devicescript/core"
const waterLevel = new WaterLevel()
// ...
const value = await waterLevel.variant.read()
note
write
and read
will block until a server is bound to the client.