Activate / Inactivate schedules via API?

Moderator: Telldus

Post Reply
Nautilus
Posts: 80
Joined: Fri Mar 17, 2023 9:45 am

Activate / Inactivate schedules via API?

Post by Nautilus »

Hi,

I'd appreciate any hints you might have on how to proceed to be able to automate the activation / inactivation of Telldus Live schedules. Yes, there is the API but any ready made examples on how to use it for this purpose? Yes, there is the /scheduler/setJob that I assume would allow to do this but I'm a bit lost on where to start...:) I've been able to successfully use the provided python and php examples but they do not include this (I think).
Nautilus
Posts: 80
Joined: Fri Mar 17, 2023 9:45 am

Re: Activate / Inactivate schedules via API?

Post by Nautilus »

I think I'll be able to do what I wanted with this: https://github.com/Zn4rK/telldus-live/ Check it out, a nice PHP-api for Telldus Live and seems a lot more responsive than the provided python api example which has some lag in executing the commands.
Nautilus
Posts: 80
Joined: Fri Mar 17, 2023 9:45 am

Re: Activate / Inactivate schedules via API?

Post by Nautilus »

And here's roughly how to enable (1) or disable (0) a certain schedule:

Code: Select all

<?php
require 'vendor/autoload.php';

$api = new Paxx\Telldus\Api(array(
    'identifier'      => 'xxxxx',
    'secret'          => 'yyyyy',
    'user_identifier' => 'zzzzz',
    'user_secret'     => 'kkkkk'
));

$scheduler = $api->scheduler();
$action = $scheduler->setJob('111111','222222',array('active' => '0'));
First of course install the package (I needed to use "composer require paxx/telldus-live=dev-master" - after first installing composer and new enough version of PHP). With the above script one would disable schedule id (jobID) 111111 controlling device 222222 (not sure why this is needed as schedules are in any case tied to certain device or group). Change the third argument to 1 and you'd enable it...
Post Reply