Make measurement sensor expiry configurable
Description:
Following up on https://github.com/1technophile/OpenMQTTGateway/issues/2121, I'd like to introduce a configurable expiration for measurement sensors. Default is 0 which means no expiry, to keep it backward compatible.
Checklist:
- [X] The pull request is done against the latest development branch
- [X] Only one feature/fix was added per PR and the code change compiles without warnings
- [X] I accept the DCO.
Thanks for the PR.
I'm worried that we have sensors that publish sporadically for which this settings may not be relevant. I still think it is interesting for most of the sensors but for those who are not regular publishers we should propose a bypass rather than alerting HA of something being wrong but is not wrong. Maybe we could have a setting in the WebUI to configure this expire after function, it could be configured in minutes, if the user set it to 0 we don't send an expire_after during discovery.
Thanks for the feedback! I'll do the change accordingly.
Change complete and verified, please review.
Thanks, could you add an explanation in the docs please: https://docs.openmqttgateway.com/integrate/home_assistant.html#auto-discovery