-
-
Notifications
You must be signed in to change notification settings - Fork 114
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
fix system command #1888
fix system command #1888
Conversation
This removes the Lines 349 to 353 in dfe85b9
that keeps the messages from system, analog, temperatur, etc. If you remove all the return_not_found this check is also not needed.This is safe, much less error-prone and shows all messages from the value_info if there is no cf. https://github.com/MichaelDvP/EMS-ESP32/blob/bc7d848b9b64c968f451b1a42b531c3547e7a982/src/command.cpp#L356 |
I see your logic. Let me make some changes and add some more tests. I found some missing checks with missing attributes in the sensors too. |
I added some tests - they all succeed. Please take another look. If I add the root.clear() earlier after a successful cf, it will make unknown commands always return 'info'. |
I'm going to move some checks around too. I still think it's a waste to create device_info and then when there is an invalid entity or command wipe the json output and replace with an error. It's expensive and a waste. I'll move the deviceID check earlier in the code and do some more cleaning. |
That's mainly the |
attempt #4 - think it works, at least the tests pass. And I didn't need to flush root.clear() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, looks all ok now,
Only thing is that i prefere log_info for the commands with values.
add more tests, all seems to work. I'll keep adding tests for the unknown calls