Redis

The redis extension allows you to connect to a redis server and gather data. You may connect to a local or remote server.

Extension Configs

This extension has some configurations required on the extension level to setup the connection. First you should add configs for your redis connection and supply a key. Then any interfaces will reference this key to use the connection. This reduces unnecessary connections by centralizing the connection logic on the extension level and letting the interfaces focus on just using the already established connection.

OptionTypeRequiredDescription
key[String]YesUnique slug id for the connection. This is referenced by the interfaces.
host[String]NoHost address of the redis server. Default: 127.0.0.1
port[Integer]NoPort of the redis server. Default: 6379

Config Examples

Here is a config of a connection config.

"redis": [{
    "key": "localhost_redis",
    "host": "127.0.0.1",
    "port": 6379
}]

Sensor Interface

Provides a sensor to read data from the memory store or listen for an event.

OptionTypeRequiredDescription
key[String]YesUnique slug id for the component
connection[String]YesThe key from the redis connection config.
type[String]NoSet the sensor to read data from memory store or listen to events. Options: state or event. Default: state
name[String]NoFriendly display name of component. Useful for UI.
classifier[String]NoChoose a specific sensor classifier to change formatting on frontend. Default: general

Event Sensor

A event sensors will take a topic to listen on and has an expires key in case the state should be considered stale after a set time.

OptionTypeRequiredDescription
topic[String]Notopic for the sensor to listen on. Default: sensor/{key}
expires[Integer]NoTime in seconds that state should be considered invalid. 0 = disabled. Default: 0

Config

Here is a config of a complete redis event sensor.

"sensor": [{
    "key": "redis_event_sensor",
    "interface": "redis",
    "connection": "local_redis",
    "type": "event"
    "topic": "mudpi/example/topic",
    "expires": 3600,
    "classifier": "general"
}]

State Sensor

A state type sensor will pull data from the redis memory store based on a set state_key.

OptionTypeRequiredDescription
state_key[String]YesThe key to pull from the redis memory store.

Config

Here is a config of a complete redis state sensor.

"sensor": [{
    "key": "redis_state_sensor",
    "interface": "redis",
    "connection": "local_redis",
    "type": "state"
    "state_key": "example_component.state",
    "classifier": "general"
}]