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

FR: Adjust Publish Rate for MQTT #23

Open
politekcmo opened this issue Dec 20, 2019 · 3 comments
Open

FR: Adjust Publish Rate for MQTT #23

politekcmo opened this issue Dec 20, 2019 · 3 comments
Labels
enhancement New feature or request

Comments

@politekcmo
Copy link

It would be fantastic if there was a way to adjust how frequently the ESP publishes to MQTT from the device itself. It's quite fast right now, and that is definitely desirable but I would love to adjust it down for applications that have less bandwidth available.

@politekcmo
Copy link
Author

In my testing this works right, but I believe this is a solid way to allow for a customizable delay. Would you mind looking it over? https://github.com/politekcmo/Split-Single-Phase-Energy-Meter

@CircuitSetup
Copy link
Owner

Adding an actual delay would block other functions from running. A better way to do it would be to compare a publish delay (or publish every x seconds) against millis.

Also, the MQTT library has been changed in the latest version to add one that uses async (so it doesn't block other things from running).

@CircuitSetup CircuitSetup added the enhancement New feature or request label Sep 30, 2020
@nightshade00013
Copy link

If you are using ESPhome it's simple to include this near the top of the YAML in the substitutions section

update_time: 10s

Then add the following for each sensor under each "- platform:" section
update_interval: ${update_time}

Then all you have to do is change the reporting time to how often you want it to happen. Shouldn't matter if you are using MQTT or the HomeAssistant/ESPhome API's You can also hard set the "update_interval:" on each section individually and disregard the "update_time" setting altogether.

https://github.com/nightshade00013/ESPHome_EnergyMonitor/blob/master/NightShade4chan32.yaml

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants