This is related to #2851
If a rule is used to determine a state (in said example the dimmer state), it would be nice if optionally a retained MQTT message instead of a normal message could be published. This would avoid using an automation hub solely for that purpose. As I don't think a second parameter is feasible in the tasmota command architecture, maybe an approach is to implement a PUBLISHRETAIN command.
Thank you for considering.
Hi,
On the file _user_config.h_ you can set at line 89:
#define MQTT_BUTTON_RETAIN 0 // [ButtonRetain] Button may send retain flag (0 = off, 1 = on)
#define MQTT_POWER_RETAIN 0 // [PowerRetain] Power status message may send retain flag (0 = off, 1 = on)
#define MQTT_SWITCH_RETAIN 0 // [SwitchRetain] Switch may send retain flag (0 = off, 1 = on)
#define MQTT_TELE_RETAIN 0 // Tele messages may send retain flag (0 = off, 1 = on)
And also you can set by commands on the console:
PowerRetain 1
ButtonRetain 1
SwitchRetain 1
I know, and it can even be set with Options (ie for POWER), but that is not what I meant. I meant when using the Publish command in a rule. I would rather not use privately compiled versions anyway, but that is an other matter.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
I also would like to see the ability to publish retained messages when using rules.
@yoh-there
PR #3593 with command PUBLISH2 for sending retained MQTT messages
Thank you, great job
Sorry for the delay. Thanks for the patience :+1:
Most helpful comment
I know, and it can even be set with Options (ie for POWER), but that is not what I meant. I meant when using the Publish command in a rule. I would rather not use privately compiled versions anyway, but that is an other matter.