Problem switching on light

Python and python framework

Moderator: leecollings

Post Reply
fabgio
Posts: 1
Joined: Saturday 27 June 2020 17:27
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Problem switching on light

Post 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
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest