I'm new to scripts, s0 I tried this simple one, based on an example online:
I'm using the Setup>More Optionsa>Events tab and creating the script there.
import domoticz
import DomoticzEvents as DE
if DE.changed_device_name == "Processor Temperature":
if DE.Devices["Processor Temperature"].s_value != 0:
domoticz.log("This is a test log entry")
when it runs, nothing happens.
if i use a different temp sensor, shown below
import domoticz
import DomoticzEvents as DE
if DE.changed_device_name == "Crawl Space":
if DE.Devices["Crawl Space"].s_value != 0:
domoticz.log("This is a test log entry")
...it runs but I get this error:
PyDomoticz_EventsLog: Invalid parameter, expected single parameter, got 2 parameters
The script is identical, except the device name.
any help would be appreciated!
Dan
Python Scripts...What's happening here?
Moderator: leecollings
-
- Posts: 666
- Joined: Thursday 02 October 2014 6:36
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2022.2
- Location: Geleen
- Contact:
Re: Python Scripts...What's happening here?
I do not know a lot about Python (yet), however, I do know Python is depending on indents, I do not see any indents in your piece of code, could that be the problem?
And it would be more readable when you use the code brackets for displaying snippets of (python)code.
And it would be more readable when you use the code brackets for displaying snippets of (python)code.
- waltervl
- Posts: 5714
- Joined: Monday 28 January 2019 18:48
- Target OS: Linux
- Domoticz version: 2024.7
- Location: NL
- Contact:
Re: Python Scripts...What's happening here?
If you start working with scripts in Domoticz please invest some time to use Dzvents instead of Python. Much better integration and documentation: https://wiki.domoticz.com/DzVents:_next ... _scripting
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
Who is online
Users browsing this forum: Bing [Bot] and 1 guest