Page 1 of 1

Can a generated dzVents script be executed in a scene?

Posted: Monday 27 November 2017 11:48
by rizzah
HI,

I made a small dzVents script in an attempt to control my Hue light through a bash script and my Onkyo receiver through the Onkyo device which is added to Domoticz through the hardware/devices.

So i tried this:

Code: Select all

return {
    active = true,  
    on = {
    },

    execute = function(domoticz)

            if (domoticz.scenes('Film kijken').state == 'On') then
                os.execute('/home/pi/domoticz/scripts/hue-scripts/film-kijken.sh')
                domoticz.devices('Onkyo - Main Power').switchOn()
                domoticz.devices('Onkyo - Main Source').updateCustomSensor(NVIDIA)
                domoticz.devices('Onkyo - Main Volumer').updateCustomSensor(50)
                domoticz.log('----------------------------------------------')
                domoticz.log('-----------------IT RUNS RUNS ----------------')
                domoticz.log('----------------------------------------------')
            end
        end
}
When i enable the scene i see this in the logging:
2017-11-27 11:41:03.363 User: admin initiated a scene/group command
2017-11-27 11:41:03.365 Activating Scene/Group: [Film kijken]
2017-11-27 11:41:03.584 Executing script: /home/pi/domoticz/scripts/dzVents/generated_scripts/Film_Kijken.lua
2017-11-27 11:41:03.592 Error: Error executing script command (/home/pi/domoticz/scripts/dzVents/generated_scripts/Film_Kijken.lua). returned: 32256

Maybe im doing this all wrong, so any help or suggestions are welcome :-)

regards,

Re: Can a generated dzVents script be executed in a scene?

Posted: Monday 27 November 2017 12:34
by dannybloe
It should have triggers defined in the on-section. Your on-section is empty. Guess that's the problem.

Re: Can a generated dzVents script be executed in a scene?

Posted: Tuesday 28 November 2017 13:03
by rizzah
Alright, i did that, but the error remains. I have made a simplified script (for some reason it does execute certain things) so i thought i would bring it down to the bare minimal.

Code: Select all

return {
    active = true,  
    on = {
        scenes = {
            'Xbox spelen'
        }
    },
    execute = function(domoticz, scene)

            if (domoticz.scenes('Xbox spelen').state == 'On') then
                    domoticz.log('Receiver, XBOX ONE en TV aangezet.')
            end
     end
}
I read in some other posts that the error could be system rights connected. But all the executables i use are executable for everyone.