Skip to main content

Temperature

A thermometer measuring outside or inside environment.

import { Temperature } from "@devicescript/core"

const temperature = new Temperature()

Registers

reading

The temperature.

  • type: Register<number> (packing format i22.10)

  • read only

import { Temperature } from "@devicescript/core"

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

const temperature = new Temperature()
// ...
temperature.reading.subscribe(async (value) => {
...
})
note

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

minReading

Lowest temperature that can be reported.

  • type: Register<number> (packing format i22.10)

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

  • read only

import { Temperature } from "@devicescript/core"

const temperature = new Temperature()
// ...
const value = await temperature.minReading.read()
note

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

maxReading

Highest temperature that can be reported.

  • type: Register<number> (packing format i22.10)

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

  • read only

import { Temperature } from "@devicescript/core"

const temperature = new Temperature()
// ...
const value = await temperature.maxReading.read()
note

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

readingError

The real temperature is between temperature - temperature_error and temperature + temperature_error.

  • type: Register<number> (packing format u22.10)

  • optional: this register may not be implemented

  • read only

import { Temperature } from "@devicescript/core"

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

const temperature = new Temperature()
// ...
temperature.readingError.subscribe(async (value) => {
...
})
note

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

variant

Specifies the type of thermometer.

  • 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 { Temperature } from "@devicescript/core"

const temperature = new Temperature()
// ...
const value = await temperature.variant.read()
note

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