Options
All
  • Public
  • Public/Protected
  • All
Menu

Class DimmerDevice

Z-Bus dimmer device which adjusts brightness of a light

Hierarchy

  • DimmerDevice

Implements

Index

Constructors

constructor

  • Creates a new Z-Bus DimmerDevice

    Example

    { DimmerDevice } = require('@z-bus/api');
    //Dims address 0 to 50%
    new DimmerDevice(0).dim(0.5);
    

    Parameters

    • address: number

    Returns DimmerDevice

Properties

address

address: number[]

Addresses the Z-Bus device is linked to. The device will react when receiving a corresponding DeviceEvent and change its state accordingly.

Optional brightness

brightness: number

Current brightness of the Z-Bus DimmerDevice as a number between 0.0 and 1.0 in %

  • 0.0 is off
  • 0.5 is 50% brightness
  • 1.0 is 100% on

Optional id

id: string

Unique id that identifies the Z-Bus device in the database

Optional memory

memory: number

Last known brightness of the Z-Bus DimmerDevice as a number between 0.0 and 1.0 in %

  • 0.0 was off
  • 0.5 was 50% brightness
  • 1.0 was 100% on

Optional name

name: string

Display name of the Z-Bus device

Optional profile

profile: string

Display profile for the Z-Bus device (determines state descriptions and symbols), e.g.:

  • a lamp
  • a heating,
  • ...

Optional state

state: "on" | "off"

Current state the Z-Bus device is in, e.g.:

  • 'undefined'
  • 'on'
  • 'off'
  • 'up'
  • 'down'
  • 'stop'

type

type: DeviceType = 'dimmer'

Identifies the different types of Z-Bus devices:

Static Machine

Machine: MachineDefinition = ...

Static description

description: "Dimmer (Licht)"

Methods

dim

  • dim(brightness: number, duration?: number): void
  • Dims the Z-Bus DimmerDevice

    Parameters

    • brightness: number

      Brightness of the DimmerDevice between 0.0 and 1.0 %

    • duration: number = 8

      Duration of a full dimming ramp (from 0 to 100%) between 0.04 and 160 seconds

    Returns void

off

  • off(): void

on

  • on(): void

toggle

  • toggle(): void
  • Toggles the Z-Bus DimmerDevice. The device will alternate

    • from off to on, or
    • from on to off

    Returns void

transmit

  • transmit(command: number | "toggle" | "up-stop" | "down-stop" | "start" | "end" | "on" | "off" | "up" | "down" | "stop", brightness?: number, duration?: number): void
  • Controls the Z-Bus DimmerDevice

    Parameters

    • command: number | "toggle" | "up-stop" | "down-stop" | "start" | "end" | "on" | "off" | "up" | "down" | "stop"

      Command used to control the DimmerDevice between 0 and 255)

    • Optional brightness: number

      Brightness of the DimmerDevice between 0.0 and 1.0 %

    • duration: number = 8

      Duration of a full dimming ramp (from 0 to 100%) between 0.04 and 160 seconds

    Returns void

Static createEvent

  • createEvent(address: number, command: number | "toggle" | "up-stop" | "down-stop" | "start" | "end" | "on" | "off" | "up" | "down" | "stop", data?: DimmerData): DeviceEvent
  • Creates an event to control a Z-Bus DimmerDevice

    Example

    { DimmerDevice } = require('@z-bus/api');
    //Event to dim address 0 to 50%
    const event = DimmerDevice.createEvent(0, 'on', {brightness: 0.5, duration: 8, direction: 0});
    

    Parameters

    • address: number

      Address of the controlled DimmerDevice between 0 and 242

    • command: number | "toggle" | "up-stop" | "down-stop" | "start" | "end" | "on" | "off" | "up" | "down" | "stop"

      Command used to control the DimmerDevice between 0 and 255

    • Optional data: DimmerData

      may contain brightness and duration of the dimming ramp

    Returns DeviceEvent

    the new event

Generated using TypeDoc