MQTT module can be used for sending data from one Pimatic to the second or more Pimatics.
On both Pimatic they are necessary to install the module MQTT and On one of Pimatics must be installed MQTT broker (e.g. Mosquitto). But you can use, of course, entirely different broker. In the example Broker is installed into Pimatic A
IP for Pimatic A: 192.168.0.1
IP for Pimatic B: 192.168.0.2
Edit config.json in Pimatic A
to modules section add:
{
"plugin": "mqtt"
}
add the rule to rules section:
{
"id": "test-data-sending",
"name": "test-data-sending",
"rule": "if every 15 seconds then publish mqtt message \"$wemosd1r2.dht-11-humidity\" on topic \"pimaticA/dht11/humidity\"",
"active": true,
"logging": true
}
restart Pimatic A
Edit config.json in Pimatic B
to modules section add:
{
"plugin": "mqtt",
"host": "192.168.0.1",
"port": 1883
}
add device to device section
{
"name": "Data from Pimatic A",
"id": "data-from-pimatic-a",
"class": "MqttSensor",
"attributes": [
{
"name": "dht-11-humidity",
"topic": "pimaticA/dht11/humidity",
"type": "number",
"unit": "%",
"acronym": "Humidity"
}
]
}
restart Pimatic B
Other examples
Pimatic A:
{
"id": "frost-alarm",
"name": "frost alarm",
"rule": "if every 1 minute and ds-temperature of wemosd1r2 <= 0 °C then publish mqtt message \"1\" on topic \"pimaticA/frostalarm/state\"",
"active": true,
"logging": true
},
{
"id": "no-frost",
"name": "no frost",
"rule": "if every 1 minute and ds-temperature of wemosd1r2 > 0 °C then publish mqtt message \"0\" on topic \"pimaticA/frostalarm/state\"",
"active": true,
"logging": true
}
Pimatic B:
{
"name": "Sensor with lookup",
"id": "sensor-with-lookup",
"class": "MqttSensor",
"attributes": [
{
"name": "state",
"topic": "pimaticA/frostalarm/state",
"type": "string",
"unit": "",
"acronym": "",
"messageMap": {
"0": "It is above zero",
"1": "it's freezing cold"
}
}
]
}
I work on function, which will send all the variables on the broker. Thus, drops in most cases need to use rules.