-
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
Rules: Publish to MQTT not working any more #2932
Comments
What was the last version your rules still worked? Have you tried the "relaxed rules parsing" option in the Tools -> Advanced page? |
Hi, last version working was 20200204.
It overall looks to me that as soon as you try to put someting between singletons '{', this does not work anymore. |
Ah, I think I know what may have caused this and it is indeed a new change. See new replacement commands |
OK, I have thought about it.... |
The breaking change was introduced here: #2828 Looks like changing the new rules commands (substring etc.) into using curly braces does break all attempts to make JSON. It has to be marked as "this is JSON" or something like that or else the nested parsing will also not work. This means the I am thinking of using 2 characters from the "extended" ASCII code or values < 32 as temp chars, and let's hope it will not introduce any issues when Unicode is uses in strings.
If anyone already can give some examples of Unicode that will be broken, please let me know. |
OK, I think I fixed it now and you can even use these new commands in generating JSON if you like:
Results in:
|
Good. Looking forward to testing latest release then. |
Test build: ESPEasy_mega-20200305-18-PR_2933.zip |
Just tested it. Rules are working now. |
[Rules] Fix parsing new rules commands when building JSON string (#2932)
@TD-er sorry did not get notification about your comment, maybe we can replace it with %curlyopen% %curlyclose% or shorted version %co% %cc% and parse line template at the end ? |
@uzi18 I have now replaced it with a single byte char, so we prevent memory allocations. |
Checklist
I have...
ESP_Easy_mega-20200305_normal_ESP8266_4M1M.bin
)Steps already tried...
.bin
files are included in the ZIP)Summarize of the problem/feature request
In the two latest versions
Publish command does not work anymore.
info log says:
ACT : Publish espsensor_01/attributes,''
instead of
ACT : Publish espsensor_01/attributes,'{ 'IP': '192.168.1.14', 'last_set': '17:42:35' }'
Expected behavior
Publication through MQTT of the following topic and content.
espsensor_01/attributes,'{ 'IP': '192.168.1.14', 'last_set': '17:42:35' }'
Actual behavior
Publication of espsensor_01/attributes,''
Steps to reproduce
Note: same behaviour for ESP_Easy_mega-20200301_normal_ESP8266_4M1M
System configuration
Hardware: PLATFORMIO_ESP12E / NodeMCU
ESP Easy version: mega-20200305
Rules or log data
The text was updated successfully, but these errors were encountered: