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

Update SMA sensor #12354

Merged
merged 1 commit into from
Feb 13, 2018
Merged

Update SMA sensor #12354

merged 1 commit into from
Feb 13, 2018

Conversation

kellerza
Copy link
Member

Description:

Added an SSL configuration option and some improved error handling in the upstream library.

Related issue (if applicable): kellerza/pysma#3

Pull request in home-assistant.github.io with documentation (if applicable): home-assistant/home-assistant.github.io#<home-assistant.github.io PR number goes here>

Example entry for configuration.yaml (if applicable):

sensor sma:
  host: 192.168.0.200
  ssl: true

Checklist:

  • The code change is tested and works locally.

If user exposed functionality or configuration variables are added/changed:

If the code communicates with devices, web services, or third-party tools:

  • Local tests with tox run successfully. Your PR cannot be merged unless tests pass
  • New dependencies have been added to the REQUIREMENTS variable (example).
  • New dependencies are only imported inside functions that use them (example).
  • New dependencies have been added to requirements_all.txt by running script/gen_requirements_all.py.
  • New files were added to .coveragerc.

sma = pysma.SMA(session, config[CONF_HOST], config[CONF_PASSWORD],
group=grp)

url = "http{}://{}".format(
Copy link
Member

Choose a reason for hiding this comment

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

Why don't we always use ssl?

url = "http{}://{}".format(
"s" if config[CONF_SSL] else "", config[CONF_HOST])

sma = pysma.SMA(session, url, config[CONF_PASSWORD], group=grp)
Copy link
Member

Choose a reason for hiding this comment

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

This used to pass in host as url, now it pre-processes this. Is this a breaking change?

Copy link
Member Author

Choose a reason for hiding this comment

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

Not a breaking change

Used to be IP and the lib defaulted to http. Now the lib accepts a URL as well to support https

What do we prefer in hass config?

  • host (as IP/hostname) and ssl (as boolean)
  • url as string

Copy link
Member

Choose a reason for hiding this comment

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

Either is fine.

Why would you not always use SSL ?

Copy link
Member Author

Choose a reason for hiding this comment

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

SSL is not supported by my model afaik

Copy link
Member

Choose a reason for hiding this comment

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

Is there a way of detecting?

@balloob
Copy link
Member

balloob commented Feb 13, 2018

Ok to merge. If we can do better in detecting SSL, that would be awesome. That way our users don't have to figure out if their device supports SSL.

@kellerza
Copy link
Member Author

I can look at that as a possible enhancement. Probably SSL and fall back to http, or try something fancy with parallel requests. I'll wait with the documentation a bit and see if this is possible

@kellerza kellerza merged commit 5995c2f into home-assistant:dev Feb 13, 2018
@kellerza kellerza deleted the sma-sensor branch February 13, 2018 20:04
@balloob balloob mentioned this pull request Feb 22, 2018
@home-assistant home-assistant locked and limited conversation to collaborators May 29, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
cla-signed integration: sma small-pr PRs with less than 30 lines.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants