The redis
extension allows you to connect to a redis server and gather data. You may connect to a local or remote server.
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.
Option | Type | Required | Description |
key | [String] | Yes | Unique slug id for the connection. This is referenced by the interfaces. |
host | [String] | No | Host address of the redis server. Default: 127.0.0.1 |
port | [Integer] | No | Port of the redis server. Default: 6379 |
Here is a config of a connection config.
"redis": [{
"key": "localhost_redis",
"host": "127.0.0.1",
"port": 6379
}]
Provides a sensor to read data from the memory store or listen for an event.
Option | Type | Required | Description |
key | [String] | Yes | Unique slug id for the component |
connection | [String] | Yes | The key from the redis connection config. |
type | [String] | No | Set the sensor to read data from memory store or listen to events. Options: state or event . Default: state |
name | [String] | No | Friendly display name of component. Useful for UI. |
classifier | [String] | No | Choose a specific sensor classifier to change formatting on frontend. Default: general |
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.
Option | Type | Required | Description |
topic | [String] | No | topic for the sensor to listen on. Default: sensor/{key} |
expires | [Integer] | No | Time in seconds that state should be considered invalid. 0 = disabled. Default: 0 |
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"
}]
A state
type sensor will pull data from the redis memory store based on a set state_key
.
Option | Type | Required | Description |
state_key | [String] | Yes | The key to pull from the redis memory store. |
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"
}]