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

Proposal for Niko Home Control II #23105

Closed
wants to merge 5 commits into from
Closed

Proposal for Niko Home Control II #23105

wants to merge 5 commits into from

Conversation

filipvh
Copy link

@filipvh filipvh commented Apr 14, 2019

Breaking Change:

Nothing should break, but it's my first time writing something in python, so a good review would be gold. I am aware that not yet everything is in order, and i'll try to do what needs to be done.
Getting this all to work has been very tiresome as I've never written Python before.

Description:

Basic integration of Niko Home Control II (lights/switches)

Example entry for configuration.yaml (if applicable):

nhc2:
  host: '192.168.0.2'
  port: 8883
  username: 'abcdefgh-ijkl-mnop-qrst-uvwxyz012345'
  password: !secret nhc2_password

Checklist:

  • The code change is tested and works locally.
  • Local tests pass with tox. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.

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

  • Documentation added/updated in home-assistant.io
    Not yet new to this, will have to see how.

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

  • The manifest file has all fields filled out correctly (example).
  • New dependencies have been added to requirements in the manifest (example).
  • New dependencies are only imported inside functions that use them (example).
  • New or updated dependencies have been added to requirements_all.txt by running script/gen_requirements_all.py.
  • New files were added to .coveragerc.

If the code does not interact with devices:

  • Tests have been added to verify that the new code works.

@filipvh filipvh requested a review from a team as a code owner April 14, 2019 19:50
@homeassistant
Copy link
Contributor

Hi @filipvh,

It seems you haven't yet signed a CLA. Please do so here.

Once you do that we will be able to review and accept this pull request.

Thanks!

@awarecan
Copy link
Contributor

Thank you for your contribution. After a quick look, there are serval action items

  • Please do not add language json file other then en. Add your string resources to string.json then execute script/translate_develop.py. Other translation should be done in lokalise.co back end translation project. See https://developers.home-assistant.io/docs/en/internationalization_backend_localization.html

  • Please trim this PR to minimum viable product, i.e., limit to only one platform, you can choose the most simple one. That will help your pull request get quick review feedback.

@awarecan
Copy link
Contributor

What different this and the exists niko_home_control?

@filipvh
Copy link
Author

filipvh commented Apr 15, 2019

Hi @awarecan thanks for your comments/questions

What different this and the exists niko_home_control?

This is v2, that one is v1. While they have some compatibility when it comes to hardware, on the software/network side, they are different. So is the communication.
(see Can I upgrade an existing Niko Home Control installation?)

Please trim this PR to minimum viable product, i.e., limit to only one platform, you can choose the most simple one. That will help your pull request get quick review feedback.

As it stands now, light and switch are pretty much identical. If this doesn't matter, I'll remove one...

Please do not add language json file other then en. Add your string resources to string.json then execute script/translate_develop.py ...

I'll try to look at that asap.

@balloob
Copy link
Member

balloob commented Apr 15, 2019

We should not add a new integration for a new version. Please merge this with the other integration . Once you establish a connection you can see which API is in use and pick the appropriate lib and files to use

@filipvh
Copy link
Author

filipvh commented Apr 15, 2019

We should not add a new integration for a new version. Please merge this with the other integration . Once you establish a connection you can see which API is in use and pick the appropriate lib and files to use

@balloob
The connection itself is also a different protocol. The Home Control II runs it own MQTT Broker, while the previous version has nothing of the sort.
The discovery is different, the protocol is different, the APIs are different. It's like angularjs and angular, but the name, they are nothing the same.

I understand that this would be preferred, but I don't know enough about HA how and if we can/want to do this. The config would probably be different, as now it's basic, but the steps that would be added to a more complete integration, would require different flows for different systems.

async def async_setup_entry(hass, config_entry, async_add_entities):
"""Load NHC2 lights based on a config entry."""
hass.data.setdefault(KEY_ENTITY, {})[config_entry.entry_id] = []
gateway: CoCo = hass.data[KEY_GATEWAY][config_entry.entry_id]
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think this is valid syntax. If it is however, what is it supposed to do?

Copy link
Member

Choose a reason for hiding this comment

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

This is Python 3.6 typing syntax, we support a minimum of python 3.5.3

Copy link
Author

@filipvh filipvh Apr 17, 2019

Choose a reason for hiding this comment

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

Will look at those this weekend, thx!

async def async_setup_entry(hass, config_entry, async_add_entities):
"""Load NHC2 switches based on a config entry."""
hass.data.setdefault(KEY_ENTITY, {})[config_entry.entry_id] = []
gateway: CoCo = hass.data[KEY_GATEWAY][config_entry.entry_id]
Copy link
Contributor

Choose a reason for hiding this comment

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

Same thing here.

@@ -1,28 +1,13 @@
{
"config": {
"abort": {
"already_configured": "UPnP/IGD is already configured",
Copy link
Contributor

Choose a reason for hiding this comment

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

Why are parts of this file, and some others, changed? It seems unrelated to your other changes.

@MartinHjelmare
Copy link
Member

This PR has gone stale. I'll close it now. Please open a new PR when ready to finish.

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

Successfully merging this pull request may close these issues.

None yet

6 participants