Skip to content
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

Include support for HTTPS POST of data to HTTPS Server (e.g. emoncms.org for heatpumpmonitor.org) #422

Closed
wants to merge 5 commits into from

Conversation

Phil-Emmott
Copy link

As a heat pump installer I am keen to make sure that I can provide the best service to my clients.
I also have some coding experience (not loads, so please go easy on me).
Daikin's StandByMe professional portal gives very limited data to the installer, whilst this project gives excellent coverage, and if implemented, would allow installers to really optimise their installations and up their game.
In order to draw the charts in the same format as heatpumpmonitor.org using the app in openenergymonitor.org, the data needs to be sent as a HTTP POST to an instance of emoncms (normally emoncms.org). I took this one step further and implemented HTTPS, which may be unnecessary, but offers future proofing.
After discussion on openenergymonitor forum, it was pointed out that if an installer wanted to do this, then they also would need a local MQTT broker and a means of forwarding the data as HTTP. This would normally mean a homeassistant device / raspberry PI as well (i.e. a second box of some type), and at this point it's inefficient for a heat pump installer to bring and setup all this kit, and could result in repeat visits to a client to resolve IT issues.
This pull request is to bring in the HTTPS POST directly into the main program, so that the option exists to send Daikin (and other brands) data directly via https post to emoncms and other web servers to allow for the charting to work from this data.
Thanks for your consideration

Added line to say that this version supports HTTPS
Added the HTTPS Setup information and macro variables
I left the emoncms.org certificate in there to save others from processing it - it's publicly available
additional .h file to contain the function that creates the data string from the jsonbuff variable to be sent to the https server
Adds function call to send the jsonbuff values via HTTPS if set up in setup.h, using the function in https.h
Added instructions to setup HTTPS if required
@arc12
Copy link

arc12 commented Mar 29, 2024

I think there should be some guards in place for lines such as:
M5.Lcd.print("[HTTPS] POST...\n");

i.e. to cope with cases when use of the M5Stick is not defined

@arc12
Copy link

arc12 commented Mar 29, 2024

I think inclusion of https.h in mqtt.h should be controlled by an #ifdef, matching a #define name in setup.h.
i.e. it should be an opt-in

@Phil-Emmott Phil-Emmott closed this Apr 1, 2024
@Phil-Emmott
Copy link
Author

Thanks for the comments, @arc12 I'll put that in the next version of my work and subsequent pull request.

Revise approach, putting the function to send values by HTTPS in the https.h file, and thus preserving the original mqtt.h file.
New version (from me) will rename the sendvalues function in mqtt.h to sendvaluesMQTT and add a function to sendvaluesHTTPS in https.h

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants