-
-
Notifications
You must be signed in to change notification settings - Fork 470
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
(v3) Home Assistant notification support #971
(v3) Home Assistant notification support #971
Conversation
No better use the current 3.0 , this branch will be under heavy testing in coming weeks so will bring mess for you to work on branch that is not stable
Yes no issue for V3 but need to update validity function and position in EEPROM
I am not sure to understand your issue the file already has this include: https://github.com/luc-github/ESP3D/blob/3.0/esp3d/src/modules/notifications/notifications_service.cpp#L44
No sorry, I have no plan and no willing for that - the parsing is made to be as simple as possible to not overload ESP, giving most time to major task, adding an alternative char means double the workload of ESP for this, when issue is another software cannot handle the char - prusa slicer had same issue and they fixed it - better fix the issue at the root instead of trying to workaround in ESP3D, or next time the alternative char will be also an issue with a new slicer, etc... - it will never end ...
HOMME_ASSISTANT is ok I think, POST_REQUEST won't be clear for people , 99% people do not read docs orz..
GET is already available with [ESP620], open for all requests in one API is a small project by itself, need some time to list all possible and necessary parameters (http / https, headers, parameters, workflow, etc...) and some reflexion to limit the code footprint, currently I have no bandwidth for such task... but you are welcome to try ^_^ |
Makes sense. |
33992de
to
2070b76
Compare
OK, I didn't rebase to the original v3 branch yet, there are a lot of conflicts of course, but I want to get it working first. It already works if I hard code the auth token as in the other MR, but even though I changed all memory indexes to make space for the extra bytes in T1, I'm still getting trash when I try to read it. Even crashes some times, so it is obviously writing in the wrong place. Any tip on what I may have missed? |
The token is parsed correctly
But then when reading it, it reads some nonsense (see beind
|
Oh wow, I think I found the issue. Reducing T1 to 250 bytes made it work. I had the hunch that some counter is 8 bit long and that results in either storing or reading T1 was getting out of whack. |
Pending:
|
Why did you changed :
to
This will impact others notifications that use https - your local server does not use https ? |
about the size yes - it seems I have in writeString / readString / isValidString and may be elsewhere: About About doc it is actually landing: |
no need to rebase to 3.0 it will make you crazy to manage conflict because the branch you use is a rewrite and nothing will match |
WiFiClientSecure inherits from WiFiClient, with this change it can be used with both. Local home assistant uses http, and somehow I couldn't get WiFiClientSecure to work with the Internet facing https url either |
Ok that's a relief 👍 And then you'd have to do the same work again to rebase your working branch. |
Ok, good to know. It's done already so I may as well leave it there now. Updating the ram positions was a bit of a pain, I reformatted the #define lines a bit so I could automate it. |
Is there any way to make esp600's message contain spaces? That used to work in v2 and it's quite limiting |
Hmm no, Secure client use different API to read/write data: here for esp32 : https://github.com/espressif/arduino-esp32/blob/master/libraries/WiFiClientSecure/src/WiFiClientSecure.cpp#L232 Did you tested that other notif still work ? I doubt it will Using implicit casting is bad idea and not good habit because it can lead to nightmare to find issue root cause |
yes of course : just add |
Wait, what? Should I make a duplicate of Wait4Answer for non-secure Thanks for taking the time to go through the PR :)
I did not |
The class base is same because they have several methods in common but not read / write because ClientSecure use new ones as I linked to you. Yes I suggest to duplicate it to avoid issue As I wrote before :
|
Got it. To avoid duplicating the function, I made it a template. Let me know if that's not a good idea. |
* Add notification via post request * Extend t1 size to 255 bytes * Correct all memory references
5aa9c70
to
74a9689
Compare
Allright, anything else pending apart from these two then?
|
if you do not use it you should remove the code instead of comment it :
|
So Can I merge ? |
I think I'm done, yes. Let me take a last look at all the changes to be sure. |
like for the T1 size ^_^ |
@@ -97,9 +97,9 @@ const char* FirmwareLabels[] = {"Unknown", "Grbl", "Marlin", "Smoothieware", | |||
const char* FirmwareValues[] = {"0", "10", "20", "40", "50"}; | |||
#ifdef NOTIFICATION_FEATURE | |||
const char* NotificationsLabels[] = {"none", "pushover", "email", | |||
"line", "telegram", "ifttt"}; | |||
"line", "telegram", "ifttt", "home-assistant"}; |
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.
Ok for this one to have a dash?
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 I see no issue
I tested it again and it still works, so ok to be merged. Thank you! |
✅ Done. Btw |
Ho
Ho I missed this one when rewriting the setting API, so still may need more consolidation later then, because now have 3 differents sizes for token and they are hard coded orz... |
Merged thank you |
* Remove all output flags * Masse replace name function / class to sync with ESP3D-TFT * Create ESP3DMessageManager class to handle messages creation / deletion (import functions of ESp3DClient from ESp3D-TFT) * Move to new messaging API of ESP3D-TFT * Remove empty line from remote screen dispatching * Replace \n to space and \r to nothing in remote screen dispatching * Add missing default entry for sensor device * Fix buzzer for ESP32 missing ledc initialization with latest core * Move formatBytes to esp3d_string * Add welcome message to telnet connection\ * Add display to the new messaging API * Add sticky authentication on Serial / SerialBridge /Telnet/Data web socket and BT * Log simplification * Use enum class instead of typdef enum for ESP3DAuthenticationLevel to be sure correct enum is used * (v3) Home Assistant notification support (#971) * Add notification via post request * Extend t1 size to 255 bytes * Hide Home Assistant notifications from web UI (#974) * Sync with ESP3DLib on serial_socket * Add some sanity check to avoid unnecessary message copies * Update ESP0.cpp --------- Co-authored-by: David Buezas <dbuezas@users.noreply.github.com>
To avoid double work, I'll ask here before I start implementation for v3.
Refactoring-internal-clients
)#include <ESP8266HTTPClient.h>
specifically for this. I can put it behind a flag to make it optional.M118 [ESP610]type=HOME_ASSISTANT TS=homeassistant.local:8123 T1=access-token
Authorization: Bearer YOUR-TOKEN
)M118 [ESP600]/api/services/switch/toggle#{"entity_id": "switch.3d_printer_switch"}
HOME_ASSISTANT
orPOST_REQUEST
?