Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Zigbee - Retain flag #7835

Closed
snakuzzo opened this issue Mar 1, 2020 · 5 comments · Fixed by #7854
Closed

Zigbee - Retain flag #7835

snakuzzo opened this issue Mar 1, 2020 · 5 comments · Fixed by #7854
Labels
feature request (devs?) Action - awaiting response from developers

Comments

@snakuzzo
Copy link

snakuzzo commented Mar 1, 2020

Have you looked for this feature in other issues and in the docs?
Yes

Is your feature request related to a problem? Please describe.
No problem...but I need to have some sensors values retained or I lose states after hub restarts

Describe the solution you'd like
A command to set retain for specific devices
eg. ZigbeeSensorRetain with the list of short addresses (separated by a comma) enabled to retain

Describe alternatives you've considered
Enable retain for all Zigbee messages

Additional context
Add any other context or screenshots about the feature request here.

(Please, remember to close the issue when the problem has been addressed)

@stefanbode
Copy link
Contributor

Have you checked to use rules for this use-case. Var1 to 4 are persistent and might help you with your problem during reboot. Or you create a rule and send the vaulte as a retained mqtt message. Also an idea. Where exactly you want the value to survive?

@s-hadinger
Copy link
Collaborator

I can add a retain flag to the ZbReceived message, but since they are all on the same topic, I'm afraid the last one will override all previous. Would this require specific topics per device?

@snakuzzo
Copy link
Author

snakuzzo commented Mar 1, 2020

For now I found a solution using RULES (just posted few minutes ago on Discord>general) as also suggested by @stefanbode.
I think the retain flag should be enabled for specific device. If you add it to ZbReceived message all messages of every device will published with retain flag.
The best solution should be to have specific topic per device...but you answered my some weeks ago in another issue that unique topic was a community decision.

Shold be great to change SENSOR messages from...

tele/%topic%/SENSOR

...to something like this...

tele/%short_addr%/SENSOR

@s-hadinger
Copy link
Collaborator

Unless it's easy to republish to a device specific topic via rules, we can also add a SetOption to insert the short_addr in the topic specifically for retained messages. The JSON format will remain the same though. That's the community decision on the JSON message format.

@snakuzzo
Copy link
Author

snakuzzo commented Mar 1, 2020

Can you post an example?
Now we are talking about 2 different things.
Retain and Topic per device...

Topic per device always helps to not implement checks on the hub on single entity.
About the retain, if there is a way to do a new publish retreiving same topic and same payload from trigger...I think this is the best solution and...no development required

@ascillato2 ascillato2 added the feature request (devs?) Action - awaiting response from developers label Mar 3, 2020
s-hadinger pushed a commit to s-hadinger/Tasmota that referenced this issue Mar 4, 2020
arendst added a commit that referenced this issue Mar 4, 2020
Add Zigbee use distinct MQTT topics per device for SENSOR, allowing retained messages (#7835)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request (devs?) Action - awaiting response from developers
Projects
None yet
4 participants