MQTT-MAC-IP-mDNS (#1245)
This commit is contained in:
1 parent
1c62d74e56
commit
c4300a002f
21 files changed
+100
-100
No files matched your search
@@ -1,8 +1,8 @@
|
||||
# Integrate Home Assistant
|
||||
|
||||
Home Assistant provide the [MQTT integration](https://www.home-assistant.io/integrations/mqtt/) and through this integration it is possible to exploit and manage the messages published by OpenMqttGateway.
|
||||
Home Assistant provide the [MQTT integration](https://www.home-assistant.io/integrations/mqtt/) and through this integration it is possible to exploit and manage the messages published by OpenMQTTGateway.
|
||||
|
||||
Once this integration on home assistant is configured with the same mqtt broker, it is possible to create devices manually or through the autodiscovery function.
|
||||
Once this integration on home assistant is configured with the same MQTT broker, it is possible to create devices manually or through the autodiscovery function.
|
||||
|
||||
|
||||
## Auto discovery
|
||||
@@ -11,7 +11,7 @@ From Home Assistant site
|
||||
|
||||
> The discovery of MQTT devices will enable one to use MQTT devices with only minimal configuration effort on the side of Home Assistant. The configuration is done on the device itself and the topic used by the device.
|
||||
|
||||
On OpenMqttGateway the Home Assistant discovery is enabled by default on all binaries and platformio configurations except for UNO. With Arduino IDE please read the [advanced configuration section](../upload/advanced-configuration#auto-discovery) of the documentation. Here are a few tips for activating discovery on Home Assistant, but for detailed configuration please refer to the Home Assistant website.
|
||||
On OpenMQTTGateway the Home Assistant discovery is enabled by default on all binaries and platformio configurations except for UNO. With Arduino IDE please read the [advanced configuration section](../upload/advanced-configuration#auto-discovery) of the documentation. Here are a few tips for activating discovery on Home Assistant, but for detailed configuration please refer to the Home Assistant website.
|
||||
|
||||
Enable discovery on your MQTT integration in HASS.
|
||||
|
||||
@@ -36,7 +36,7 @@ OMG will use the auto discovery functionality of home assistant to create gatewa
|
||||
|
||||
## MQTT Device Trigger and RF
|
||||
|
||||
With OpenMqttGateway [configured to receive RF signals](./setitup/rf.html) the messages are transmitted as indicated by [RCSwitch based gateway](./use/rf.html#rcswitch-based-gateway), so it is possible to receive a pulse every time the sensor discover a signal.
|
||||
With OpenMQTTGateway [configured to receive RF signals](./setitup/rf.html) the messages are transmitted as indicated by [RCSwitch based gateway](./use/rf.html#rcswitch-based-gateway), so it is possible to receive a pulse every time the sensor discover a signal.
|
||||
|
||||
With autodiscovery enabled, HomeAssistant will discover a [MQTT Device Trigger](https://www.home-assistant.io/integrations/device_trigger.mqtt/) identified by the value field given in the mqtt argument.
|
||||
|
||||
@@ -163,14 +163,14 @@ Sensor:
|
||||
sensor:
|
||||
- platform: mqtt
|
||||
name: "Weight"
|
||||
state_topic: "home/OpenMQTTGateway/BTtoMQTT/AAAAAAAAAAAA" # replace your mqtt topic here
|
||||
state_topic: "home/OpenMQTTGateway/BTtoMQTT/AAAAAAAAAAAA" # replace your MQTT topic here
|
||||
value_template: '{{ value_json["weight"] }}'
|
||||
unit_of_measurement: "kg"
|
||||
icon: mdi:weight-kilogram
|
||||
|
||||
- platform: mqtt
|
||||
name: "Impedance"
|
||||
state_topic: "home/OpenMQTTGateway/BTtoMQTT/AAAAAAAAAAAA" # replace your mqtt topic here also
|
||||
state_topic: "home/OpenMQTTGateway/BTtoMQTT/AAAAAAAAAAAA" # replace your MQTT topic here also
|
||||
value_template: '{{ value_json["impedance"] }}'
|
||||
unit_of_measurement: "Ohm"
|
||||
icon: mdi:omega
|
||||
|
||||
@@ -18,7 +18,7 @@ The things will appear in the inbox of the paperUI, add them and links the chann
|
||||

|
||||
|
||||
## MQTT 2 manual setup >=Openhab2.4
|
||||
You should have a mqtt broker installed (either mosquitto or the OpenHAB2 embedded one)
|
||||
You should have an MQTT broker installed (either mosquitto or the OpenHAB2 embedded one)
|
||||
|
||||
In paper UI
|
||||
* In bindings add the MQTT Things binding
|
||||
@@ -42,7 +42,7 @@ In paper UI
|
||||
* 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:
|
||||
* Define your items in an item file like this by refering to your MQTT things channels:
|
||||
For a mi flora and mi jia
|
||||
|
||||
```java
|
||||
@@ -80,7 +80,7 @@ Number lux_P "Luminiosité plante[%.1f lux]" {channel="mqtt:topic:
|
||||
|
||||
* 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:
|
||||
* 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"}`
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ Added to that it retrieves the measures from the devices below. By default the d
|
||||
|Devices|Model|Measurements|
|
||||
|-|:-:|:-:|
|
||||
| ATorch Battery Capacity Monitor (c)|DT24|volt/amp/watt|
|
||||
| BLE watches with fixed mac||rssi for presence detection|
|
||||
| BLE watches with fixed MAC||rssi for presence detection|
|
||||
| BLE beacons keychains||rssi for presence detection|
|
||||
| BlueMaestro|TempoDisc|temperature/humidity/duepoint/voltage|
|
||||
| ClearGrass |CGG1|temperature/humidity/battery|
|
||||
|
||||
@@ -15,7 +15,7 @@ You are using ESP8266 or ESP32, for other boards TLS is not supported.
|
||||
### Configure secure connection in the gateway
|
||||
To enable the secure connection and use TLS set the `#define MQTT_DEFAULT_SECURE` to true.
|
||||
Set `MQTT_SERVER` to the Common Name (CN) of the certificate of the broker.
|
||||
This can be the hostname or the ip of the broker.
|
||||
This can be the hostname or the IP of the broker.
|
||||
|
||||
The CA certificate should be in PEM ascii format.
|
||||
If your CA certificate is not in the correct format or you don't know the format, use `openssl` to convert the certificate to the correct format.
|
||||
|
||||
@@ -78,8 +78,8 @@ https://github.com/marcelstoer/nodemcu-pyflasher/releases
|
||||
* Click on *FlashNodeMCU*
|
||||
The upload details appears.
|
||||
|
||||
With an ESP if you did not set your network and mqtt parameters manually you can now open the [web portal configuration](portal.md).
|
||||
With an ESP if you did not set your network and MQTT parameters manually you can now open the [web portal configuration](portal.md).
|
||||
|
||||
Note that to reset the wifi and mqtt settings you can check *yes, wipes all data*
|
||||
Note that to reset the wifi and MQTT settings you can check *yes, wipes all data*
|
||||
|
||||
[](https://hits.seeyoufarm.com)
|
||||
@@ -220,7 +220,7 @@ upload_flags =
|
||||
* Upload ➡️
|
||||
* You should see the logs in the serial monitor
|
||||
|
||||
With an ESP if you did not set your network and mqtt parameters manually you can now open the [web portal configuration](portal.md).
|
||||
With an ESP if you did not set your network and MQTT parameters manually you can now open the [web portal configuration](portal.md).
|
||||
|
||||
## API
|
||||
With the V0.9 we added the support of json for receiving and publishing.
|
||||
@@ -259,7 +259,7 @@ If you want to use HASS MQTT discovery you need to have
|
||||
uncommented.
|
||||
Added to that auto discovery box should be selected into your Home Assistant MQTT integration configuration.
|
||||
|
||||
With an ESP if you did not set your network and mqtt parameters manually you can now open the [web portal configuration](portal.md).
|
||||
With an ESP if you did not set your network and MQTT parameters manually you can now open the [web portal configuration](portal.md).
|
||||
|
||||
::: warning Note
|
||||
simpleReceiving on Arduino boards doesn't accept 64 bits MQTT values, you can only send 32bits values from the MQTT broker.
|
||||
|
||||
@@ -23,9 +23,9 @@ More info on [this topic](https://community.openmqttgateway.com/t/esp32-compilat
|
||||
|
||||
→ Verify your wiring
|
||||
|
||||
→ To eliminate issues of OpenMqttGateway or you home controller try uploading basic examples from the libraries directly (like [SendDemo](https://github.com/sui77/rc-switch/tree/master/examples/SendDemo) for RF or IRSendDemo for IR) and execute them. If it doesn't work this means that you have mostly an issue related with your hardware or due to IDE/library version used.
|
||||
→ To eliminate issues of OpenMQTTGateway or you home controller try uploading basic examples from the libraries directly (like [SendDemo](https://github.com/sui77/rc-switch/tree/master/examples/SendDemo) for RF or IRSendDemo for IR) and execute them. If it doesn't work this means that you have mostly an issue related with your hardware or due to IDE/library version used.
|
||||
|
||||
Regarding the IR led emitter you can replace it with a normal led and see if it light on when you send an mqtt command
|
||||
Regarding the IR led emitter you can replace it with a normal led and see if it lights up when you send an MQTT command
|
||||
|
||||
→ If you are only unable to receive RF on nodemcu (or if it only works when a serial connection is active):
|
||||
|
||||
@@ -49,7 +49,7 @@ Exception (2):
|
||||
Most probably a network issue, don't use a guest network and if going through a firewall check its rules. To put aside gateway issue, try to connect to a local broker on the same network.
|
||||
|
||||
## You don't see the messages appearing on your broker but they appears on the serial monitor
|
||||
This is due to a too small mqtt packet size, open User_config.h and set:
|
||||
This is due to a too small MQTT packet size, open User_config.h and set:
|
||||
`#define mqtt_max_packet_size 1024`
|
||||
|
||||
## Your Arduino with w5100 Ethernet shield does not connect to network until you press Reset button
|
||||
|
||||
+4
-4
@@ -29,7 +29,7 @@ Consider the distance as a beta feature as currently we are not retrieving the e
|
||||
|
||||
Note that you can find apps to simulate beacons and do some tests like [Beacon simulator](https://play.google.com/store/apps/details?id=net.alea.beaconsimulator)
|
||||
|
||||
IOS version >=10 devices advertise without an extra app a mac address, nevertheless this address [changes randomly](https://github.com/1technophile/OpenMQTTGateway/issues/71) and cannot be used for presence detection. You must install an app to advertise a fixed MAC address.
|
||||
iOS version >=10 devices advertise without an extra app MAC address, nevertheless this address [changes randomly](https://github.com/1technophile/OpenMQTTGateway/issues/71) and cannot be used for presence detection. You must install an app to advertise a fixed MAC address.
|
||||
|
||||
|
||||
## Receiving signals from BLE devices Mi Flora, Mi jia, LYWDS02, LYWSD03MMC, ClearGrass, Mi scale and [many more](https://compatible.openmqttgateway.com/index.php/devices/ble-devices/)
|
||||
@@ -67,11 +67,11 @@ OpenMQTTGateway publish the servicedata field of your BLE devices, with HM10 thi
|
||||
:::
|
||||
|
||||
## Setting a white or black list
|
||||
A black list is a list of mac addresses that will never be published by OMG
|
||||
A black list is a list of MAC addresses that will never be published by OMG
|
||||
to set black list
|
||||
`mosquitto_pub -t home/OpenMQTTGateway/commands/MQTTtoBT/config -m '{"black-list":["01:23:14:55:16:15","4C:65:77:88:9C:79","4C:65:A6:66:3C:79"]}'`
|
||||
|
||||
A white list is a list of mac addresses permitted to be published by OMG
|
||||
A white list is a list of MAC addresses permitted to be published by OMG
|
||||
to set white list
|
||||
`mosquitto_pub -t home/OpenMQTTGateway/commands/MQTTtoBT/config -m '{"white-list":["01:23:14:55:16:15","4C:65:77:88:9C:79","4C:65:A6:66:3C:79"]}'`
|
||||
|
||||
@@ -167,7 +167,7 @@ The gateway can read and write BLE characteristics from devices and provide the
|
||||
These actions will be taken on the next BLE connection, which occurs after scanning and after the scan count is reached, [see above to set this.](#setting-the-number-of-scans-between-connection-attempts)
|
||||
This can be overridden by providing an (optional) parameter `"immediate": true` within the command. This will cause the BLE scan to stop if currently in progress, allowing the command to be immediately processed. All other connection commands in queue will also be processed for the same device, commands for other devices will be deferred until the next normally scheduled connection.
|
||||
|
||||
**Note** Some devices need to have the mac address type specified. You can find this type by checking the log/mqtt data and looking for "mac_type". By default the type is 0 but some devices use different type values. You must specify the correct type to connect successfully.
|
||||
**Note** Some devices need to have the MAC address type specified. You can find this type by checking the log/MQTT data and looking for "mac_type". By default the type is 0 but some devices use different type values. You must specify the correct type to connect successfully.
|
||||
To specify the MAC address type add the parameter `"mac_type"` to the command. For example `"mac_type": 1` to connect with a device with the MAC address type of 1.
|
||||
:::
|
||||
|
||||
|
||||
+1
-1
@@ -75,7 +75,7 @@ Extract this part of the code:
|
||||
38000,1,69,340,169,20,20,20,20,20,64,20,20,20,20,20,20,20,20,20,20,20,64,20,64,20,20,20,64,20,64,20,64,20,64,20,64,20,64,20,64,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,64,20,64,20,64,20,64,20,64,20,64,20,1544,340,85,20,3663
|
||||
```
|
||||
|
||||
and publish it to mqtt with the a subject containing IR_GC:
|
||||
and publish it to MQTT with the subject containing IR_GC:
|
||||
```
|
||||
mosquitto_pub -t home/OpenMQTTGateway/commands/MQTTtoIR -m '{"raw":"38000,1,1,171,171,21,64,21,21,21,21,21,21,21,21,21,21,21,21,21,64,21,64,21,21,21,21,21,21,21,21,21,21,21,21,21,64,21,21,21,21,21,21,21,64,21,21,21,21,21,21,21,21,21,64,21,64,21,64,21,21,21,64,21,64,21,64,21,64,21,1114","protocol_name":"GC"}'
|
||||
```
|
||||
|
||||
+1
-1
@@ -235,7 +235,7 @@ Generate your RF signals by pressing a remote button or other and you will see :
|
||||
|
||||
### Send data by MQTT to convert it on KAKU signal
|
||||
|
||||
Once you get the infos publish the parameters with mqtt like that for off:
|
||||
Once you get the infos publish the parameters with MQTT like that for off:
|
||||
|
||||
`mosquitto_pub -t home/OpenMQTTGateway/commands/MQTTtoRF2 -m "{"unit":0,"groupBit":0,"period":273,"address":8233228,"switchType":0}"`
|
||||
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@ Subscribe to all the messages with mosquitto or open your MQTT client software:
|
||||
` sudo mosquitto_sub -t +/# -v`
|
||||
|
||||
### ADC
|
||||
The value is between 0 and 1024 and is transmitted via Mqtt when it changes.
|
||||
The value is between 0 and 1024 and is transmitted via MQTT when it changes.
|
||||
`home/OpenMQTTGateway/ADCtoMQTT {"value":543}`
|
||||
|
||||
### DHT
|
||||
|
||||
Reference in new issue
Block a user