Switch execute twice if selected from Android app

Moderator: leecollings

Post Reply
woody4165
Posts: 476
Joined: Monday 14 March 2016 13:55
Target OS: Linux
Domoticz version: beta
Location: Rome, Italy
Contact:

Switch execute twice if selected from Android app

Post by woody4165 »

Hi

I made this simple script just to test izSynth

Code: Select all

--
commandArray = {}

if (devicechanged['Oggi'] == "On") then

    giorni = {"Lunedì", "Martedì", "Mercoledì", "Giovedì", "Venerdì", "Sabato", "Domenica"}
    mesi = {"Gennaio", "Febbraio", "Marzo", "Aprile", "Maggio", "Giugno", "Luglio", "Agosto", "Settembre", "Ottobre", "Novembre", "Dicembre"}

    mese = os.date("%m")
    giorno_sett = os.date("%w")
    giorno = os.date("%d")
    anno = os.date("%Y")

    data = os.date("%d %B %Y")
    ora = os.date("%H e %M")
    temp = otherdevices_svalues["TempExt"]
    pos = string.find(temp, ";")-1
    temp = string.sub(temp,1,pos)
    message = "Oggi è "..giorni[tonumber(giorno_sett)].." "..tostring(giorno).." "..mesi[tonumber(mese)].." "..tostring(anno).." e sono le "..ora..". La temperatura esterna è "..temp.." gradi centigradi. Buona giornata!"
    messaggio2= '/home/pi/domoticz/scripts/izsynth -t "'..message..'"'
    prova = os.execute(messaggio2)
    commandArray["Oggi"] = "Off"

else
    return 
end



return commandArray

Strange thing is that if I set to On the device switch from the webpanel all is ok, if I do it from Android app I get the os.execute done twice (I hear twice the message from speaker, one over the other).

Don't know if it's right to set to Off the switch that way or if there is something wrong

Any advice?

Thanks
Cubietruck - Linux cubietruck 4.13.16 (Debian GNU/Linux 8 (jessie)) + Domoticz + RFLink, Xiaomi Gateway, Owl USB, Yeelight Color and B/W, ESP8266, Broadlink RM2, Netatmo Thermostat
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest