1technophile / OpenMQTTGateway

MQTT gateway for ESP8266 or ESP32 with bidirectional 433mhz/315mhz/868mhz, Infrared communications, BLE, Bluetooth, beacons detection, mi flora, mi jia, LYWSD02, LYWSD03MMC, Mi Scale, TPMS, BBQ thermometer compatibility & LoRa.
https://docs.openmqttgateway.com
GNU General Public License v3.0
3.51k stars 776 forks source link

Gateways should have unique-name paths as well for sending commands #160

Closed posicat closed 6 years ago

posicat commented 6 years ago

I have 2 gateways, creatively named OMG_001 and OMG_002, but when I send an IR broadcast command I send it to home/commands/IR_GC which both modules receive. That's fine, but it would be great to have a way to send directly to a specific device like /home/OMG_001/commands/IR_GC to send the message to just one of the devices. This would help in the case where a household has 2 of the same brand TV or receiver.

posicat commented 6 years ago

Just a quick note, it occurred to me that you don't need the global-address since MQTT handles that nicely. if all the devices have their names in the path /home/OMG_001/commands/IR_GC you can address all of them as : /home/+/commands/IR_GC. That might save a tiny bit of ram not having to register both formats.

Once I get a bit more familiar with the code layout I want to jump in and help code some things as well. Right now just getting my one module working with my home system.

broekema commented 6 years ago

This really needs to be propagated through the entire code. I've done this in my private repository by replacing the home/ occurrences in the code with something like this:

#define TEMPBMEC MQTT_ROOT Gateway_Name "/bme/tempc" #define TEMPBMEF MQTT_ROOT Gateway_Name "/bme/tempf" #define HUMBME MQTT_ROOT Gateway_Name "/bme/hum" #define PRESSBME MQTT_ROOT Gateway_Name "/bme/pa" #define ALTIBMEM MQTT_ROOT Gateway_Name "/bme/altim" #define ALTIBMEFT MQTT_ROOT Gateway_Name "/bme/altift"