-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Updated Rules parameter parsing (2019/11) #2724
Comments
Nope, that feature request is not yet implemented. |
Using release mega-20191116 Seen this:
Imagine you have two ESP Easy modules, ESP#1 and ESP#2 In the Rules section of ESP#1 you have this:
?? Must be And ESP#2 has the rules according to the previous example (givemesomewater) If you then enter this with the correct IP address in the URL of your browser:
Then ESP#1 shall send the event ‘startwatering ‘ to ESP#2. It is also possible to directly order GPIO changes, like:
?? Must be |
I updated your comment to use the correct Markdown syntax, as it is almost completely a form of documentation and not really a question, right? The thing with commands embedded in the GET url is that you probably have to escape some of the characters, so it is best to cut/paste your command in the command dialog (tools page) first and then see what the URL has become. |
@TD-er ...yes I found out some aspects, but was asking for confirmation. Am I the only one ?? But how about this one?
Error Log:
Where to escape ? SendToHTTP 192.168.1.81,80,"/control?cmd=taskvalueset,10,4,[BoilerStat#Boiler_Stat]" Both are Ok in the command dialog (thanks for the hint!) |
The command + parameters are:
So the
As a reference, see the command reference page. So these are all correct:
|
Without the ' it works fine again |
What build was working and what build isn't working anymore? |
That I do not know since I just updated everything and not I do not remember what it was on there. |
Is it the last code we have on Github, or is it a nightly build? |
It is the latest git hub code. The issue is present with the flag enabled and disabled
|
@jimmys01 I noticed your last post again and was wondering if there is still an issue I need to look into. |
IRSENDAC,'{"Protocol":"COOLIX","Power":true,"Opmode":"auto","Degrees":24,"Fanspeed":"auto","Swingv":"min","light":"true"}' does not work Tested with the latest commits |
This one is no surprise, as it cannot see any difference between end of parameter, or a quote in the parameter.
This one is surprising.
OK, good to know something is still working :) |
just as a hint: the documentation regarding this is deceptive. Best regards |
Faced with the problem of saving the rules! Save button doesn't always work |
What ESPEasy release (name of the .bin file that's installed), Operating System and Browser are used? |
ESP_Easy_mega_20230508_collection_F_ESP32_4M316k |
It's quite some time ago that I worked with Win7, not sure if Chrome still (fully) supports that OS, supplying updates etc. (IOW: You'd better not use Win 7 anymore). NB: This subject is more suitable to be discussed in the Forum |
Yes, I also assumed that win7 was outdated and checked on a new PC + win10, the problem did not go away... |
Well, if it works from a mobile phone, it isn't really an ESPEasy problem, I assume, it must be something on the PC-side, maybe your Antivirus software is blocking something because the ESP is accessed via HTTP? (Some AV software is really annoying, and they never give a clue in what is being blocked...) |
Ok, I'll look... :-) |
That's exactly what the JavaScript does when updating the rules. So if your browser blocks Javascript, or is unable to load the JavaScript (those files are loaded from a CDN server), then the save will not work. See the documentation: https://espeasy.readthedocs.io/en/latest/Reference/ExternalHostedStaticFiles.html?highlight=CDN#external-hosted-static-files |
Thank you! I will try |
Uploaded the files from the link https://github.com/letscontrolit/ESPEasy/tree/mega/static |
I don't know how to move posts to a new issue, but to be honest, this isn't quite on-topic to this (pinned) issue and thus highly confusing to those who need to read about the (breaking) changes that were made in rules parsing. And since this was a breaking change for close to 3.5 years, I think it is no longer needed anyway. => can be closed. So I will close this issue and please can you make a new issue with a title properly describing the issue? |
Yes, sorry for being off topic. |
This will be a sticky issue to explain once and for all how parameters are parsed in rules and how they should be parsed.
A parameter separator is typically a comma (
,
), but for convenience the separator can also be accompanied by a space or be a single space.So these can be used to separate a parameter:
This does impose some restrictions on the use of a comma or a space in a parameter.
Especially sending JSON to a MQTT controller can become next to impossible with these limitations.
In order to allow the comma or space in a parameter, you can wrap the parameter in quotes.
'
(single quote)"
(double quote)There are multiple quotes available for this, to be able to use "the other quote" in your parameter.
For example in JSON, you need the double quote for string like values or keys.
This can be fixed by wrapping the last parameter with single quotes like this:
Just make sure to use the same quote as start and end of your parameter and don't use that character in the parameter itself.
N.B. these extra quotes are removed from the parameter when used, as well as trailing or leading spaces.
Currently there is a 'loophole' to trick the parsing into accepting spaces without having to wrap the parameter in quotes.
This uses
"
(space quote) and"
(quote space) which is abusing the parsing algorithm to trick it into using local wrapping. (it does add quotes to the log entry though)Do not use constructions like these, since they may lead to hard to debug situations when changing only the slightest bit in the rules.
Also it is quite non-intuitive why this is working.
Better use it like this:
The reason this behavior was changed from before 2019/11 was that the old implementation could lead to unpredictable results.
Also there was no really strict definition for what a parameter would look like.
Meaning a parameter for one command would be parsed different from another command.
Now we have a single method for parsing a parameter, but on the downside some rules using the
Publish
command may no longer work when sending JSON.These can be fixed very easily by adding the single quotes wrapping the parameter.
This is a breaking change, but it had to be like this or else we would have to deal with lots and lots of very odd reported issues where seemingly similar rules do work on one node and not on the other.
The old behavior was not only buggy (e.g. the last quote could still be present in the text), but also depending on the order of variables (wrapped in
[
&]
).Also it was impossible to add more parameters to existing commands which did parse a parameter to the end of a line.
The text was updated successfully, but these errors were encountered: