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) #2 #428

Open
wants to merge 16 commits into
base: main
Choose a base branch
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.
This version is cleaner than my previous pull request as the https.h contains all the https related functions, rather than having them in the mqtt.h file.
I've taken on board the comments from @arc12 (Adam Cooper), thanks for taking the time to review.
I've also added an option in converters.h to have the 'simple' boolean data reported as 1/0 rather than ON/OFF in case the destination requires (this is the case with emoncms.org).
Thanks for your consideration, and also to my co-author Ice and Rock.

@johngouk
Copy link

This is a really useful addition to the ESPAltherma software. As Phil says, it removes the need for HA/local EmonCMS, and also simplifies processing with the 0/1 Off/On change.
Any chance we could have this accepted??

{
String httpRequestData = "node=" + String(NODE) + "&data=" + String(httpsbuff) + "&apikey=" + APIKEY; //Build the Emoncms data string

static WiFiClientSecure client;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like this line and the one above it should be indented a couple of spaces





Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extra whitespace here too

#define APIKEY " " //emoncms
#define NODE "emontx" // node in emoncms

// root certificate of emoncms.org - expires 2038
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Obviously if they change who provides their cert chain...

Their current certs are 3 months...

What's the error handling like if the cert no longer validates?

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.

4 participants