# DeviceX / FunctionX

DeviceX and FunctionX is the main representation for devices and functions in the platform. There are also some legacy functions and devices but these are being replaced with new. The X-models uses the same data-format for both devices and functions. The data model contains an arbitrary data part where key-value objects can be stored. This is called meta-data and different systems might use different parameters.

# Base model

The base model consists of very few parameters.

Name Description
ID Identifier in API and database
Installation ID Identifier for what installation the object belongs to
Type For Devices this is the system used, for functions this is the UI type
Meta Key-value store of additional parameters

# Metadata

Metadata is all parameters that is unspecified and can be anything. Some system sets parameters that are only used by that system. Since data is shared between different systems some common type keys can be added.

There are no requirements for meta-data to exist so all systems should work with default parameters and check existence in the object before use.

# Default types and meta-keys

This list contains information about function-types and metadata that is relevant to them.

# Additional topics

Some functions require several topics to work. These function set topic_read and topic_write for the main function and then uses state topics for other functions.

This table shows an example of topics for a RGB+Dimmer function.

Key Value
topic_read Main topic, dimmer
topic_read_red Topic for red channel
topic_read_green Topic for green channel
topic_read_blue Topic for blue channel