Beginner Warning-Stuck at first base with send to log

Easy to use, 100% Lua-based event scripting framework.

Moderator: leecollings

Post Reply
paul402
Posts: 105
Joined: Monday 23 May 2016 23:07
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Beginner Warning-Stuck at first base with send to log

Post by paul402 »

Spent a day trying to figure this out now and I watched the video 6 times. :(
All I want to do is put some data in the log file. I used a variant of the example.

Code: Select all

 return {
	active = true, 
	on = {
		devices = {
		    'GetAbHum'
		},
	},	
	execute = function(domoticz, device)
	    domoticz.log('Msg 1 Start Ab Hum switched')
	    if (switch.state=='On' ) then
	        domoticz.log('Hey I am ON')
	    else
	        domoticz.log('Hey OFF')
	    end
	end
}  
I see messages about this in the log file but not my messages. Logging is set to the recommended Errors + Minimal + Generic

Code: Select all

date+time User: Admin initiated a switch command (1197/StartAbNum/On
date+time (GetAbHum) Light/Switch (StartAbHum)
Hardware device info is in the attached graphic.
dozy.jpg
dozy.jpg (11.62 KiB) Viewed 1160 times
.
Would appreciate any tips before giving up! I can't spend all day in front of a computer achieving nothing. It is soul destroying.
Doler
Posts: 163
Joined: Friday 31 July 2015 21:02
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Sint-Oedenrode, Netherlands
Contact:

Re: Beginner Warning-Stuck at first base with send to log

Post by Doler »

You should replace (switch.state=='On' ) with (device.state=='On')
Mark: Domoticz latest Beta on Virtual machine (Proxmox) running Debian Bookworm - Z-Stick 7 - RFXCom - P1 - SolarEdge - Dahua - Philips Hue - Docker - Zigbee2mqtt (latest, docker) via python plugin - Zwave-js-ui (latest, docker) - dzVents - Nodered
dannybloe
Posts: 1355
Joined: Friday 29 August 2014 11:26
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Ermelo
Contact:

Re: Beginner Warning-Stuck at first base with send to log

Post by dannybloe »

You rename the second parameter in your execute function to 'switch':

Code: Select all

execute = function(domoticz, switch)
	...
end
Creator dzVents - RPi3, loads of zwave devices, esp8266, evohome.
paul402
Posts: 105
Joined: Monday 23 May 2016 23:07
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Beginner Warning-Stuck at first base with send to log

Post by paul402 »

Thanks for the suggestions but they did not affect the output at all. I wonder if my installation is corrupt!
Still life is too short. I will find another way to do what I need.
dannybloe
Posts: 1355
Joined: Friday 29 August 2014 11:26
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Ermelo
Contact:

Re: Beginner Warning-Stuck at first base with send to log

Post by dannybloe »

Maybe dzVents isn't enabled or you've put the script in the wrong folder? Or did you write it with the internal GUI editor in Domoticz? (and was the active switch set for the script)?
Creator dzVents - RPi3, loads of zwave devices, esp8266, evohome.
paul402
Posts: 105
Joined: Monday 23 May 2016 23:07
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Beginner Warning-Stuck at first base with send to log

Post by paul402 »

Network is set to 127.0.0.1
dzVents 2.2.0 is not disabled
Event is active
Active = true in script
Scripting is from the Domoticz editor

How can I identify if dzVents is actually live on the system? Is there a dzVents script to return the installed version or some debug status?
dannybloe
Posts: 1355
Joined: Friday 29 August 2014 11:26
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Ermelo
Contact:

Re: Beginner Warning-Stuck at first base with send to log

Post by dannybloe »

if you have loglevel to debug mode then you must see all kind of dzVents logging information in Domoticz' log. Can you verify that? And I'd suggest to switch to the beta which uses dzVents 2.3. Maybe you can try that.
Creator dzVents - RPi3, loads of zwave devices, esp8266, evohome.
paul402
Posts: 105
Joined: Monday 23 May 2016 23:07
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Beginner Warning-Stuck at first base with send to log

Post by paul402 »

Yes with debug on I got this in the log file

Code: Select all

 2017-11-24 11:20:20.185 User: Admin initiated a switch command (1197/StartAbHum/On)
2017-11-24 11:20:20.234 dzVents: Debug: Dumping domoticz data to /home/pi/domoticz/scripts/dzVents//domoticzData.lua
2017-11-24 11:20:20.269 dzVents: Debug: Event trigger type: device
2017-11-24 11:20:20.301 dzVents: Debug: Found module in /home/pi/domoticz/scripts/dzVents/generated_scripts folder: testdz
2017-11-24 11:20:20.325 dzVents: Debug: Device-adapter found for StartAbHum: Switch device adapter
2017-11-24 11:20:20.334 dzVents: Debug: Processing device-adapter for StartAbHum: Switch device adapter
2017-11-24 11:20:20.334 dzVents: Debug: Device-event for: StartAbHum value: On
2017-11-24 11:20:20.334 dzVents: Debug: Searching for scripts for changed item: StartAbHum
2017-11-24 11:20:20.344 (GetAbhum) Light/Switch (StartAbHum) 
But none of my messages to the log file.

At least I know that the dzVents subsystem is working. I will try the beta soon.
And thanks again for the feedback.
dannybloe
Posts: 1355
Joined: Friday 29 August 2014 11:26
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Ermelo
Contact:

Re: Beginner Warning-Stuck at first base with send to log

Post by dannybloe »

And where did you put your script?
Creator dzVents - RPi3, loads of zwave devices, esp8266, evohome.
paul402
Posts: 105
Joined: Monday 23 May 2016 23:07
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Beginner Warning-Stuck at first base with send to log

Post by paul402 »

Its where the system put it, "/home/pi/domoticz/scripts/dzVents/generated_scripts".
If I create a deliberate error and run the script I get an error message in the log so I think that it is in the correct place.
paul402
Posts: 105
Joined: Monday 23 May 2016 23:07
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Beginner Warning-Stuck at first base with send to log

Post by paul402 »

So I deleted my script and wrote it again and it worked! Thank you for all the help. Some how I had either corruption or had entered a hidden character somehow, but everything is working fine now....
I guess a wetware error.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest