Skip to content

Conversation

peterg79
Copy link

@peterg79 peterg79 commented Apr 13, 2025

Description:

Following up on #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:

  • The pull request is done against the latest development branch
  • Only one feature/fix was added per PR and the code change compiles without warnings
  • I accept the DCO.

@1technophile
Copy link
Owner

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.

@peterg79
Copy link
Author

peterg79 commented Sep 3, 2025

Thanks for the feedback! I'll do the change accordingly.

@peterg79 peterg79 changed the title add 1 hour expiry to measurement sensors Make measurement sensor expiry configurable Sep 6, 2025
@peterg79
Copy link
Author

peterg79 commented Sep 7, 2025

Change complete and verified, please review.

"</select></p><br><button name='save' type='submit' class='button bgrn'>Save</button></form></fieldset>" body_footer_config_menu;

const char config_webui_body[] = body_header "<fieldset class=\"set1\"><legend><span><b>Configure WebUI</b></span></legend><form method='get' action='wu'><p><b>Display Metric</b><br><input id='dm' type='checkbox' %s></p><p><b>Secure WebUI</b><br><input id='sw' type='checkbox' %s></p><br><button name='save' type='submit' class='button bgrn'>Save</button></form></fieldset>" body_footer_config_menu;
const char config_webui_body[] = body_header "<fieldset class=\"set1\"><legend><span><b>Configure WebUI</b></span></legend><form method='get' action='wu'><p><b>Display Metric</b><br><input id='dm' type='checkbox' %s></p><p><b>Secure WebUI</b><br><input id='sw' type='checkbox' %s></p><p><b>Expire After</b><br><input id='ea' name='ea' placeholder=" EXPIRE_AFTER " value='%u'></p><br><button name='save' type='submit' class='button bgrn'>Save</button></form></fieldset>" body_footer_config_menu;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add the unit used after "Expire After" like "Expire After (s)"

@1technophile
Copy link
Owner

Thanks, could you add an explanation in the docs please:
https://docs.openmqttgateway.com/integrate/home_assistant.html#auto-discovery

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants