Multiple schedules from one script / Call limitations

  • I'd like to create multiple schedules for a day for specific hours to turn electricity on and off. Logic is based on stock electricity prices with hard coded price roof to determine when to use electricity and when not. Amount of schedules for day is not predetermined as it will be determined by the prices. If all hours are too expensive like five cheapest hours are used. Script is run once per day.

    At this point I'd like to perform this logic in one script and set all schedules from there, but there is limitation for 5 calls only. Setting a schedule requires at least 2 calls, to set on and off times.

    Can you dodge this limitation somehow?

    Shelly Plus PM1

  • I was able to make a temporary solution using multiple scripts, but each script is also using schedule slots because the script needs to be triggered.

    Also, creating half a dozen scripts with almost similar settings is a bit of a maintenance issue.

  • You can implement a call queue, so just wait until 5 calls have finished before sending the next 5. In short, setting up a call queue let you bypass the call limit is quite straightforward. However, Scripts have limited memory resources and creating a large object with numerous calls can consume a significant amount of memory forcing the script to stopp automaticly, but 10-30 calls should not be a problem.

    3 Mal editiert, zuletzt von _[Deleted]_ (8. Oktober 2023 um 02:42)

  • You can implement a call queue, so just wait until 5 calls have finished before sending the next 5. In short, setting up a call queue let you bypass the call limit is quite straightforward. However, Scripts have limited memory resources and creating a large object with numerous calls can consume a significant amount of memory forcing the script to stopp automaticly, but 10-30 calls should not be a problem.

    Needed to test it a bit to fully understand that you need to give different time intervals for each timer, as script won't stack them on top of others. Instead it executes the setting of timer at first (if set one after other in the script) and then executes the timer script based after timer value has exceeded (like a delay).


    Thanks for advice, seems to work!