Bug triggering device [SOLVED]

Moderator: leecollings

Post Reply
acaonweb
Posts: 78
Joined: Thursday 23 March 2017 14:18
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Bug triggering device [SOLVED]

Post by acaonweb »

I've wrote a simple dz script, triggering a single device

Code: Select all

return {
	on = {
		devices = {'Irrigatore'},
		timer = {},
		variables = {},
		scenes = {},
		groups = {},
		security = {},
		httpResponses = {},
		shellCommandResponses = {},
		customEvents = {},
		system = {},
	},
	data = {},
	logging = {level = domoticz.LOG_DEBUG, marker = "BugTest: "},
	execute = function(dz, device, triggeredItem)
	    if(triggeredItem.type == dz.EVENT_TYPE_DEVICE) then
	        dz.log("triggering it")
	        dz.notify('Test', device.state, dz.PRIORITY_NORMAL,0,'iPhone6S',dz.NSS_PUSHOVER)
        end
        

	end
}
If I change state of irrigatore device, I expect a push notification, but I have twice notification.
The log says:

Code: Select all

2022-06-05 21:01:33.208 Status: dzVents: Info: BugTest: : ------ Start internal script: Script #2: Device: "Irrigatore (Dummy)", Index: 116
2022-06-05 21:01:33.209 Status: dzVents: Info: BugTest: : triggering it
2022-06-05 21:01:33.210 Status: dzVents: Info: BugTest: : ------ Finished Script #2
2022-06-05 21:01:33.395 Status: dzVents: Info: BugTest: : ------ Start internal script: Script #2: Device: "Irrigatore (Dummy)", Index: 116
2022-06-05 21:01:33.396 Status: dzVents: Info: BugTest: : triggering it
2022-06-05 21:01:33.397 Status: dzVents: Info: BugTest: : ------ Finished Script #2
and the push notification are two, like the screenshot shows:
IMG_3499.jpg
IMG_3499.jpg (245.91 KiB) Viewed 1118 times
I think is a bug, or a big mistake in the script.

My setup:

Code: Select all

Version: 2022.1 (build 14352)
Build Hash: 5765540b9
Compile Date: 2022-06-03 07:39:12
dzVents Version: 3.1.8
Python Version: 3.7.3 (default, Jan 22 2021, 20:04:44) [GCC 8.3.0]
PRETTY_NAME="Raspbian GNU/Linux 10 (buster)"
NAME="Raspbian GNU/Linux"
VERSION_ID="10"
VERSION="10 (buster)"
VERSION_CODENAME=buster
ID=raspbian
ID_LIKE=debian
HOME_URL="http://www.raspbian.org/"
SUPPORT_URL="http://www.raspbian.org/RaspbianForums"
BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs
Last edited by acaonweb on Wednesday 08 June 2022 9:07, edited 1 time in total.
User avatar
waltervl
Posts: 5148
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: Bug triggering device

Post by waltervl »

What kind of device is that Irrigatore device? How do you trigger it? It could be that it is triggered twice eg On and Off. You could add a device state to the logging to see what triggered the second run.
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
acaonweb
Posts: 78
Joined: Thursday 23 March 2017 14:18
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Bug triggering device

Post by acaonweb »

it's a dummy and i trigger it from dashboard, clicking on it
i'll add a device.state to the log
acaonweb
Posts: 78
Joined: Thursday 23 March 2017 14:18
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Bug triggering device

Post by acaonweb »

i've added device.state to the log, clicking once the dummy device initial state off, i have that

Code: Select all

2022-06-06 17:08:58.779 Status: dzVents: Info: BugTest: : ------ Start internal script: Script #2: Device: "Irrigatore (Dummy)", Index: 116
2022-06-06 17:08:58.806 Status: dzVents: Info: BugTest: : triggering it
2022-06-06 17:08:58.807 Status: dzVents: Info: BugTest: : state: On
2022-06-06 17:08:58.809 Status: dzVents: Info: BugTest: : ------ Finished Script #2
2022-06-06 17:08:58.981 Status: dzVents: Info: BugTest: : ------ Start internal script: Script #2: Device: "Irrigatore (Dummy)", Index: 116
2022-06-06 17:08:58.982 Status: dzVents: Info: BugTest: : triggering it
2022-06-06 17:08:58.982 Status: dzVents: Info: BugTest: : state: On
2022-06-06 17:08:58.983 Status: dzVents: Info: BugTest: : ------ Finished Script #2
User avatar
madpatrick
Posts: 636
Joined: Monday 26 December 2016 12:17
Target OS: Linux
Domoticz version: 2024.7
Location: Netherlands
Contact:

Re: Bug triggering device

Post by madpatrick »

Maybe this can be something

Code: Select all

 triggeredItem
Try to change

Code: Select all

 execute = function(dz, device, triggeredItem)
Into

Code: Select all

 execute = function(dz, device)
-= HP server GEN8 Xeon(R) E3-1220L_V2 -=- OZW -=- Toon2 (rooted) -=- Domoticz v2024.7 -=- Dashticz v3.12b on Tab8" =-
acaonweb
Posts: 78
Joined: Thursday 23 March 2017 14:18
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Bug triggering device

Post by acaonweb »

Well, I need triggeredItem because I’m the original script I need to trigger a device and do some actions) and a timer (and do other action)
plugge

Re: Bug triggering device

Post by plugge »

acaonweb wrote: Monday 06 June 2022 21:09 Well, I need triggeredItem because I’m the original script I need to trigger a device and do some actions) and a timer (and do other action)
You don't need it anymore since version 2.4.0.
From the manual:
3. (domoticz, item, triggerInfo)
Note: as of version 2.4.0, triggerInfo has become more or less obsolete and is left in here for backward compatibility. All information is now available on the item parameter (second parameter of the execute function, see point 2 above).
You could try without the 'triggerInfo' parameter and see if that removes the double trigger.

See what happens if you change:

Code: Select all

if(triggeredItem.type == dz.EVENT_TYPE_DEVICE) then
into

Code: Select all

if device.isDevice then
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest