README.md 5.1 KB
Newer Older
Daniel Morlock's avatar
Daniel Morlock committed
1
2
# Meross Bridge

3
## Installation
Daniel Morlock's avatar
Daniel Morlock committed
4

5
For production usage you can just install the package like any other python package. There are two ways to do this:
Daniel Morlock's avatar
Daniel Morlock committed
6

7
1. Checkout by hand and install by hand or via pip:  
Daniel Morlock's avatar
Daniel Morlock committed
8

9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
   ```bash
   $ git clone git@git.local.awesome-it.de:daniel.morlock/meross-bridge.git
   $ cd meross-bridge
   $ python setup.py install
   # OR:
   $ pip install .
   $ meross-bridge --help
   ```

 2. Install via pip directly from Gitlab:
   
   ```bash
   # beware of the / instead of the : in the URL!
   $ pip install git+ssh://git@git.local.awesome-it.de/daniel.morlock/meross-bridge.git
   # or if you prefer https over ssh
   $ pip install git+https://gitlab.awesome-it.de/daniel.morlock/meross-bridge.git
   ```
   
Set your Meross credentials in `/etc/default/meross-bridge`:
Daniel Morlock's avatar
Daniel Morlock committed
28
29

```
30
31
32
MEROSS_EMAIL=yourmail@example.org
MEROSS_PASSWORD=secret
```
Daniel Morlock's avatar
Daniel Morlock committed
33

34
35
36
37
38
You might want to change mode to `0600` since you store a password in this file:

```
$ chmod 0600 /etc/default/meross-bridge
```
Daniel Morlock's avatar
Daniel Morlock committed
39

40
To start on system boot, you can use the `meross-bridge.service` file for `systemd`:
Daniel Morlock's avatar
Daniel Morlock committed
41
42

```bash
43
44
45
$ sudo cp systemd/meross-bridge.service /etc/systemd/system/meross-bridge.service
$ sudo systemctl enable meross-bridge.service
$ sudo systemctl start meross-bridge.service
Daniel Morlock's avatar
Daniel Morlock committed
46
47
```

48
Check the logs as follows:
Daniel Morlock's avatar
Daniel Morlock committed
49

50
51
```
$ sudo journalctl -fu meross-bridge.service 
Daniel Morlock's avatar
Daniel Morlock committed
52
53
```

54
## OpenHAB
Daniel Morlock's avatar
Daniel Morlock committed
55

56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
### MQTT Broker
You need to run a MQTT broker i.e. the embedded broker from OpenHAB:
  
  1. To do so, go to the Paper UI
  2. Select "Add-ons"
  3. Switch to "Misc"-Tab
  4. Install "MQTT Broker Moquette" (misc-mqttbroker - 2.5.4) or "MQTT Embedded Broker"
  
Note that there is some mess in the current OpenHAB docs and forums where Moquette was replaced with Embedded Broker:
https://www.openhab.org/blog/2018-12-16-mqtt-arrives-in-the-modern-openhab-2-x-architecture.html. 

### MQTT Binding
Further we need to install a MQTT binding to connect to the broker:

  1. To do so, go to the Paper UI
  2. Select "Add-ons"
  3. Switch to "Bindings"-Tab
  4. Install "MQTT Binding" (binding-mqtt - 2.5.4) 
  
### Things
Example to create the thing `meross_thermostats_device_1` for a Meross thermostat with the appropriate channels:
Daniel Morlock's avatar
Daniel Morlock committed
77
78

```
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
Bridge mqtt:broker:broker "MQTT Broker" [ host="localhost", port=1883, secure=false, clientID="meross-bridge-client" ]
{
    Thing topic meross_thermostats_device_1 "Meross Thermostat: Device 1" {
    Channels:
        Type string : name      "name"          [ stateTopic="meross/<device_id>/name"]
        Type string : mode      "mode"          [ stateTopic="meross/<device_id>/mode", commandTopic="meross/<device_id>/set/mode"]
        Type number : mode      "mode_value"    [ stateTopic="meross/<device_id>/mode_value", commandTopic="meross/<device_id>/set/mode_value"]
        Type switch : onff      "onoff"         [ stateTopic="meross/<device_id>/onoff", on="True", off="False", commandTopic="meross/<device_id>/set/onoff"]
        Type switch : heating   "heating"       [ stateTopic="meross/<device_id>/heating", on="True", off="False"]
        Type switch : online    "online"        [ stateTopic="meross/<device_id>/online", on="True", off="False"]
        Type number : battery   "battery"       [ stateTopic="meross/<device_id>/battery"]
        Type number : room      "room"          [ stateTopic="meross/<device_id>/room_temperature"]
        Type number : target    "target"        [ stateTopic="meross/<device_id>/target_temperature", commandTopic="meross/<device_id>/set/target_temperature"]
    }
``` 
Daniel Morlock's avatar
Daniel Morlock committed
94

95
96
97
98
99
100
101
102
103
104
105
106
107
108
You'll find the appropriate `<device_id>` in the logging output from device discovery after starting the `meross-bridge`. 

### Items
Example to create things from the thing `meross_thermostats_device_1` from above:
```
String	meross_thermostats_device_1_name        "meross_thermostats_device_1_name"          (meross) {channel="mqtt:topic:broker:meross_thermostats_device_1:name"}
String	meross_thermostats_device_1_mode        "meross_thermostats_device_1_mode"          (meross) {channel="mqtt:topic:broker:meross_thermostats_device_1:mode"}
Number	meross_thermostats_device_1_mode_value  "meross_thermostats_device_1_mode_value"    (meross) {channel="mqtt:topic:broker:meross_thermostats_device_1:mode_value"}
Switch	meross_thermostats_device_1_onoff       "meross_thermostats_device_1_onoff"         (meross) {channel="mqtt:topic:broker:meross_thermostats_device_1:onff"}
Switch	meross_thermostats_device_1_heating     "meross_thermostats_device_1_heating"       (meross) {channel="mqtt:topic:broker:meross_thermostats_device_1:heating"}
Switch	meross_thermostats_device_1_online      "meross_thermostats_device_1_online"        (meross) {channel="mqtt:topic:broker:meross_thermostats_device_1:online"}
Number	meross_thermostats_device_1_battery     "meross_thermostats_device_1_battery"       (meross) {channel="mqtt:topic:broker:meross_thermostats_device_1:battery"}
Number	meross_thermostats_device_1_room        "meross_thermostats_device_1_room"          (meross) {channel="mqtt:topic:broker:meross_thermostats_device_1:room"}
Number	meross_thermostats_device_1_target      "meross_thermostats_device_1_target"        (meross) {channel="mqtt:topic:broker:meross_thermostats_device_1:target"}
Daniel Morlock's avatar
Daniel Morlock committed
109
```