What’s the intended use case? It looks very daunting, since it has a lot of possibly redundant input fields. I understand that it’s probably impossible to write that dynamically. Looks easier to simply create a JSON-object from a JS-object or simply text string, but that might be down to my experience.
The intended use case is building a JSON to be parsed to for example HomeyScript, without having to place a Card for every single JSON Property, but in a way that is fullproof.
Uh, I feel like an idiot, but whenever I try to write a homeyscript either directly in a flow, or create a script… I dont have that top block you ahve where you define the args? Am I missing something?
Trying to make a script to switch on a light directly with arguments dim and color, now in the advanced flows this costs me 2 ‘then’ cards, I was hoping to do this with 1 script call like underneath but sofar no luck getting anything to work (I am a machine programmer so these functions are really easy on a PLC, but for some reason it must be complicated in java :-))
I meant as long as you can run the script directly you can log to the console to see if it gives the result you wanted. However when you have to run the script from a flow, the console isn’t visible afaik, so then I don’t see if it has the correct result.
What exactly should your last code do? I do not quite understand it sorry
Homey doesn’t have (accessible) logfiles for most things, Homeyscript included. So the only way to see if a script runs correctly is to hardcode some test data into it and run it manually.
If args[0] isn’t defined, it will use a fixed string as input. That’s how you can test your script manually.