class Matter::Cluster::IlluminanceMeasurementCluster

Overview

Illuminance Measurement Cluster (0x0400)

Provides an interface to illuminance measurement functionality, including configuration and provision of notifications of illuminance measurements.

Illuminance values are expressed using a logarithmic scale: MeasuredValue = 10,000 x log10(illuminance) + 1 where illuminance is in lux (lx).

Special values:

Specification: Matter 1.4 § 2.2

Defined in:

matter/cluster/illuminance_measurement_cluster.cr

Constant Summary

ATTR_LIGHT_SENSOR_TYPE = 4_u32
ATTR_MAX_MEASURED_VALUE = 2_u32
ATTR_MEASURED_VALUE = 0_u32

Attributes

ATTR_MIN_MEASURED_VALUE = 1_u32
ATTR_TOLERANCE = 3_u32
CLUSTER_ID = 1024_u32
MAX_ILLUMINANCE = 65534_u16
MIN_ILLUMINANCE = 0_u16

Illuminance value limits

Constructors

Class Method Summary

Instance Method Summary

Instance methods inherited from class Matter::Cluster::Base

attributes : Array(AttributeMetadata) attributes, cluster_id : DataType::ClusterId cluster_id, cluster_id=(cluster_id : DataType::ClusterId) cluster_id=, commands : Array(CommandMetadata) commands, data_version : UInt32 data_version, data_version=(data_version : UInt32) data_version=, endpoint_id : DataType::EndpointNumber endpoint_id, endpoint_id=(endpoint_id : DataType::EndpointNumber) endpoint_id=, events : Array(EventMetadata) events, get_attribute_metadata(attribute_id : UInt32) : AttributeMetadata | Nil get_attribute_metadata, get_command_metadata(command_id : UInt32) : CommandMetadata | Nil get_command_metadata, invoke_command(command_id : UInt32, fields : Bytes = Bytes.new(0)) : InteractionModel::Status | Bytes invoke_command, name : String name, read_attribute(attribute_id : UInt32) : InteractionModel::Status | Bytes read_attribute, write_attribute(attribute_id : UInt32, value : Bytes) : InteractionModel::Status write_attribute

Constructor methods inherited from class Matter::Cluster::Base

new(endpoint_id : DataType::EndpointNumber, cluster_id : DataType::ClusterId) new

Constructor Detail

def self.new(endpoint_id : DataType::EndpointNumber, measured_value : UInt16 | Nil = nil, min_measured_value : UInt16 | Nil = nil, max_measured_value : UInt16 | Nil = nil, tolerance : UInt16 | Nil = nil, light_sensor_type : LightSensorType | Nil = nil) #

[View source]

Class Method Detail

def self.cluster_id #

Illuminance Measurement Cluster (0x0400)

Provides an interface to illuminance measurement functionality, including configuration and provision of notifications of illuminance measurements.

Illuminance values are expressed using a logarithmic scale: MeasuredValue = 10,000 x log10(illuminance) + 1 where illuminance is in lux (lx).

Special values:

  • 0 indicates illuminance too low to measure
  • null indicates invalid measurement
  • Range: 1 lx to 3.576 Mlx (MeasuredValue: 1 to 0xFFFE)

Specification: Matter 1.4 § 2.2


[View source]
def self.from_lux(lux : Float64) : UInt16 #

Convert from lux (illuminance) to measured value Formula: MeasuredValue = 10,000 x log10(illuminance) + 1 Valid range: 1 lx to 3.576 Mlx


[View source]
def self.to_lux(measured_value : UInt16) : Float64 #

Convert from measured value to lux (illuminance) Formula: illuminance = 10^((MeasuredValue - 1) / 10000)


[View source]

Instance Method Detail

def attributes : Array(AttributeMetadata) #
Description copied from class Matter::Cluster::Base

Get all attribute metadata


[View source]
def commands : Array(CommandMetadata) #
Description copied from class Matter::Cluster::Base

Get all command metadata


[View source]
def light_sensor_type : LightSensorType | Nil #

Light sensor type, optional


[View source]
def light_sensor_type=(light_sensor_type : LightSensorType | Nil) #

Light sensor type, optional


[View source]
def max_measured_value : UInt16 | Nil #

Maximum measurable illuminance (or nil)


[View source]
def max_measured_value=(max_measured_value : UInt16 | Nil) #

Maximum measurable illuminance (or nil)


[View source]
def measured_value : UInt16 | Nil #

Current measured illuminance, or nil if unknown Value of 0 indicates too low to measure


[View source]
def measured_value=(measured_value : UInt16 | Nil) #

Current measured illuminance, or nil if unknown Value of 0 indicates too low to measure


[View source]
def min_measured_value : UInt16 | Nil #

Minimum measurable illuminance (1-65533, or nil)


[View source]
def min_measured_value=(min_measured_value : UInt16 | Nil) #

Minimum measurable illuminance (1-65533, or nil)


[View source]
def name : String #
Description copied from class Matter::Cluster::Base

Get cluster name


[View source]
def on_illuminance_changed(&block : UInt16 | Nil, UInt16 | Nil -> Nil) #

[View source]
def read_attribute(attribute_id : UInt32) : Bytes | InteractionModel::Status #
Description copied from class Matter::Cluster::Base

Read an attribute value


[View source]
def tolerance : UInt16 | Nil #

Measurement tolerance (max 2048), optional


[View source]
def tolerance=(tolerance : UInt16 | Nil) #

Measurement tolerance (max 2048), optional


[View source]
def update_illuminance(value : UInt16 | Nil) #

Update the measured illuminance value


[View source]