Easy Scripting App - Documentation/Example

Discussions about Z-Way software and Z-Wave technology in general
ridewithstyle
Posts: 155
Joined: 02 Jan 2016 01:20

Re: Easy Scripting App - Documentation/Example

Post by ridewithstyle »

Hey Poltos,

installed it and tried to add some easy scripting code. Selecting a dropdown device works, the list is populated. But the code box stays empty, no matter what I do. I can select statements but the box remains empty.

I run Firefox 75.0 on ubuntu 18.04, so I tried Chrome. And chrome works fine

So
- Firefox 75.0 doesn't work
- Since I started playing with the easy scripting app, I get "loop detected" entries in the log. But without details, so that doesn't really help much. Is there a way to easily access the lowlevel log file from the browser?
- The devices and the trigger events are sorted by god-knows what logic? Could they be sorted alphabetically? I have currently 90+ device ids and numerous scenes and dummy devices, so my list is huge and terrible to navigate

That's all for the moment, let me know when you have fresh code to test, ok?

Best Regards,
rws
User avatar
PoltoS
Posts: 7562
Joined: 26 Jan 2011 19:36

Re: Easy Scripting App - Documentation/Example

Post by PoltoS »

Thanks, we will check those three issues
User avatar
PoltoS
Posts: 7562
Joined: 26 Jan 2011 19:36

Re: Easy Scripting App - Documentation/Example

Post by PoltoS »

Can you show what produced the loop?
ridewithstyle
Posts: 155
Joined: 02 Jan 2016 01:20

Re: Easy Scripting App - Documentation/Example

Post by ridewithstyle »

Already posted my dad Thermostat Code above, I have seven instances of this running. As the loop warning doesn't show more Details, I can't identify what the issue is
User avatar
PoltoS
Posts: 7562
Joined: 26 Jan 2011 19:36

Re: Easy Scripting App - Documentation/Example

Post by PoltoS »

New version with minor esthetic fixes:

Code: Select all

(cd /tmp; wget https://storage.z-wave.me/z-way-server/z-way-3.0.5-7-g9548c3c_armhf.deb && sudo dpkg -i z-way-3.0.5-7-g9548c3c_armhf.deb
Don't forget to clear browser cache!

Sorted devices alphabetically.

Unfortunatelly Safari and Firefox are not supporting code assistant, so please use Chrome to get full features.

As for your script - this happens if a direct or indirect loop is detected - means the script triggers some events that leat to the same script to fire again. EasyScripting is detecting this and is stopping such loops.
ridewithstyle
Posts: 155
Joined: 02 Jan 2016 01:20

Re: Easy Scripting App - Documentation/Example

Post by ridewithstyle »

Nice warning :lol:

regarding the loop detection: well of course it is technically a very slow loop. Setting the target temperature will hopefully influence the measured temperature, which retriggers the script. It a closed-loop-control system, but it is a very slow feedback loop, the script runs every couple of minutes at maximum and there is no direct iteration or loop within the script.

To comment less ignorant, I would have to better understand how the loop-detection works. Is there a time-limit in which the loop has to be detected to fire?

Suggestion: how about an option to suppress loop detection for the current easy scripting App?
Attachments
2020-04-29 12_01_24-Z-Wave Smart Home.png
2020-04-29 12_01_24-Z-Wave Smart Home.png (37.28 KiB) Viewed 6556 times
User avatar
PoltoS
Posts: 7562
Joined: 26 Jan 2011 19:36

Re: Easy Scripting App - Documentation/Example

Post by PoltoS »

Loop detection checks that you enter in the Easy Scripting context being already in the same context.

For example if you trigger your script via event on Z-Wave Device and a Dummy, event from Z-Wave happened, the script switched the Dummy and Dummy handler triggered the execution of the script again - this is a loop.

If both devices are Z-Wave, then changing the status of the second device will not trigger the loop as script will end by the momnet the report from the device is received.

So you know what to check
User avatar
PoltoS
Posts: 7562
Joined: 26 Jan 2011 19:36

Re: Easy Scripting App - Documentation/Example

Post by PoltoS »

May be stack trace would be nice... add debugPrintStack() in the code of Easy Scripting to understand the reason
ridewithstyle
Posts: 155
Joined: 02 Jan 2016 01:20

Re: Easy Scripting App - Documentation/Example

Post by ridewithstyle »

Hi Poltos,

nice Webinar btw, thanks for that.

As you can see by the code I posted above, the script is triggered by ZWave Event Temperature. Then it compares the target value of the ZWav device with the "Dad Target" and adjusts the ZWave Target accordingly. So the device triggers the script and the script modifies the device. So if the loop detection watches for device reference, then the loop detection is valid. But I use two different vdevs of the ZWave device, I sense for the measured temperature and modify the target temperature, that shouldn't trigger a loop detection.

I added debugPrintStack() in all my instances of the script. I presume it is in /var/log... section and not in the ZWay GUI log. Can I access the /var/log/z-way... log from the browser?

Best Regards,
rws
User avatar
PoltoS
Posts: 7562
Joined: 26 Jan 2011 19:36

Re: Easy Scripting App - Documentation/Example

Post by PoltoS »

No, you have to SSH to read logs
Post Reply