I'm working on a device plugin that has both standard Values and CustomTasks. During the Interval timer both Values and CustomTask events are processed/sent as expected. However, some users only want the Values sent during the initial trigger, but not at the timer interval. Instead, only the CustomTasks would be processed at the interval.
I searched existing device plugins for an example but it appears this is a unique requirement. Is it possible to do this in the plugin without any changes to other ESPeasy modules?
- Thomas
Advice needed: Prevent Sending Event Values at Interval Time
Moderators: grovkillen, Stuntteam, TD-er
- grovkillen
- Core team member
- Posts: 3621
- Joined: 19 Jan 2017, 12:56
- Location: Hudiksvall, Sweden
- Contact:
Re: Advice needed: Prevent Sending Event Values at Interval Time
I'd say they should use rules for that.
ESP Easy Flasher [flash tool and wifi setup at flash time]
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you
Re: Advice needed: Prevent Sending Event Values at Interval Time
Yep, do not connect a controller to that plugin, but use the rules to fetch the values and send them when needed.
Re: Advice needed: Prevent Sending Event Values at Interval Time
Thanks for the advice. I prefer using rules too, which is how I handle it. But suggesting this has not been received with much love.
I believe I have a solution for the customized plugin. Just waiting for user feedback.
I've added a test in PLUGIN_READ that checks the UserVar values. If they have not changed then they are ignored and not sent during the timer interval. Fingers are crossed that the feedback is overflowing with love.
- Thomas
I believe I have a solution for the customized plugin. Just waiting for user feedback.
I've added a test in PLUGIN_READ that checks the UserVar values. If they have not changed then they are ignored and not sent during the timer interval. Fingers are crossed that the feedback is overflowing with love.
- Thomas
Re: Advice needed: Prevent Sending Event Values at Interval Time
I just finished (Pull request is ready) moving the sensor timers to the new scheduler.
This allows a plugin to set its own schedule if you like.
By default the set delay is being used, but you could set a new one from within the plugin code itself.
This allows to set the delay to some near infinite value ("0") and the plugin may set a new value to make the scheduler handle the "PLUGIN_READ" as soon as there is something changed.
Just call
"runAt" can be set to "millis()" or maybe "millis() + 10" to allow for some delay of 10 msec from now.
Task_index is set in the event and it represent the task (plugin) number in the list (note offset of 1)
This allows plugins to react much more responsive.
It also means the real work has to be done in the calls to 50/sec and 10/sec calls (or 1/sec).
And please do as little as absolutely needed in those time-critical calls, to help not to block the system.
This allows a plugin to set its own schedule if you like.
By default the set delay is being used, but you could set a new one from within the plugin code itself.
This allows to set the delay to some near infinite value ("0") and the plugin may set a new value to make the scheduler handle the "PLUGIN_READ" as soon as there is something changed.
Just call
Code: Select all
schedule_task_device_timer(task_index, runAt);
Task_index is set in the event and it represent the task (plugin) number in the list (note offset of 1)
This allows plugins to react much more responsive.
It also means the real work has to be done in the calls to 50/sec and 10/sec calls (or 1/sec).
And please do as little as absolutely needed in those time-critical calls, to help not to block the system.
Re: Advice needed: Prevent Sending Event Values at Interval Time
@TD-er:
Brilliant. Thank you for the new functionality.
- Thomas
Brilliant. Thank you for the new functionality.
- Thomas
Re: Advice needed: Prevent Sending Event Values at Interval Time
As far as i have seen, this functionality now needs "TimerOption = true" to work. (which i want to avoid)
Is there another way to get "PLUGIN_READ" triggered from inside a plugin?
Is there another way to get "PLUGIN_READ" triggered from inside a plugin?
Who is online
Users browsing this forum: No registered users and 25 guests