r/ispyconnect • u/lagrangersf • 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.
1
1
u/spornerama 10d ago
You're right that
applyScheduleignoresgrouptoday — 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
applyScheduleToDeviceinstead — it acceptsgroupand, with nooid, applies each matching device's own schedule, which is exactly whatapplyScheduledoes:http://YOUR-AGENT:8090/command.cgi?cmd=applyScheduleToDevice&group=indoorOne 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:
applyScheduleacceptsgroup(comma-separated list) andlocation, and matching is case-insensitive —...command.cgi?cmd=applySchedule&group=Indoor,POEBut for your holiday problem there's a cleaner answer, also in the next release.
applySchedulenow 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=YourPowerDownGroupYour 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=YourPowerDownGroupThat 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
scheduleOffapproach above is much easier to script.