Skip to content

Updated Home Assistant module to enable SSL.#1249

Merged
awawa-dev merged 4 commits intoawawa-dev:masterfrom
josh-blake:master
Aug 21, 2025
Merged

Updated Home Assistant module to enable SSL.#1249
awawa-dev merged 4 commits intoawawa-dev:masterfrom
josh-blake:master

Conversation

@josh-blake
Copy link
Copy Markdown
Contributor

Updated Home Assistant module to enable SSL.

Adds option to ProviderRestApi constructor to enable SSL if specified in the init method.

Have not stuffed around with the Wizard page yet.

…rts either HTTP or HTTPS as specified in the function call.
@awawa-dev
Copy link
Copy Markdown
Owner

awawa-dev commented Aug 19, 2025

Hi
As you know, this provider is used by other components, so to avoid checking if it breaks something else, it's better not to modify the constructors and do something else: provide the new method I mentioned, OR don't change the provider at all. If the HA address contains the https scheme, use the standard constructor with port 443 (it sets the scheme to https), and then immediately change the port to the correct one (provider updateHost(const QString& host, int port)). To get the scheme/port/host, use QUrl in the HA driver initialization section. Then there's no need to change the HA driver scheme or the RestProvider. Example :

QUrl url(input);

if (url.isValid())
{
    QString scheme   = url.scheme();      // "https"
    QString host     = url.host();        // "example.com"
    int port         = url.port();        // 1234
    
    qDebug() << "Protocol:" << scheme;
    qDebug() << "Host:" << host;
    qDebug() << "Port:" << port;
 }

BTW we are using TABS as code indentation.

@awawa-dev awawa-dev self-requested a review August 19, 2025 11:54
@awawa-dev
Copy link
Copy Markdown
Owner

awawa-dev commented Aug 19, 2025

Well, it turned out that updateHost does nothing useful. Please check the app after my changes if https is working correctly (HA address must be in form: https://host or https://host:port)

@awawa-dev awawa-dev merged commit 2cd3823 into awawa-dev:master Aug 21, 2025
@josh-blake
Copy link
Copy Markdown
Contributor Author

Can confirm that HA now connects over SSL on this build. Thanks heaps.

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.

2 participants