eschava / broadlink-mqtt

MQTT client to control BroadLink devices
MIT License
221 stars 60 forks source link

Adding Suport to send topic messages for all devices on network #111

Open pablolucas890 opened 1 year ago

pablolucas890 commented 1 year ago

When using the option multiple-lookup on the configuration file mqtt.conf, we have the hability to specify which broadlink to submit the message. But, if we want the old behaviour, we need to modify the configuration file everytime.

To avoid that, implement a broadcast address, which allows sending a command to all broadlinks on the network.

This allow a project to have device_type = multiple-lookup option, and send a command to a specific device, or just send to the broadcast address in case it doesn't know the address of the device (if there is only one device present) or if doesn't care to send the command to all devices on the network.

For the user to not need to write MAC Address or edit mqtt.conf if they have just one broadlink,They can send the MAC Broadcast on topic and all devices on network (sometimes the user has just one), will be activated.

If The user has more broadlinks, they just write broadlink MAC Address on topic. So they doesn't need to change mqtt.conf all times.

broadlink broadcast is "FF:FF:FF:FF:FF:FF" and in the topic it is "ff_ff_ff_ff_ff_ff".

helen-fornazier commented 1 year ago

@eschava hey, this is very useful, would you mind reviewing this? what do you think?