mqtt light control with location tracking
GPL-3.0 License
Mqtt light-control for singles. It comes with room tracking, which works best in a single person environment.
cargo install install --path .
export RUST_LOG=light_control=info
~/.cargo/bin/light-control examples/home.json
Here is a small overview on how an light-control sees your sensors
The threshold is the time threshold that need to be reached by an other room, before we detect the other room as the current presents of the user.
Should be simple. light-control knows
Have a look at ./examples/home.json to get an impression.
You can use the mosquitto client to subscribe to all messages
mosquitto_sub -v \
-u light-control \
-P password \
-h localhost \
-t "#"
This would be a line you see:
zigbee2mqtt/motion_sensor_7 {"battery":100,"voltage":3015,"linkquality":99,"occupancy":true}
zigbee2mqtt/motion_sensor_7
is the topicoccupancy
is the key describing the statelight-control only excepts messages in flat json
topic
: topic to listen to.key
: json key to read the state.room
: that should be considered present if this sensor is triggered.invert_state
: (default false)delay
: (default 60)topic
: topic to listen for state.key
: json key to read the state.rooms
: rooms to which switch react.delay
:command
: command control.
command
: turn on and off commandinit_command
: (default null)topic
: topic to send commandson
: (default "ON")off
: (default "OFF")The first scene in the one chosen after program start.
name
: name of the scenebrightness
: brightness level for this scenedisabled_switches
:enabled_switches
:ignored_switches
:room_tracking_enabled
: tracking enabled or notignored_sensors
:Mqtt is the perfect place to control light-control.
mosquitto_pub \
-h localhost \
-u homeassistant \
-P password \
-t "control/lights/set" \
-m '{"scene":"<scene-name>"}'