mirko3000 / MMM-xiaomi

Xiaomi smarthome plugin for the magic mirror
26 stars 3 forks source link

MMM-xiaomi

Additional Module for MagicMirror² https://github.com/MichMich/MagicMirror/

Module: MMM-xiaomi

This module displays data from your Xiaomi smart home sensors (temperature, humidity, window state, light state). It also calculates recommended ventilation for your indoor rooms in case the humidity exceed 60%. This requires an outside sensor to take into account the outside humidity and temperature.

Bildschirmfoto_2017_11_11_um_13_25_37

Iconography:

If you use the MAX! heating system you can install my other module MMM-max and include heating indication in this module as well.

Installation

  1. Navigate into your MagicMirror's modules folder and execute git clone https://github.com/mirko3000/MMM-xiaomi.git. A new folder will appear, navigate into it.
  2. Execute npm install

Using the module

To use this module, add it to the modules array in the config/config.js file:

modules: [
    {
        module: 'MMM-xiaomi',
        position: 'bottom_left',
        header: 'Temperature / Humidity',  // This is optional
        config: {
            // See 'Configuration options' for more information.
        }
    },

]

Configuration options

The following properties can be configured:

Option Description
gatewayIP The IP address of your Xiaomi smarthome gateway.

Possible values: 192.168.1.100
Default value: 192.168.0.1
This value is mandatory
gatewayToken The optional authentification token for your gateway in case your device does not allow direct access.

Possible values: cfbdb215c0824fcc971917e36822fcbe
Default value: none
This value is optional.
animationSpeed The animation speed on refreshing data.

Possible values: 500
Default value: 1000
This value is optional.
outsideSensorId In case you have an sensor outside you can provide the ID here. This is used to calculate ventilation effects.

Possible values: 158d020172841d
Default value: none
This value is optional.
showTend Shows an icon indicating temperature and humidity trend (up, down, equal)

Possible values: true
Default value: true
This value is optional.
showWindow Shows an icon for the open state of the door/window sensors.

Possible values: true
Default value: false
This value is optional.
showLights Shows an icon for the state of lights in the room.

Possible values: true
Default value: false
This value is optional.
showHeating Shows an icon for the heating state of the MAX! system.

Possible values: true
Default value: false
This value is optional.
showNotifications Wether to enable visual notifications on temperature and humidity alarms.

Possible values: true
Default value: true
This value is optional.
audioNotifications Wether to enable audio notifications on temperature and humidity alarms. You need a MM with speakers or audio device connected. See https://www.raspberrypi.org/documentation/configuration/audio-config.md for help on setting up audio on a raspberry.

Possible values: true
Default value: false
This value is optional.
minTemperature Minimum temperature for indoor rooms. In case temperature drops below this value a notification is displayed (optionally also audio notification).

Possible values: 18
Default value: 17
This value is optional.
maxTemperature Maximum temperature for indoor rooms. In case temperature raises above this value a notification is displayed (optionally also audio notification).

Possible values: 22
Default value: 99
This value is optional.
maxHumidity Maximum humidity for indoor rooms. In case humidity exceeds this value a notification is displayed (optionally also audio notification).

Possible values: 70
Default value: 68
This value is optional.
celcius Wether the temperature should be displayed in celcius (true) or fahrenheit (false).

Possible values: false
Default value: true
This value is optional.
rooms List of configured rooms.
See "Room configuration options" options below.

Room configuration options

Option Description
name The name of your room

Possible values: Living room
Default value: none
sortOrder The sorting order for your room. Lower numbers will be sorted above higher numbers.

Possible values: 20
Default value: none
devices A list of device IDs within your room. This can be all kind of (supported) devices, like temperature, door/window sensors or yeelights.

Possible values: ['158d000171240d', '158d00026cddae']
Default value: none

Example:

modules: [
    {
        module: 'MMM-xiaomi',
        position: 'bottom_left',
        header: 'Temperature / Humidity',  // This is optional
        config: {
            gatewayIP: '192.168.0.1',
            outsideSensorId: '158d0001618421',
            showWindow: true,
            showVentilation: true,
            showLights: false,
            audioNotifications: true,
            rooms:  [
                {
                    name: 'Living room',
                    sortOrder: 10,
                    devices : ['158d000171840d', '158d00016ccdae']
                },
                {
                    name: 'Bedroom',
                    sortOrder: 20,
                    devices : ['158d0001635ac2']
                },
            ]
        }
    },

]

Authentification

In case you need a security token to access your gateway you can provide this token via the configuration parameters. To find out the correct token do the following:

  1. Install miio command line tools via 'npm install -g miio'
  2. Discover your devices via 'miio --discover'
  3. In your gateway device you can now see the security token required, use this in the configuration

Base API

This Modul is using the MIIO library (https://github.com/aholstenson/miio).