Page 1 of 1

Problem switching on light

Posted: Saturday 11 July 2020 18:43
by fabgio
Hello everyone,
I am new to Domoticz and Python, (still I have good experience in Java)

I am trying a Python script like this:

Code: Select all

import DomoticzEvents as DE
import domoticz
for name, device in domoticz.devices.items():
    if device.name=='Luce Camera Gio':
        if device.is_off():
            device.on(after=3)
Where Luce Camera Gio is the name of my device (a.k.a a light). The script is named 'Luce'. Moreover, from the examples a read, it looks like Device class do not need an instance like:
device=Device(). The script does not work. I read the domoticz.py module too.

Code: Select all

The log message is  "2020-07-11 18:25:18.698 Error: EventSystem: Failed to execute 
python event script "luce" 
what's wrong?
Giovannni