QUIRKY

post

Setting Up Nimbus from Quirky

I love little gadgets - I got the nimbus from quirky, but of course the standard functionality is not satisfactory for me, so I had to adjust it so that I can view number of my emails (which was already an option), number of support tickets, number of triggered spam reports, and number of triggered errors. Does it really matter what I wanted? Not really. What matters is I got it to work. So to begin with I downloaded Ian Maddox's wink classes, which semi work out of the box. I was having a lot of problems with setting degrees on the gauges though - so I adjusted the save() function in nimbusDial.php file - feel free to download my version for comparison. Once you've got everything extracted, you just need to populate the config.json with your oAuth information (clientID, clientSecret, username and password), and boom - it works. Below is my set.php file prior to edition with hardcoded test numbers - I hope this helps

<?
    include('src/wink.php');
    include('src/device.php');
    include('src/devices/nimbus.php');
    include('src/devices/nimbusDial.php');
    
    use ianmaddox\wink\wink;
    
    $wink = new wink();
    $conf = json_decode(file_get_contents('config.json'));
    $wink->authPassword($conf->clientID, $conf->clientSecret, $conf->username, $conf->password);
    $nimbus = $wink->getDevice(wink::DEVICE_NIMBUS);
    
    //LOAD DIAL
    $dial0 = $nimbus->getDial(0);
    $dial1 = $nimbus->getDial(1);
    $dial2 = $nimbus->getDial(2);
    $dial3 = $nimbus->getDial(3);
    
    //DON'T AUTO SAVE
    $dial0->setAutoSave(false);
    $dial1->setAutoSave(false);
    $dial2->setAutoSave(false);
    $dial3->setAutoSave(false);
    
    //SET DIALS
    $dial0->setText('11 MAIL',"Emails");
    $dial1->setText('22 TIX',"Tickets"); 
    $dial2->setText('33 SPAM',"Spammers");
    $dial3->setText('44 ERR',"Errors");
    
    //SAVE DIALS
    $dial0->save();
    $dial1->save();
    $dial2->save();
    $dial3->save();

?>