Homie based bridge between MQTT and RFlink module
Homie based bridge MQTT to RFLink module
Property | Message format | Direction | Description |
---|---|---|---|
HOMIE_PREFIX/node-id/serial01/to-send/set | See RFlink protocol reference | Controller → Device | |
HOMIE_PREFIX/node-id/serial01/publish-mode/set | (RAW|JSON|STANDARD) | Controller → Device | Set publishing methods |
HOMIE_PREFIX/node-id/serial01/device_name | See below JSON message format section | Device → Controller | |
HOMIE_PREFIX/node-id/$online | (true|false) | Device → Controller | /true when the device is online, false when the device is offline (through LWT) |
RFlink message: 20;1B;Keeloq;ID=e311;SWITCH=0A;CMD=ON;BAT=OK;
will be published in topic:HOMIE_PREFIX/node-id/serial01/Keeloq
with value {“msgIdx”:”12”,”ID”:”e331”,”SWITCH”:”01”,”CMD”:”ON”,”BAT”:”OK”}
RAW
Message recived from RFLink is published as is. Used in debug.
STANDARD
Message received from RFLink is converted to JSON array partialy
RFlink message: 20;1B;Keeloq;ID=e311;SWITCH=0A;CMD=ON;BAT=OK;
will be published in topic:HOMIE_PREFIX/node-id/serial01/Keeloq/e331
with value {“SWITCH”:”01”,”CMD”:”ON”,”BAT”:”OK”}
HOMIE_PREFIX/node-id/serial01/to-send/set
value: 10;Kaku;00004d;1;OFF;
HOMIE_PREFIX/node-id/serial01/to-send/set
value: 10;RFDEBUG=ON;
HOMIE_PREFIX/node-id/serial01/to-send/set
value: 10;PING;
. Response will be published in topic HOMIE_PREFIX/node-id/serial01/PONG
rflink.items
file:
Group gRFLink
String rfLinkKeeloq
"Keeloq message [%s]" (gRFLink)
{mqtt="<[mosquitto:_HOMIE_PREFIX_/_node-id_/serial01/Keeloq/1111
default]"}
keeloq.rules
file:rule keeloqUpdate
when
Item rfLinkKeeloq received update
then
var String SWITCH = transform(“JSONPATH”, “$.SWITCH”, Message)
var String CMD = transform(“JSONPATH”, “$.CMD”, Message)
var String BAT = transform(“JSONPATH”, “$.BAT”, Message)
if (SWITCH==”01” && CMD==”ON”)
{
// When button was pressed log it
logInfo(“keeloq”,”Received message from keeloq”)
}
end
* JSON format
* create <code>rflink.items</code> file:
```java
Group gRFLink
String rfLinkKeeloq
"Keeloq message [%s]" (gRFLink)
{mqtt="<[mosquitto:_HOMIE_PREFIX_/_node-id_/serial01/Keeloq:state:default]"}
keeloq.rules
file:rule keeloqUpdate
when
Item rfLinkKeeloq received update
then
var String Message = rfLinkKeeloq.state.toString
var String ID = transform(“JSONPATH”, “$.ID”, Message)
var String SWITCH = transform(“JSONPATH”, “$.SWITCH”, Message)
var String CMD = transform(“JSONPATH”, “$.CMD”, Message)
var String BAT = transform(“JSONPATH”, “$.BAT”, Message)
if (ID=="1111" && SWITCH=="01" && CMD=="ON")
{
// When button was pressed log it
logInfo("keeloq","Received message from keeloq")
}
end
```