Is there a way??? or would it be worth the development of a full texted based editor, or maybe even just importing text files into webcore? As a software developer, I find the GUI to be slow and confusing. There have been many times I wish I could just click “edit” and start typing instead of having to go and find things in the various menus. “I can code this… but I can’t find it”
Text based editor
There is no way to do this.
I can’t speak for Adrian but I don’t think this is on any road map.
I totally second this request. In many cases it faster and easier to just to write the code. It’s nice to have the menus and automation there for backup and sources of reference though, so I certainly wouldn’t want to see them go away.
Well, for what it’s worth, the graphical coding is much easier to learn than the underlying code beneath… Plus, you don’t have to worry about syntax using the popups, and it won’t let you write code in the wrong place.
I agree that the graphical coding tool is much easier to learn. But once you’ve learnt it, being able to use a text editor like VSCode would hugely speed up development.
This is a common newbie request…
(notice all 4 requests on this page were from brand new users)
I have created well over 50 thousand pistons (for thousands of users)
… and I still learn something new almost every day.
(IE: the day I think that I have “learnt it”, is the day that I stop growing)
One trick to speed up development, is to master the drag & drop.
I’m a noob to WebCore, but not to coding, and that’s the issue really. Going about 10% of the speed I would if I could directly edit the text is rather frustrating. That’s not to say I’m ungrateful for WebCore - it’s amazing, and has made my life so much easier. I just think being able to turn on an “advanced mode” where you can directly edit the text would be really useful, and definitely something that ought to be integrated into future versions.
Funnily enough, I’m trying to teach my kids how to code, using codekingdoms.com, and this morning I realised that their system is exactly what I expect would be useful for WebCore. They code by dragging in blocks. But when my son had managed to get a syntax error in there I just converted it into “epic mode” and quickly sorted out the code in a matter of seconds. It would have taken minutes with all the dragging and dropping.
I don’t think the fact that noobs are raising this is a reason to discount it. That people have got used to the current system is no reason not to change it.
I understand your frustrations…
I guess what I was trying to allude to is, the extra time spent learning unfamiliar popups, is still much less than the time you would spend learning syntax, handwriting and then troubleshooting any errors…
Trust me, the learning curve, potential for errors, and time invested, would all be much greater with pure text.
Just to put this to bed, the “code” that webCoRE shows is just a lossy representation of the data that defines a piston. The actual data looks like this (snippet is the first 400 of 4000 lines that make up this average sized piston):
{
"o": {
"aps": 0,
"ced": 0,
"cto": 0,
"dco": 0,
"des": 0,
"mps": 1,
"pep": 0
},
"r": [],
"rn": false,
"rop": "and",
"s": [
{
"$": 237,
"a": "1",
"lo": {
"c": 2,
"d": [],
"exp": {
"i": [
{
"l": "0",
"ok": true,
"t": "integer",
"v": 2
}
],
"ok": true,
"str": "2",
"t": "expression"
},
"f": "l",
"g": "avg",
"om": 0,
"t": "c",
"vt": "h"
},
"lo2": {
"c": 952,
"d": [],
"exp": {
"i": [
{
"l": "0:2",
"ok": true,
"t": "integer",
"v": 952
}
],
"ok": true,
"str": "952",
"t": "expression"
},
"f": "l",
"g": "avg",
"t": "c",
"vt": "time"
},
"lo3": {
"c": 0,
"d": [],
"exp": {
"i": [
{
"l": "0",
"ok": true,
"t": "integer",
"v": 0
}
],
"ok": true,
"str": "0",
"t": "expression"
},
"f": "l",
"g": "avg",
"t": "c",
"vt": "m"
},
"r": [],
"rop": "and",
"s": [
{
"$": 250,
"a": "0",
"d": [],
"k": [
{
"$": 214,
"c": "setVariable",
"p": [
{
"d": [],
"f": "l",
"g": "avg",
"t": "x",
"vt": "variable",
"x": "tile_number"
},
{
"c": 1,
"d": [],
"exp": {
"i": [
{
"l": "0",
"ok": true,
"t": "integer",
"v": 1
}
],
"ok": true,
"str": "1",
"t": "expression"
},
"f": "l",
"g": "avg",
"t": "c",
"vt": "integer"
}
]
},
{
"$": 245,
"c": "setVariable",
"p": [
{
"d": [],
"f": "l",
"g": "avg",
"t": "x",
"vt": "variable",
"x": "title",
"xi": "0"
},
{
"d": [],
"e": "mid($weather.forecast.forecast.txt_forecast.forecastday.title,1,3)",
"exp": {
"i": [
{
"i": [
{
"i": [
{
"l": "4:60",
"ok": true,
"t": "variable",
"x": "$weather.forecast.forecast.txt_forecast.forecastday.title"
}
],
"ok": true,
"t": "expression"
},
{
"i": [
{
"l": "62",
"ok": true,
"t": "integer",
"v": 1
}
],
"ok": true,
"t": "expression"
},
{
"i": [
{
"l": "64",
"ok": true,
"t": "integer",
"v": 3
}
],
"ok": true,
"t": "expression"
}
],
"l": "0:65",
"n": "mid",
"ok": true,
"t": "function"
}
],
"ok": true,
"str": "mid($weather.forecast.forecast.txt_forecast.forecastday.title,1,3)",
"t": "expression"
},
"f": "l",
"g": "avg",
"t": "e",
"vt": "string[]"
}
]
},
{
"$": 244,
"c": "setVariable",
"p": [
{
"d": [],
"f": "l",
"g": "avg",
"t": "x",
"vt": "variable",
"x": "icons",
"xi": "0"
},
{
"d": [],
"e": "\":wu-v4-{arrayItem(0,$weather.forecast.forecast.simpleforecast.forecastday.icon)}:\"",
"exp": {
"i": [
{
"l": "1:7",
"ok": true,
"t": "string",
"v": ":wu-v4-"
},
{
"i": [
{
"i": [
{
"i": [
{
"l": "19",
"ok": true,
"t": "integer",
"v": 0
}
],
"ok": true,
"t": "expression"
},
{
"i": [
{
"l": "21:78",
"ok": true,
"t": "variable",
"x": "$weather.forecast.forecast.simpleforecast.forecastday.icon"
}
],
"ok": true,
"t": "expression"
}
],
"l": "9:79",
"n": "arrayitem",
"ok": true,
"t": "function"
}
],
"l": "8:80",
"ok": true,
"t": "expression"
},
{
"l": "81",
"ok": true,
"t": "string",
"v": ":"
}
],
"ok": true,
"str": "\":wu-v4-{arrayItem(0,$weather.forecast.forecast.simpleforecast.forecastday.icon)}:\"",
"t": "expression"
},
"f": "l",
"g": "avg",
"t": "e",
"vt": "string[]"
}
]
}
],
"r": [],
"rop": "and",
"t": "action",
"tcp": "c"
},
{
"$": 252,
"a": "0",
"c": [
{
"$": 253,
"co": "is",
"ct": "c",
"fs": [],
"lo": {
"d": [],
"f": "l",
"g": "any",
"t": "x",
"vt": "string",
"x": "metric"
},
"ro": {
"c": "true",
"d": [],
"exp": {
"i": [
{
"l": "0:3",
"ok": true,
"t": "boolean",
"v": "true"
}
],
"ok": true,
"str": "true",
"t": "expression"
},
"f": "l",
"g": "any",
"t": "c",
"vt": "boolean"
},
"ro2": {
"d": [],
"g": "any",
"t": "c"
},
"sm": "auto",
"t": "condition",
"to": {
"d": [],
"g": "any",
"t": "c"
},
"to2": {
"d": [],
"g": "any",
"t": "c"
},
"ts": []
}
],
"e": [
{
"$": 213,
"a": "0",
"d": [],
"k": [
{
"$": 247,
"c": "setVariable",
"p": [
{
"d": [],
"f": "l",
"g": "avg",
"t": "x",
"vt": "variable",
"x": "tempF",
"xi": "0"
},
{
"d": [],
"e": "int(arrayItem(0,$weather.forecast.forecast.simpleforecast.forecastday.high.fahrenheit))",
"exp": {
"i": [
{
"i": [
{
"i": [
{
"i": [
{
"i": [
{
"l": "14",
"ok": true,
"t": "integer",
"v": 0
}
],
"ok": true,
"t": "expression"
},
{
"i": [
{
"l": "16:84",
"ok": true,
"t": "variable",
"x": "$weather.forecast.forecast.simpleforecast.forecastday.high.fahrenheit"
}
],
"ok": true,
"t": "expression"
}
],
"l": "4:85",
"n": "arrayitem",
While it would be great for power users, this version of webCoRE will never be able to create that garish piston data from code.
If ST is ever able to provide enough features in the Rules API to support a new version of webCoRE that doesn’t run on Groovy I plan to approach that project with actual code that can written by power users or generated by UI. Even if you never write code manually there’s great benefit in being able to paste in code snippets if someone is helping you debug or redesign a piston. I already spent a lot of time working on the grammar and in-browser parser for that language but it seems like progress on the Rules API stalled. Fortunately ST bought more time by keeping the Groovy platform running for webCoRE and other popular SmartApps.
I agree 100%. I often pass Expressions
this way now… or if I am sharing a complex line (or block), then I might dump it in a new piston, and share the import code.
(same concept, with one extra click required for the recipient)