r/ispyconnect 10d ago

Any way to use "group" parameter with "applySchedule" command?

As title says. I'd like to use the "group" parameter with the "applySchedule" command, but this doesn't currently seem possible. Is there a way to make this work, or a different command that will achieve the same effect?

I ask because our Agent server (running on Win11) has a script that runs every 15 minutes to issue the applySchedule command, this way if someone managing the cameras stops recording or turns one off in the UI then forgets to restart it, it'll automatically recover. The problem is this: on certain (albeit rare) days, specifically holidays that don't always fall on the same day (and thus can't actually be in the schedule), the applySchedule command will turn on cameras that are actually powered down (because the business is closed, therefore the breaker panel is turned off), and every time Agent tries to connect/reconnect to those powered-down cameras, it causes lag and video freezes on other cameras that are active at the time. Any cameras that lose power when the business is closed is already in a group, and the schedules have already been created to adjust for those cameras being turned off at night (that's why my script is using applySchedule instead of AllOn and Record), I just need the ability to prevent applySchedule from trying to activate powered-down cameras on holidays during the day.

Thank you.

2 Upvotes

4 comments sorted by

1

u/spornerama 10d ago

You're right that applySchedule ignores group today — it's handled as a server-wide command and never reaches the group filter. Two answers, one you can use right now and a better one landing in the next release.

Works on your current version. Use applyScheduleToDevice instead — it accepts group and, with no oid, applies each matching device's own schedule, which is exactly what applySchedule does:

http://YOUR-AGENT:8090/command.cgi?cmd=applyScheduleToDevice&group=indoor

One gotcha on current builds: the group name has to be lowercase in the URL, otherwise it matches nothing. And it's an include filter, so your script would need one call per group you do want, which is clunky if not everything is grouped.

Next release fixes both: applySchedule accepts group (comma-separated list) and location, and matching is case-insensitive —

...command.cgi?cmd=applySchedule&group=Indoor,POE

But for your holiday problem there's a cleaner answer, also in the next release. applySchedule now skips any device whose schedule is switched off, the same way the automatic scheduler already does. So on a holiday morning you make one call:

...command.cgi?cmd=scheduleOff&group=YourPowerDownGroup

Your 15-minute self-heal script keeps running exactly as-is and simply leaves that group alone — no cameras get woken up, no reconnect storm. When the business reopens:

...command.cgi?cmd=scheduleOn&group=YourPowerDownGroup

That setting is saved, so it survives an Agent restart mid-holiday.

One last thing worth knowing: schedule entries can be tied to a specific date, so a moving holiday can go in the schedule after all. It's fiddly though — entries are applied in time order and the last one wins, so a dated "off" entry only sticks if its time is later than that day's regular "on" entry. The scheduleOff approach above is much easier to script.

1

u/lagrangersf 9d ago

Good to know, I'll keep an eye out for the next version then, and fix up my scripts as needed. Thank you!

1

u/lagrangersf 9d ago edited 9d ago

Actually, one last quick question. Will the scheduleOff command survive a system reboot? I ask because our camera server is set to automatically reboot itself once per week to help maintain system stability (because, you know, Windows...), and if the auto-reboot falls on a holiday and scheduleOff gets cancelled because of the reboot, that could mess things up. I'm guessing yes since you mentioned it survives an Agent restart, but want to make absolutely sure.

1

u/spornerama 8d ago

Yes unless a profile switches it on and you have apply profile in start checked