sms contains controller id

This commit is contained in:
Senad Uka
2016-12-30 17:22:51 +01:00
parent db8def7235
commit 7906e5a1a0

View File

@@ -265,18 +265,18 @@ function soundTheAlarm(controller_id, tooCold, tooHot, boxSilent, phoneSilent) {
});
if (needsToSendSms) {
sendAlarmingSms(reason, state.config.smsNumbers)
sendAlarmingSms(controller_id,reason, state.config.smsNumbers)
}
}
function sendAlarmingSms(reason, numbers) {
function sendAlarmingSms(controller_id,reason, numbers) {
for (var i in numbers) {
var number = numbers[i];
twilio = Twilio('AC10d7ed0bf54c1be4b1cd7133130e63f4', 'e133d3f02a69b79e93ad9ca1d73517d1');
twilio.sendSms({
to: number, // Any number Twilio can deliver to
from: '+447481345235', // A number you bought from Twilio and can use for outbound communication
body: 'Zoblak alarm! Pokrenite aplikaciju! HITNO! http://agrar.zoblak.com' // body of the SMS message
body: 'Zoblak alarm! Pokrenite aplikaciju! HITNO! http://agrar.zoblak.com/alarm?controller_id=' + controller_id // body of the SMS message
}, function(err, responseData) { //this function is executed when a response is received from Twilio
if (!err) { // "err" is an error received during the request, if any
// "responseData" is a JavaScript object containing data received from Twilio.