Logic Machine Forum
Script_Disable: strange behaviour - Printable Version

+- Logic Machine Forum (https://forum.logicmachine.net)
+-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1)
+--- Forum: Scripting (https://forum.logicmachine.net/forumdisplay.php?fid=8)
+--- Thread: Script_Disable: strange behaviour (/showthread.php?tid=1288)



Script_Disable: strange behaviour - Domoticatorino - 14.03.2018

Code:
script.disable('Valvola_Bagno_Giorno_Automatismo')
termostato_giorno = event.getvalue()
os.sleep(0.2)
if termostato_giorno == true then
 grp.write('2/0/8', true) -- valvola bagno giorno
  end
os.sleep(10)
script.enable('Valvola_Bagno_Giorno_Automatismo')
Code:
script.disable('Valvola Bagno Notte Automatismo')
termostato_notte = event.getvalue()
os.sleep(0.2)
if termostato_notte == true then
  grp.write('2/0/5', true) -- indirizzo valvola bagno notte
    end
os.sleep(5)
script.enable('Valvola Bagno Notte Automatismo')


Hi above 2 event based script which works but in the first case script anable and disable does not work. I mean that does not disable the script ('Valvola_Bagno_Giorno_Automatismo'). The name of the script is correct.

I cannot the reason why in the second script I see the resident script ('Valvola Bagno Notte Automatismo') which change its status. In the other case no.

I cannot understand the reason why.

Thanks.


RE: Script_Disable: strange behaviour - admin - 14.03.2018

Are you sure that the name is correct? In one place you have name with spaces, in another with "_". You can also do this:
Code:
log(script.disable('Valvola_Bagno_Giorno_Automatismo'))

If logged value is nil it means that script is not found.


RE: Script_Disable: strange behaviour - Domoticatorino - 14.03.2018

Yes, I used "_" because at the beginning there's not. I copied the name of the script and paste it. The same thing I did with the working script.
In any case I check.
Thanks.

I log the variable.
The first time was bool:false, the second time I test it value was nil. How is it possible?
Thanks.