Si je fais :
Code : Tout sélectionner
if devicechanged(PIR)=‘On’ then
switchOnFor(‘lumiere, 10’)
endUn simple switchOn suffit?
Code : Tout sélectionner
if devicechanged(PIR)=‘On’ then
switchOnFor(‘lumiere, 10’)
endCode : Tout sélectionner
--time.hour ou time.min ou time.sec
--ex : if (time.hour == 17 and time.min == 05) then
time = os.date("*t")Code : Tout sélectionner
if heure == '17:05' thenCode : Tout sélectionner
heure < '17:30' and heure > '19:55' thenCode : Tout sélectionner
function jsonInfos(device)
local rid = assert(io.popen(curl..'-u '..domoticzUSER..':'..domoticzPSWD..' "'..domoticzURL..'/json.htm?type=devices&rid='..otherdevices_idx[device]..'"'))
local list = rid:read('*all')
rid:close()
return json:decode(list).result[1]
end
Code : Tout sélectionner
local function getDevicesSchedule()
print('top1')
local rid = assert(io.popen(curl..'-u '..domoticzUSER..':'..domoticzPSWD..' "'..domoticzURL..'/json.htm?type=schedules&filter=device"'))
print('top2')
local list = rid:read('*all')
print('top3')
rid:close()
print('top4')
return json:decode(list).result
end
pour info la fonction est appelée dans un script device avec cette commande "print(table_show(getDevicesSchedule()))"2017-12-11 22:46:54.222 dzVents: Planning selector:Planning Eco-Confort
2017-12-11 22:46:54.222 dzVents: top1
2017-12-11 22:46:54.225 dzVents: top2
2017-12-11 22:47:04.206 Error: EventSystem: Warning!, lua script sc_planning has been running for more than 10 seconds
2017-12-11 22:47:04.207 (Chauffage_RDC_Devices) Light/Switch (Planning Eco-Confort)
2017-12-11 22:47:04.226 dzVents: top3
2017-12-11 22:47:04.226 dzVents: top4
2017-12-11 22:47:04.232 dzVents: table = {
[1] = {
["IsThermostat"] = "false";
["TimerID"] = 2;
["TimerTypeStr"] = "On Time";
["DevName"] = "Mode_Chauffage_RDC";
["Days"] = 128;
["TimerCmd"] = 0;
["Occurence"] = 0;
["Month"] = 0;
["Level"] = 30;
["Type"] = "Device";
["ScheduleDate"] = "2017-12-12 07:00:00";
["TimerType"] = 2;
["MDay"] = 0;
["Time"] = "07:00";
["Active"] = "true";
["DeviceRowID"] = 10;
["Hue"] = 0;
["Randomness"] = "false";
["Date"] = "";
};
[2] = {
["IsThermostat"] = "false";
["TimerID"] = 1;
["TimerTypeStr"] = "On Time";
["DevName"] = "Mode_Chauffage_RDC";
["Days"] = 128;
["TimerCmd"] = 0;
["Occurence"] = 0;
["Month"] = 0;
["Level"] = 20;
["Type"] = "Device";
["ScheduleDate"] = "2017-12-11 23:30:00";
["TimerType"] = 2;
["MDay"] = 0;
["Time"] = "23:30";
["Active"] = "true";
["DeviceRowID"] = 10;
["Hue"] = 0;
["Randomness"] = "false";
["Date"] = "";
};
};
Avez vous déja eu ce genre de probleme? Savez vous comment le résoudre?2017-12-11 22:59:49.567 User: Admin initiated a switch command (13/Planning Eco-Confort/Set Level)
2017-12-11 22:59:49.721 dzVents: table = {
["Planning Eco-Confort"] = "De Matin";
};
2017-12-11 22:59:49.721 dzVents: Planning selector:Planning Eco-Confort
2017-12-11 22:59:59.704 Error: EventSystem: Warning!, lua script sc_planning has been running for more than 10 seconds
2017-12-11 22:59:59.706 (Chauffage_RDC_Devices) Light/Switch (Planning Eco-Confort)
2017-12-11 22:59:59.728 dzVents: table = {
["Unit"] = 1;
["LevelOffHidden"] = true;
["Data"] = "Set Level: 20 %";
["Image"] = "ComputerPC";
["HardwareName"] = "Chauffage_RDC_Devices";
["Notifications"] = "false";
["LastUpdate"] = "2017-12-11 22:59:49";
["idx"] = "13";
["BatteryLevel"] = 255;
["HaveTimeout"] = false;
["Description"] = "";
["TypeImg"] = "Light";
["Name"] = "Planning Eco-Confort";
["MaxDimLevel"] = 100;
["SelectorStyle"] = 0;
["SignalLevel"] = "-";
["Level"] = 20;
["StrParam2"] = "";
["AddjMulti2"] = 1;
["HardwareTypeVal"] = 15;
["LevelInt"] = 20;
["HaveGroupCmd"] = true;
["AddjMulti"] = 1;
["LevelActions"] = "||||";
["XOffset"] = "0";
["HardwareType"] = "Dummy (Does nothing, use for virtual switches only)";
["SwitchType"] = "Selector";
["YOffset"] = "0";
["HardwareID"] = 5;
["Used"] = 1;
["Type"] = "Light/Switch";
["SubType"] = "Selector Switch";
["PlanID"] = "0";
["Timers"] = "false";
["IsSubDevice"] = false;
["SwitchTypeVal"] = 18;
["CustomImage"] = 17;
["StrParam1"] = "";
["Status"] = "Set Level: 20 %";
["Favorite"] = 1;
["ShowNotifications"] = true;
["Protected"] = false;
["AddjValue2"] = 0;
["ID"] = "0001405D";
["HaveDimmer"] = true;
["AddjValue"] = 0;
["PlanIDs"] = {
[1] = 0;
};
["UsedByCamera"] = false;
["LevelNames"] = "Off|Repos|De Matin|D'Aprem|Horaire Bureau";
};