Skip to main content

SoilMoisture

A soil moisture sensor.

import { SoilMoisture } from "@devicescript/core"

const soilMoisture = new SoilMoisture()

Registers

reading

Indicates the wetness of the soil, from dry to wet.

  • type: Register<number> (packing format u0.16)

  • read only

import { SoilMoisture } from "@devicescript/core"

const soilMoisture = new SoilMoisture()
// ...
const value = await soilMoisture.reading.read()
  • track incoming values
import { SoilMoisture } from "@devicescript/core"

const soilMoisture = new SoilMoisture()
// ...
soilMoisture.reading.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

readingError

The error on the moisture reading.

  • type: Register<number> (packing format u0.16)

  • optional: this register may not be implemented

  • read only

import { SoilMoisture } from "@devicescript/core"

const soilMoisture = new SoilMoisture()
// ...
const value = await soilMoisture.readingError.read()
  • track incoming values
import { SoilMoisture } from "@devicescript/core"

const soilMoisture = new SoilMoisture()
// ...
soilMoisture.readingError.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

variant

Describe the type of physical sensor.

  • type: Register<number> (packing format u8)

  • optional: this register may not be implemented

  • constant: the register value will not change (until the next reset)

  • read only

import { SoilMoisture } from "@devicescript/core"

const soilMoisture = new SoilMoisture()
// ...
const value = await soilMoisture.variant.read()
note

write and read will block until a server is bound to the client.