
Thanks a lot
Moderator: leecollings
Code: Select all
commandArray = {}
if otherdevices['Einfachschalter'] == 'On' and otherdevices['Testschalter'] == 'Off' then
commandArray['Testschalter'] = 'On AFTER 1'
elseif otherdevices['Einfachschalter'] == 'On' and otherdevices['Testschalter'] == 'On' then
commandArray['Testschalter'] = 'Off AFTER 1'
end
return commandArray
Code: Select all
commandArray = {}
if otherdevices['Einfachschalter'] == 'On' then
if otherdevices['Testschalter'] == 'Off' then
commandArray['Testschalter'] = 'On AFTER 1'
else
commandArray['Testschalter'] = 'Off AFTER 1'
end
end
return commandArray
Wow thanky a lot trying to understand but still a noob, i tried to get rid of the delay and did:emme wrote:but a smarter way would be:Code: Select all
commandArray = {} if otherdevices['Einfachschalter'] == 'On' and otherdevices['Testschalter'] == 'Off' then commandArray['Testschalter'] = 'On AFTER 1' elseif otherdevices['Einfachschalter'] == 'On' and otherdevices['Testschalter'] == 'On' then commandArray['Testschalter'] = 'Off AFTER 1' end return commandArray
ciaoCode: Select all
commandArray = {} if otherdevices['Einfachschalter'] == 'On' then if otherdevices['Testschalter'] == 'Off' then commandArray['Testschalter'] = 'On AFTER 1' else commandArray['Testschalter'] = 'Off AFTER 1' end end return commandArray
M
Code: Select all
commandArray = {}
if otherdevices['Einfachschalter'] == 'On' then
if otherdevices['Testschalter'] == 'Off' then
commandArray['Einfachschalter'] = 'Off' and commandArray['Testschalter'] = 'On'
elseif otherdevices['Testschalter'] == 'On' then
commandArray['Einfachschalter'] = 'Off' and commandArray['Testschalter'] = 'Off'
end
end
return commandArray
Code: Select all
commandArray = {}
if otherdevices['Einfachschalter'] == 'On' then
if otherdevices['Testschalter'] == 'Off' then
commandArray['Einfachschalter'] = 'Off'
commandArray['Testschalter'] = 'On'
elseif otherdevices['Testschalter'] == 'On' then
commandArray['Einfachschalter'] = 'Off''
commandArray['Testschalter'] = 'Off'
end
end
return commandArray
This code feels flawed to me and will constantly trigger Testschalter On and Off while Einfachschalter is On... or am I seeing that wrong?emme wrote: but a smarter way would be:Code: Select all
commandArray = {} if otherdevices['Einfachschalter'] == 'On' then if otherdevices['Testschalter'] == 'Off' then commandArray['Testschalter'] = 'On AFTER 1' else commandArray['Testschalter'] = 'Off AFTER 1' end end return commandArray
my understanding of the Blockly script is to toggle Testschalter after 1 sec when Einfaschalter is on....jvdz wrote:This code feels flawed to me and will constantly trigger Testschalter on and of while Einfachschalter is On... or am I seeing that wrong?
Code: Select all
commandArray = {}
if devicechanged['Einfachschalter'] == 'On' then
if otherdevices['Testschalter'] == 'Off' then
commandArray['Testschalter'] = 'On AFTER 1'
else
commandArray['Testschalter'] = 'Off AFTER 1'
end
end
return commandArray
Code: Select all
commandArray = {}
if devicechanged['Einfachschalter'] == 'On' then
if otherdevices['Testschalter'] == 'Off' then
commandArray['Testschalter'] = 'On'
else
commandArray['Testschalter'] = 'Off'
end
end
return commandArray
Users browsing this forum: No registered users and 1 guest