Skip to content

Add niko-home-control support#18019

Merged
fabaff merged 4 commits intohome-assistant:devfrom
legovaer:feature/niko-home-control
Nov 12, 2018
Merged

Add niko-home-control support#18019
fabaff merged 4 commits intohome-assistant:devfrom
legovaer:feature/niko-home-control

Conversation

@legovaer
Copy link
Copy Markdown
Contributor

Description:

This is a follow-up PR for #13755

Add support for niko-home-control

Pull request in home-assistant.github.io with documentation (if applicable): home-assistant/home-assistant.io#5137

Example entry for configuration.yaml (if applicable):

light:
  - platform: niko_home_control
    host: 192.168.1.123

Checklist:

  • The code change is tested and works locally.
  • Local tests pass with tox. Your PR cannot be merged unless tests pass

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

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

  • New dependencies have been added to the REQUIREMENTS variable ([example][ex-requir]).
  • New dependencies are only imported inside functions that use them ([example][ex-import]).
  • New or updated dependencies have been added to requirements_all.txt by running script/gen_requirements_all.py.
  • New files were added to .coveragerc.

@homeassistant

This comment has been minimized.

@legovaer legovaer force-pushed the feature/niko-home-control branch from b2b2ee0 to 9eb0b80 Compare October 30, 2018 17:58
@homeassistant
Copy link
Copy Markdown
Contributor

Hi @legovaer,

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!

@legovaer legovaer force-pushed the feature/niko-home-control branch from 9eb0b80 to e90870e Compare October 30, 2018 18:00
@ghost ghost assigned fabaff Nov 12, 2018
Copy link
Copy Markdown
Member

@fabaff fabaff left a comment

Choose a reason for hiding this comment

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

Thanks 🐦

Please update the documentation as the current state is from April

@fabaff fabaff merged commit 15c77fe into home-assistant:dev Nov 12, 2018
@ghost ghost removed the in progress label Nov 12, 2018
'timeout': 20000,
'events': True
})
except socket.error as err:
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Socket error is deprecated in favor of OSError in modern versions of Python 3.

})


def setup_platform(hass, config, add_devices, discovery_info=None):
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We have renamed add_devices to add_entities.

"""Set up the Niko Home Control light platform."""
import nikohomecontrol

host = config.get(CONF_HOST)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Use dict[key] for required config keys.

"""Instruct the light to turn on."""
self._light.brightness = kwargs.get(ATTR_BRIGHTNESS, 255)
self._light.turn_on()
self._state = True
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This will be updated by self.update in the end of the service call.

@property
def brightness(self):
"""Return the brightness of the light."""
return self._brightness
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Where is this updated?

def turn_off(self, **kwargs):
"""Instruct the light to turn off."""
self._light.turn_off()
self._state = False
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

See above.

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.

6 participants