Good afternoon!
I’ve tried to search the forums for this, but I can only find people discussing certain features / functions of HomeyScript.
My question is basically - is there any good documentation on how to use HomeyScript (efficiently)?
I can only find this official resource, but it barely explains anything. I know that you can use portions of the Web API, but since it wasn’t made to be documentation of HomeyScript and there’s no way of telling which features on here are relevant or accessible inside of HomeyScript, it doesn’t really help me.
Cause what I’d like to see as documentation is the following:
How to use HomeyScript in general and how to use it efficiently
Detailed explanation of common tasks (like getting/setting tags, getting information on a device and updating devices, how to find out which features/variables a specific device uses)
Differences in stand-alone HomeyScript and HomeyScript used within Advanced Flows (like exporting / using tags)
What JavaScript features you can and cannot use (for example: Which ECMAScript version is it using? What global features do devs have access to? What native functions are restricted? Can you still access lodash (I believe at one point you could)?)
What timezone does it use? How to get the time of your system etc.
I’d really like to start using HomeyScript cause it can be a lot more efficient than having massive Advanced Flows that are difficult to debug if something goes wrong, but every time I try to use it I get frustrated by the fact I don’t know what I have access to and how to properly access it, or if I can even accomplish what I’m trying to do in HomeyScript. So I only use it for quick little things like Maths().
I second that ask. It is very poorly documented. Any development environment needs a basic level of documentation that explains concepts, structure, functions, methods etc. With HomeyScript, you’re more or less left with trying to reverse engineer how things work by looking at sample code snippets and searching the forum where you can pick up small pieces and tips and tricks here and there.
Debugging is very difficult, with virtually no support from the execution environment beyond printing to the log. It’s not really up to standards. Athom could do a lot better.
Thanks, I’ve been to that page and it does explain a few details but without the larger context. Unfortunately it does not even begin to explain how the Homey scripting and flow card environment work and how different parts can communicate with one another. It feels like the flowcards, embedded scripts and stand-alone scripts are different islands of information and work accoding to different principles.
There is also a level of confusion with the nomenclature when it comes to variables vs. tags. You can define what is called a “Variable” by adding “New Variable” in the user interface. You can use this in your flows. But when you want to access or change these in a script, they are not accessible with global.set/get because they are in fact not variables but tags, but there is no simple way to read them. You can change them with the tag method. But how to read them?