Docs vuepress (#476)

Convert docs to vuepress
This commit is contained in:
Florian authored and GitHub committed 2019-10-30 22:15:40 +01:00
1 parent 1fa5d48e74
commit aa263dc559
114 files changed
+1739 -64

No files matched your search

+98
View File
@@ -0,0 +1,98 @@
# Integrate Home Assistant
## Auto discovery
So as to enable HASS auto discovery with MQTT you have to uncomment [ZmqttDiscovery](https://github.com/1technophile/OpenMQTTGateway/blob/0180a0dbd55ed8e0799e30ee84f68070a6f478fa/User_config.h#L99) in user_config.h
And enable discovery on your MQTT integration definition in HASS.
OMG will use the auto discovery functionality of home assistant to create sensors and gateways into your HASS instance automaticaly.
## Manual integration examples
From @123, @finity,@denniz03
### Door sensor
```yaml
binary_sensor:
- platform: mqtt
name: "test"
state_topic: "home/OpenMQTTGateway/433toMQTT"
value_template: >-
{% if value_json.value == '7821834' %}
{{'ON'}}
{% elif value_json.value == '7821838' %}
{{'OFF'}}
{% else %}
{{states('binary_sensor.test') | upper}}
{% endif %}
qos: 0
device_class: opening
```
```yaml
binary_sensor:
- platform: mqtt
name: doorbell
state_topic: 'home/OpenMQTTGateway/SRFBtoMQTT'
#value_template: "{{ value_json.raw }}"
value_template: >-
{% if value_json.value == '14163857' %}
{{'ON'}}
{% else %}
{{states('binary_sensor.doorbell') | upper}}
{% endif %}
off_delay: 30
device_class: 'sound'
- binary_sensor:
platform: mqtt
name: light_back_sensor
state_topic: 'home/OpenMQTTGateway/SRFBtoMQTT'
#value_template: '{{ value_jason.value }}'
value_template: >-
{% if value_json.value == '1213858' %}
{{'ON'}}
{% else %}
{{states('binary_sensor.light_back_sensor') | upper}}
{% endif %}
off_delay: 5
- binary_sensor:
platform: mqtt
name: rf_outlet_sensor
state_topic: 'home/OpenMQTTGateway/SRFBtoMQTT'
value_template: >-
{% if value_json.value == '16766303' %}
{{'ON'}}
{% else %}
{{states('binary_sensor.rf_outlet_sensor') | upper}}
{% endif %}
```
### Motion sensor
```yaml
binary_sensor:
- platform: mqtt
name: "Bewegung_Schlafzimmer"
#device_class: motion
state_topic: "home/OpenMQTTGateway1/HCSR501toMQTT"
value_template: '{{ value_json["hcsr501"] }}'
payload_on: "true"
payload_off: "false"
```
### Switches
```yaml
#switches
switch:
- platform: mqtt
name: kaku_a2
state_topic: "home/OpenMQTTGateway/commands/MQTTto433"
command_topic: "home/OpenMQTTGateway/commands/MQTTto433"
payload_on: "16405"
payload_off: "16404"
qos: "0"
retain: true
#pushbullet
notify:
- platform: pushbullet
name: hassio
api_key: <api_key>
```
+246
View File
@@ -0,0 +1,246 @@
# Integrate Node Red
Here is a simple set of flows for integrating OpenMQTTGateway with NodeRED via an ESP8266 module.
In this example I have used a Wemos D1 Mini with some cheap RF modules.
![](https://i.imgur.com/z2RFvUw.jpg)
A flow to receive 433MHz signals into NodeRED (you will need to update the IP address of your broker)
![](https://i.imgur.com/2UWYzHg.jpg)
```json
[
{
"id": "6d1b2915.7ce798",
"type": "mqtt in",
"z": "a9a9b76b.e69998",
"name": "433MQTT",
"topic": "home/OpenMQTTGateway/433toMQTT",
"qos": "2",
"broker": "4572f098.cc1",
"x": 80,
"y": 740,
"wires": [
[
"fe53b819.4f9568"
]
]
},
{
"id": "fe53b819.4f9568",
"type": "debug",
"z": "a9a9b76b.e69998",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"x": 290,
"y": 740,
"wires": []
},
{
"id": "4572f098.cc1",
"type": "mqtt-broker",
"z": "",
"name": "",
"broker": "192.168.0.56",
"port": "1883",
"clientid": "",
"usetls": false,
"compatmode": true,
"keepalive": "60",
"cleansession": true,
"willTopic": "",
"willQos": "0",
"willRetain": "false",
"willPayload": "",
"birthTopic": "",
"birthQos": "0",
"birthRetain": "false",
"birthPayload": ""
}
]
```
A flow to send 433MHz signals from NodeRED
![](https://i.imgur.com/PMlWyii.jpg)
```json
[
{
"id": "ff924d56.459d6",
"type": "mqtt out",
"z": "a9a9b76b.e69998",
"name": "MQTTto433",
"topic": "home/OpenMQTTGateway/commands/MQTTto433",
"qos": "",
"retain": "",
"broker": "4572f098.cc1",
"x": 610,
"y": 860,
"wires": []
},
{
"id": "6c25a2d4.6c733c",
"type": "inject",
"z": "a9a9b76b.e69998",
"name": "",
"topic": "",
"payload": "On",
"payloadType": "str",
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"x": 90,
"y": 840,
"wires": [
[
"7689fe88.45679"
]
]
},
{
"id": "a76d2f03.5f3",
"type": "change",
"z": "a9a9b76b.e69998",
"name": "",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "5510487",
"tot": "str"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 380,
"y": 840,
"wires": [
[
"ff924d56.459d6"
]
]
},
{
"id": "7689fe88.45679",
"type": "switch",
"z": "a9a9b76b.e69998",
"name": "",
"property": "payload",
"propertyType": "msg",
"rules": [
{
"t": "eq",
"v": "On",
"vt": "str"
},
{
"t": "eq",
"v": "Off",
"vt": "str"
}
],
"checkall": "true",
"repair": false,
"outputs": 2,
"x": 210,
"y": 860,
"wires": [
[
"a76d2f03.5f3"
],
[
"6a7c2c3a.567794"
]
]
},
{
"id": "7e52ec9.00dde14",
"type": "inject",
"z": "a9a9b76b.e69998",
"name": "",
"topic": "",
"payload": "Off",
"payloadType": "str",
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"x": 90,
"y": 880,
"wires": [
[
"7689fe88.45679"
]
]
},
{
"id": "6a7c2c3a.567794",
"type": "change",
"z": "a9a9b76b.e69998",
"name": "",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "4527444",
"tot": "str"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 380,
"y": 880,
"wires": [
[
"ff924d56.459d6"
]
]
},
{
"id": "20991aea.cca8a6",
"type": "comment",
"z": "a9a9b76b.e69998",
"name": "Set you RF codes here.",
"info": "",
"x": 380,
"y": 800,
"wires": []
},
{
"id": "4572f098.cc1",
"type": "mqtt-broker",
"z": "",
"name": "",
"broker": "192.168.0.56",
"port": "1883",
"clientid": "",
"usetls": false,
"compatmode": true,
"keepalive": "60",
"cleansession": true,
"willTopic": "",
"willQos": "0",
"willRetain": "false",
"willPayload": "",
"birthTopic": "",
"birthQos": "0",
"birthRetain": "false",
"birthPayload": ""
}
]
```
+103
View File
@@ -0,0 +1,103 @@
# Integrate OPENHAB2
## MQTT 2 manual setup >=Openhab2.4
You should have a mqtt broker installed (either mosquitto or the OpenHAB2 embedded one)
In paper UI
* In bindings add the MQTT Things binding
* Inbox > MQTT Things binding > Add manualy >MQTT Broker : configure your borker
* Inbox > MQTT Things binding > Add manualy >Generic MQTT Thing : select your previously configured broker as a bridge and enter your thing definition (example RF plug, weather station, PIR sensor)
* Configuration > Things > "Your thing" : click on + and add one channel for each thing parameter (example for a weather station, you will have one channel for the temperature, one channel for the humidity etc..)
* For a state channel define the MQTT topic like this:
## For a mi flora or mi jia temperature :
`home/+/BTtoMQTT/C47C9999D1B8`
* Click on show more
* And add in "Incoming values transformation"
`JSONPATH:$.tem`
* Click on Save
* Repeat for each channels and each things
* Configuration > Things > "Your thing" : click on a channel and add 1 or several items per channel defining what you want to display in the sitemap
or
* Define your items in an item file like this by refering to your mqtt things channels:
For a mi flora and mi jia
```java
// MI JIA
Number humidity "Humidité air[%.1f %%]" <water> {channel="mqtt:topic:dc2222e6:humidite-mijia"}
Number temperature "Température[%.1f °C]" <temperature> {channel="mqtt:topic:dc2222e6:temperature-mijia"}
Number battery "Batterie capteur[%.1f %]"<volt> {channel="mqtt:topic:dc2222e6:batterie-mijia"}
// MI FLORA
Number humidity_P "Hygrométrie plante[%.1f %%]" <water> {channel="mqtt:topic:1fb33334:humidite-miflora"}
Number temperature_P "Température plante[%.1f °C]" <temperature> {channel="mqtt:topic:1fb33334:temperature-miflora"}
Number fertility_P "Fertilité plante[%.1f uS/cm]" {channel="mqtt:topic:1fb33334:fertilite-miflora"}
Number lux_P "Luminiosité plante[%.1f lux]" {channel="mqtt:topic:1fb33334:lux-miflora"}
```
## For a switch channel, add a channel by choosing the type "On/Off switch"
define the MQTT state topic like this:
`home/+/433toMQTT`
* Click on show more
* add in "Incoming values transformation"
`JSONPATH:$.value`
* define the command topic like this:
`home/+/commands/MQTTto433`
* add the value corresponding to ON state and to OFF state
1312081
1312084
* Click on Save
* Repeat for each channels and each things
* Configuration > Things > "Your thing" : click on a channel and add 1 or several switch per channel
or
* Define your items in an item file like this by refering to your mqtt thing channel:
`Switch OMGSwitch "Prise 1" <poweroutlet> {channel="mqtt:topic:08998877:Power1"}`
# Presence detection (from @rickitaly)
in thing file:
```java
Thing mqtt:topic:omgentrance (mqtt:broker:localBroker) {
Channels:
Type string : blepresence "People Presence" [ stateTopic="home/home_presence/OpenMQTTGatewayEntrance"]
}
```
in item file
```java
String OMG_BLE_Entrance "BLE Entrance Detector" { channel="mqtt:topic:omgentrance:blepresence" }
Switch Presence_Keys_Rick "Rick's Keys" <keyring> (People, gKeys) {expire="240s,OFF"}
```
In rule file:
```java
rule "BLE Presence Detector"
when
Item OMG_BLE_Entrance received update
then
val String msg = (OMG_BLE_Entrance.state as StringType).toString
val String id = transform("JSONPATH", "$.id", msg).toString
if(id == "xx:xx:xx:xx:xx:xx")
Presence_Keys_Rick.postUpdate(ON)
end
```