MagicMirror module that publishes the internal USER_PRESENCE broadcast notification to an MQTT topic, allowing to use the mirror
as an occupancy/motion sensor in a home automation setup.
Data for the USER_PRESENCE notification can be supplied by a PIR sensor module, a camera-based motion detection module, or any other source.
- Make sure you already have a module that publishes the
USER_PRESENCEnotification to other modules. - Clone the repository into
modulesfolder of your install. - Run
cd MMM-UserPresenceToMQTTandnpm install. - Add the module to your config as described below.
- Restart your MagicMirror.
Place the configuration block anywhere in your modules list in config.js. The module does not render anything to the mirror.
{
module: 'MMM-UserPresenceToMQTT',
config: {
mqttServer: "mqtt://mqtt.server.com:1883",
mqttTopic: "home/magicmirror/userpresent",
// check below for other options
}
}
| Option | Description |
|---|---|
mqttServer |
The MQTT server to publish to, including protocol (mqtt:// or mqtts://), host/path and port.
Default value: mqtt://localhost:1883
|
mqttUser |
Username to authenticate against the MQTT server.
Default value: undefined (no auth) |
mqttPassword |
Password to authenticate against the MQTT server.
Default value: undefined (no auth) |
mqttTopic |
MQTT topic to publish the notifications to.
Default value: home/magicmirror/userpresent
|
notificationType |
What type of broadcast notification is listened to and published to MQTT.
Default value: USER_PRESENCE
|
- mqtt (via
npm install)