Hoggle wrote:Hi,
did you solve your problem?
Hoogle
Hi!
For incomming connections (before it is answered by someone or the ansewring machine i didn't know how to implement it..
But in my situation the answering machine will always answer.. when this happens the fritzbox sends a signal to Domotcizs "Call" --> 'On
(when an phonecall is answered end and 'off' signel when the call is ended..)
so for my situation i look when the switch changed, then check the the phonenummer of the active call on the answering machine..
(this system is used for orders that comes in by phone on the answering machine, when certain clients calls between certain hours we need to know if they have left a new order or not by a certain time (the time is just a switch with the timer enabled.)
probably not many people need something like this but for who is interested this is the code i uses:
"Call" --> on when active phonecall , off when ended
"NieuweOproepen" --> this is a time based switch ( on at 10pm , off at 11pm ) so when called within this time it will be registered
"smsNieuweOproepen" --> just a switch to be able to turn the system on/off when its not used for certain reason (is normaly always 'on'
I have 10 uservalues: t1, t2, ... t10
thes are the phonenumbers to check if its one of these numbers that are calling
"Fritzbox" is the text that the fritbox sends to domoticz (this is used to compared the phonenumbers with.
"NewMessages" is just a uservalue (to count how many new orders did come in of those phone numbers (t1, .. t10)
Code: Select all
if devicechanged['Call']=='On' and otherdevices['NieuweOproepen']=='On' and otherdevices['smsNieuweOproepenActief']=='On' then
local i = 1
for i =1 , 10 do
local number = tostring("t"..i)
local FrizBoxText = tostring("Connected ID: 0 Number: "..uservariables[number])
if otherdevices_svalues['FritzBox'] == FrizBoxText then
local teller = uservariables['NewMessages'] + 1
commandArray['Variable:NewMessages'] = tostring(teller)
print(FrizBoxText.. 'nieuwe te melden bericht binnen')
commandArray['Bureau R 15'] = "On"
end
i = i+1
end
end
if devicechanged['NieuweOproepen']== 'Off' and otherdevices['smsNieuweOproepenActief']=='On' then
if (uservariables['NewMessages'] == 1) then
print('één nieuw bericht')
commandArray["SendSMS"] = "1 nieuwe bestelling voor leveringen Frankrijk"
elseif (uservariables['NewMessages'] > 1 ) then
print(uservariables['NewMessages']..' nieuwe berichten')
commandArray["SendSMS"] = uservariables['NewMessages'].." nieuwe bestellingen voor leveringen Frankrijk"
elseif (uservariables['NewMessages'] == 0 ) then
print('geen nieuwe berichten')
commandArray["SendSMS"] = "GEEN nieuwe bestellingen voor leveringen Frankrijk"
end
commandArray['Variable:NewMessages'] = tostring(0)
end
return commandArray