PK
ฌ:๐ฟ๚ ๚ scripts/Alexa.jsvar Alexa = IR.GetDevice("Amazon Alexa Network");
var HDL = IR.GetDevice("HDL-BUS Pro Network (UDP)");
IR.AddListener(IR.EVENT_START,0,function() {
Alexa.SetFeedback("Thermostat:TemperatureMode", IR.SUB_DEVICE_STATE_CLIMATE_TEMP_MODE_COOLING);
Alexa.SetFeedback("Thermostat:HeatTargetTemperature", 30);
Alexa.SetFeedback("Thermostat:CoolTargetTemperature", 28);
Alexa.SetFeedback("Thermostat:SensorTemperature", 24);
IR.AddListener(IR.EVENT_TAG_CHANGE, Alexa, function(name, value) {
switch (name) {
case "Office:Power":
if (value == 1)
{
value = 100;
}
HDL.Set("B50:Channel 5", value);
HDL.Set("B50:Channel 3", value);
case "Corridor:Power":
if (value == 1)
{
value = 100;
}
HDL.Set("B50:Channel 8", value);
case "Conference room:Power":
if (value == 1)
{
value = 100;
}
HDL.Set("B61:Channel 09", value);
HDL.Set("B61:Channel 10", value);
HDL.Set("B61:Channel 11", value);
case "Meeting Room:Power":
if (value == 1)
{
value = 100;
}
HDL.Set("B61:Channel 09", value);
HDL.Set("B61:Channel 10", value);
HDL.Set("B61:Channel 11", value);
break;
case "room ac:Level":
HDL.Set("DLP Panel AC-198:DockStation", value);
break;
case "Dimmer:Power":
HDL.Set("HDL-BUS Pro:Dimmer_ON", value);
break;
case "Dimmer:Level":
HDL.Set("HDL-BUS Pro:Dimmer_Brightness", value);
break;
}
IR.Log("ALEXA! Device tag: " + name + " , value: " + value);
});
});PK
๏*#ฮ ฮ scripts/Schedule.jsvar schedule = IR.GetScheduler("Schedule 1");
// creating a string with schedule data
var EventChanger = function() {
var EventBuff = [];
var Event = function(in_Name, in_Start, in_Finish) {
this.Name = in_Name; // event name
this.Start = in_Start; // event start date-time
this.Finish = in_Finish // event finish date-time
}
// writing schedule data in virtual tag
this.Write = function(in_events) {
EventBuff = [];
for(i in in_events) {
var NEvent = new Event(in_events[i].Name, in_events[i].Start, in_events[i].End);
NEvent.Enabled = in_events[i].Enabled;
EventBuff.push(NEvent);
}
var string = JSON.Stringify(EventBuff);
IR.SetVariable("Server.Tags.EventData_from_server", string);
}
// reading schedule data in virtual tag
this.Read = function(in_schedule, in_NewData) {
EventEdit = in_schedule.GetEvent(in_NewData[1]);
EventEdit.Start = Math.floor(new Date(in_NewData[0]) / 1000);
EventEdit.End = Math.floor(new Date(in_NewData[2]) / 1000);
EventEdit.Enabled = (in_NewData[3] == 1);
EventEdit.Done(); // event update
}
}
var EventsObj = new EventChanger();
// getting schedule data at server start
IR.AddListener(IR.EVENT_START,0,function() {
schedule = IR.GetScheduler("Schedule 1");
events = schedule.GetEvents();
EventsObj.Write(events);
});
// getting new data from panel
IR.SetGlobalListener(IR.EVENT_GLOBAL_TAG_CHANGE, function(in_sName, in_sValue) {
var newData = in_sValue.split(',');
EventsObj.Read(schedule, newData);
events = schedule.GetEvents();
EventsObj.Write(events);
});
// subscribing for tag changes
IR.SubscribeTagChange("Server.Channels.EventData_to_server");
PK
ำ฿Gาพ าพ Project.irp
PK
ผ
Config.xml
PK
ฌ:๐ฟ๚ ๚ scripts/Alexa.jsPK
๏*#ฮ ฮ ( scripts/Schedule.jsPK
ำ฿Gาพ าพ ' Project.irpPK
ผ
"อ Config.xmlPK ๐ cา