<?php
    require 'TuyaCloud.php';

    $tuya = new TuyaCloud([
        "userName" => "pkuba04@wp.pl", // username/email to access to SmartLife/Tuya app
        "password" => "#Hyzne967", // password to access to SmartLife/Tuya app
        "bizType" => "smart_life", // type ('tuya' or 'smart_life')
        "countryCode" => "1", // Country code (International dialing number), e.g. "33" for France or "1" for USA
        "region" => "eu" // region (az=Americas, ay=Asia, eu=Europe)
    ]);

    // Ustawienie strefy czasowej na "Europe/Warsaw"
    date_default_timezone_set('Europe/Warsaw');
    if ((time() - filemtime('last_action.txt')) > 60){
        $tuya->setState([
            "id" => "bf7f7eff761e1a784fb1fc",
            "value" => "off"
        ]);
    }
    //file_put_contents('last_action.txt', time()+30);

?>
