Page 1 of 1

blockly doesnt work at all

Posted: Tuesday 27 March 2018 18:33
by timop
Hi
I have now been testing couple precense blockly and lua, with my raspberry domoticz (stable).
It somehow broke up I think after one system upgrade. it was simple as any of 3 phones is online(simple dummy on/off switches) it set fourth switch on and set one variable to 1

I did make it up again but now it wont work. not with simple dummy aswitch or with door contact.
No I even installed clean domoticz (beta) debian vm to my vmware and made it again but now it just wont work. any help?
not even that print line wont work.
blockly.PNG
blockly.PNG (18.82 KiB) Viewed 1315 times
blockly2.PNG
blockly2.PNG (17.56 KiB) Viewed 1314 times
and lua

Code: Select all

ommandArray = {}
if (otherdevices['switch1'] == 'On' and otherdevices['home'] == 'Off' ) then
        commandArray['home']='On'
        commandArray['Variable:homeVar']='1'
        print ('home !')
else
        commandArray['home']='Off'
        commandArray['Variable:homeVar']='0'
        print ('not at home')
end
return commandArray

and log

Code: Select all

2018-03-27 19:33:39.029  EventSystem: reset all device statuses...
2018-03-27 19:33:54.316  EventSystem: reset all events...
2018-03-27 19:33:59.014  User: Admin initiated a switch command (1/switch1/Off)
2018-03-27 19:33:59.015  (dummy) Lighting 1 (switch1)
2018-03-27 19:34:00.654  User: Admin initiated a switch command (1/switch1/On)
2018-03-27 19:34:00.655  (dummy) Lighting 1 (switch1)


Re: blockly doesnt work at all

Posted: Tuesday 27 March 2018 19:02
by timop
This way it work but I dont want like that :)
I want it like this
if phone1 or phone2 or phone3 is on and anyonehome is off
then set anyonehome on
and other wise
if phone1 and phone2 and phone3
then set anyonehome off


maybe that first check is useless, but somehow I thought it could be good to check..
blockly3.PNG
blockly3.PNG (22.46 KiB) Viewed 1307 times

Re: blockly doesnt work at all

Posted: Tuesday 27 March 2018 19:12
by jvdz
Something like this? :

Code: Select all

commandArray = {}

if (devicechanged['switch1'] == 'On'  
or  devicechanged['switch2'] == 'On'  
or  devicechanged['switch3'] == 'On' )
and otherdevices['home'] == 'Off'  then
	commandArray['home']='On'
	commandArray['Variable:homeVar']='1'
	print ('home !')
elseif otherdevices['switch1'] == 'Off'  
and otherdevices['switch2'] == 'Off'  
and otherdevices['switch3'] == 'Off'  
and otherdevices['home'] == 'On'  then
	commandArray['home']='Off'
	commandArray['Variable:homeVar']='0'
	print ('not at home')
end

return commandArray
Jos

Re: blockly doesnt work at all

Posted: Tuesday 27 March 2018 20:35
by timop
yes I notice couple differences and that elseif. but didnt work either..

Re: blockly doesnt work at all

Posted: Tuesday 27 March 2018 20:45
by jvdz
didn't work either
isn't much information to go on. ;)
The basics in the script should work and will fit the 3 phone switches.
so ... which part doesn't work?

Jos

Re: blockly doesnt work at all

Posted: Tuesday 27 March 2018 21:08
by timop
nothing, all phones are on but that home switch doesnt go on,

I did put manually all phone switches off and back to on, nothing, It just did log that phone switches went on/off.
I just found same kind of problem with two phone
viewtopic.php?f=61&t=39&start=100
but if I understand, that he got switch went on when both phones is on.
I just need just 1/3 or 2/3 or 3/3 top put home switch on,

Re: blockly doesnt work at all

Posted: Tuesday 27 March 2018 21:15
by jvdz
Understood.
Please provide the information about the exact switchnames involved, the current script you are using and how you implemented the script (Internal editor or LUA script in a directory).
Add some print() statement to the script to see if it fires at all.

Jos

Re: blockly doesnt work at all

Posted: Tuesday 27 March 2018 21:29
by timop
I made lua script and switches to my clean beta debian VM, and I got it working with your example, thanks for that!
So I think that stable raspberry installation is messed up somehow. because not even simple blockly doesnt work,
like if switch1 is on -> set light1 on.
however there is couple blockly event which are working, but I think I am going to use this beta release in vm, if I got my 1wire reader to work with passthrough.
so this is solved, I think.

Re: blockly doesnt work at all

Posted: Wednesday 28 March 2018 20:22
by timop
very very strange. I just got time to check that raspberry where that lua script was failing.
now it just started working after 19 oclock, nothing special happened, all phones was home before that.