Please help this noob! :D

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

Moderator: leecollings

Post Reply
OedzesG
Posts: 106
Joined: Monday 11 March 2019 0:14
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Please help this noob! :D

Post by OedzesG »

Hallo everyone!

Sinds 2 weeks i install Domoticz and love it!
Now everything is connected, its time to make my first automation script.

Becouse i dont like blocky, i would love te use DzVents, but i think i only have some problems with understanding it :lol:

What i would like to do, is change the lights when my PLEX server starts to play.
So i usdes an PLEX script to send the data to my Domoticz en ceated some user-variables. this works perfect:

-1: Plex-server offline
0: Client inactief
1: video afspelen
2: gepauzeerde video
3: gestopt video
11: Audio afspelen
12: Onderbroken audio
13: gestopt audio
21: Foto weergeven
22: Onderbroken diavoorstelling
Uservariable.JPG
Uservariable.JPG (47.74 KiB) Viewed 597 times

Now i created a small script in DzVents:
Dzventz.JPG
Dzventz.JPG (40.54 KiB) Viewed 597 times
There are no errors at all! but script is not working.

Please help me understanding DzVents.

Thxx in advance!!!
freijn
Posts: 536
Joined: Friday 23 December 2016 16:40
Target OS: Raspberry Pi / ODroid
Domoticz version: Stable
Location: Netherlands Purmerend
Contact:

Re: Please help this noob! :D

Post by freijn »

perhaps start with some logging to see if the script is being hit?


logging = true

bla
bla
bla

if (logging) then print("script is Triggered " ) end
OedzesG
Posts: 106
Joined: Monday 11 March 2019 0:14
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Please help this noob! :D

Post by OedzesG »

Thx for quick response!

Nothing happend in the log files:
LOG.JPG
LOG.JPG (14.04 KiB) Viewed 586 times
So i thought maybe Dzvents is not working, but with the test script from WIKI:
works.JPG
works.JPG (34.44 KiB) Viewed 586 times
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Please help this noob! :D

Post by waaren »

How do you update the variable ?
You defined the variable as integer but you check if IT is equal to a string.
Please tag your code with code tags, makes it much easier to check.


Verstuurd vanaf mijn ONEPLUS A6003 met Tapatalk

Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
OedzesG
Posts: 106
Joined: Monday 11 March 2019 0:14
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Please help this noob! :D

Post by OedzesG »

The variable is updated by Python script, bases on evenements happend in plex.
When i check this script with my uservariable is this correct.

But somehow i think that DzVents is not recognize: variables = {'PLEX STATUS [Chrome]'}
freijn
Posts: 536
Joined: Friday 23 December 2016 16:40
Target OS: Raspberry Pi / ODroid
Domoticz version: Stable
Location: Netherlands Purmerend
Contact:

Re: Please help this noob! :D

Post by freijn »

From: https://www.domoticz.com/wiki/DzVents:_ ... 7B_..._.7D

Code: Select all

variables = { ... }

A list of one or more user variable-names as defined in Domoticz ( Setup > More options > User variables). If any of the variables listed here changes, the script is executed. 
So ... is your variable defined there ?
OedzesG
Posts: 106
Joined: Monday 11 March 2019 0:14
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Please help this noob! :D

Post by OedzesG »

Correct, thats why i write my script this way.
But somehow its not working, and it seems like this script is not hit.
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Please help this noob! :D

Post by waaren »

And what happens if you update the variable manually?

Verstuurd vanaf mijn ONEPLUS A6003 met Tapatalk

Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
OedzesG
Posts: 106
Joined: Monday 11 March 2019 0:14
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Please help this noob! :D

Post by OedzesG »

Thnx!! that worked...
test.JPG
test.JPG (33.16 KiB) Viewed 561 times
So it must be something in the script: Plex.py.

Ik wil search there!! thnx again!
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Please help this noob! :D

Post by waaren »

OedzesG wrote: Tuesday 14 May 2019 12:31 So it must be something in the script: Plex.py.
Specific for this reason the dzVents method to update variables added an extra call to the eventSystem to trigger an event as the domoticz standard update way does not do this.

And please don't use jpg for displaying code or logs here. Use code tags
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest