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

Easy Scripting App - Documentation/Example

Post by ridewithstyle »

Hello there,

I would like to take a look at the "Easy Scripting" app that can be installed. But there is no documentation, no recipe or example code given. Does anybody have an entrypoint for me to start digging?

Thanks and best regards,
rws

[edit]Sticky tip for new readers:

1. Debug Messages

Code: Select all

console.log("debug trace output")
sends messages to z-way-server.log which you can then use to debug you EasyScripting App
Last edited by ridewithstyle on 26 Oct 2020 14:28, edited 2 times in total.
HoferSackal
Posts: 25
Joined: 08 Mar 2017 22:01

Re: Easy Scripting App - Documentation/Example

Post by HoferSackal »

Would appreciate it too!
HoferSackal
Posts: 25
Joined: 08 Mar 2017 22:01

Re: Easy Scripting App - Documentation/Example

Post by HoferSackal »

Hello everyone.

Maybe someone has some hints / tipps?!

Thanks, br
User avatar
PoltoS
Posts: 7562
Joined: 26 Jan 2011 19:36

Re: Easy Scripting App - Documentation/Example

Post by PoltoS »

https://github.com/Z-Wave-Me/home-autom ... 639812a2d6

You can apply those two files and get examples right in the App description
HoferSackal
Posts: 25
Joined: 08 Mar 2017 22:01

Re: Easy Scripting App - Documentation/Example

Post by HoferSackal »

Thank you!
ridewithstyle
Posts: 155
Joined: 02 Jan 2016 01:20

Re: Easy Scripting App - Documentation/Example

Post by ridewithstyle »

Thank you, looks awesome!

Now if you'll excuse me, I'm off to "program" the "dad-Thermostat", where the automation gradually lowers the target temperature to a sensible level after my wife turns it to 28°C because she doesn't like the boost button on it.

Best Regards,
rws

[edit]
That app is awesome!

it took me less than an hours to implement the dad mode thermostat. Now every time the measured temperature gets reported, the app checks if the target temperature is set to a sensible level. For that I added a virtual dummy device where I can set the lower level of the dad mode. It only can do integer numbers but that's a compromise I am willing to make.

Code: Select all

//Get triggered by temp. sensor updates of thermostat
###ZWayVDev_zway_39-0-49-1

var sensorValue = vdev("ZWayVDev_zway_39-0-49-1").value()
var targetValue = vdev("ZWayVDev_zway_39-0-67-1").value()
var targetDadValue = vdev("DummyDevice_155").value()

if (targetValue > targetDadValue) {
vdev("ZWayVDev_zway_39-0-67-1").set(targetValue - 0.5)
}
Now the target temperature gets lowered with each temp update by 0.5° until it has reached the dad level. The script gets triggered whenever the room temperature changes, so it's not that obvious to the unsuspecting eye.

Seriously awesome work, this makes ZWay so much more attractive! Much appreciated!

Best Regards,
rws

[edit]
Working out the details here. devices can be used as variables as well.

Code: Select all

//Get triggered by temp. sensor updates of thermostat
###ZWayVDev_zway_50-0-49-1

var thermostat_sensor_device = vdev("ZWayVDev_zway_50-0-49-1")
var thermostat_target_temperature_device = vdev("ZWayVDev_zway_50-0-67-1")
var dad_target_dummydevice = vdev("DummyDevice_157")

//Get Sensor Value
var sensorValue = thermostat_sensor_device.value()
var targetValue = thermostat_target_temperature_device.value()
var targetDadValue = dad_target_dummydevice.value()

//Reduce Target Temperature according to Dad Mode
if (targetValue > targetDadValue) {
thermostat_target_temperature_device.set(targetValue - 0.5)
}
I have some more questions:
Is there a way to send a message to the log from the easy scripting app?
Is there a way to launch a system command, e.g. a shell script?

Greetings,
rws
Last edited by ridewithstyle on 15 Apr 2020 17:37, edited 1 time in total.
User avatar
PoltoS
Posts: 7562
Joined: 26 Jan 2011 19:36

Re: Easy Scripting App - Documentation/Example

Post by PoltoS »

And we will soon make a graphical UI for it ;) will be even better!
HoferSackal
Posts: 25
Joined: 08 Mar 2017 22:01

Re: Easy Scripting App - Documentation/Example

Post by HoferSackal »

Nice Work :)
ridewithstyle
Posts: 155
Joined: 02 Jan 2016 01:20

Re: Easy Scripting App - Documentation/Example

Post by ridewithstyle »

Nice, If you need a beta tester, just let me know
User avatar
PoltoS
Posts: 7562
Joined: 26 Jan 2011 19:36

Re: Easy Scripting App - Documentation/Example

Post by PoltoS »

Yes, we need beta testers ;)

Please test Easy Scripting app in z-way-3.0.5-6-g27a2f2e_armhf.deb.

To upgrade:

Code: Select all

(cd /tmp; wget https://storage.z-wave.me/z-way-server/z-way-3.0.5-6-g27a2f2e_armhf.deb && sudo dpkg -i z-way-3.0.5-6-g27a2f2e_armhf.deb
Now the module has a cool UI to select triggers devices from the list, select vdev from the list, minimal syntax helper, helper on vdev("..."). [on dot press], color highlighting of the code and better description.

You are welcome to give us feedback and contribute!

BTW, to contribute go in /opt/z-way-server/automation/modules/EasyScripting/htdocs/js/, edit postRender-with-comments.js and the run sudo ./compile.sh (will minimize the code) - then refresh the browser. Be aware, syntax errors in this JS file are not tolerated.
Post Reply