Tasmota: Add optional retain flag to Publish command

Created on 29 May 2018  路  7Comments  路  Source: arendst/Tasmota

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.

enhancement

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.

All 7 comments

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:

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Joeyhza picture Joeyhza  路  3Comments

luisfpinto picture luisfpinto  路  3Comments

TylerDurden23 picture TylerDurden23  路  3Comments

smadds picture smadds  路  3Comments

ximonline picture ximonline  路  3Comments