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

Add EBox sensor component #5135

Closed
wants to merge 1 commit into from
Closed

Conversation

titilambert
Copy link
Contributor

@titilambert titilambert commented Jan 1, 2017

Description:
Add EBox sensor component.
EBox is an Internet provider in Canada.
This component uses https://client.ebox.ca
Note: This component will be updated once EBox releases their rest API

Pull request in home-assistant.github.io with documentation : home-assistant/home-assistant.io#1694

Example entry for configuration.yaml (if applicable):

sensor:
  - platform: ebox
    username: USERNAME
    password: PASSWORD
    monitored_variables:
     - before_offpeak_download
     - before_offpeak_upload
     - before_offpeak_total
     - offpeak_download
     - offpeak_upload
     - offpeak_total
     - download
     - upload
     - total
     - balance
     - limit
     - usage

Checklist:

  • Documentation added/updated in home-assistant.github.io
  • 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.

@mention-bot
Copy link

@titilambert, thanks for your PR! By analyzing the history of the files in this pull request, we identified @balloob, @fabaff and @rmkraus to be potential reviewers.

usage_data = {}
# Get data
for key, index in USAGE_MAP.items():
usage_data[key] = abs(float(span_list[index].text.strip().split()[0]))

Choose a reason for hiding this comment

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

line too long (82 > 79 characters)

return False
# Get percent
try:
home_data["usage"] = float(soup.find("div", {"id": "circleprogress_0"}).\

Choose a reason for hiding this comment

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

line too long (85 > 79 characters)
the backslash is redundant between brackets

return False
# Get balance
try:
home_data["balance"] = float(soup.find("div", {"class": "text_amount"}).text.split()[0])

Choose a reason for hiding this comment

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

line too long (100 > 79 characters)

"upload": 7,
"total": 8}

def setup_platform(hass, config, add_devices, discovery_info=None):

Choose a reason for hiding this comment

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

expected 2 blank lines, found 1


_LOGGER = logging.getLogger(__name__)

GIGABITS = "Gb" # type: str

Choose a reason for hiding this comment

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

at least two spaces before inline comment

@titilambert titilambert changed the title Add EBox sensor component [WIP] Add EBox sensor component Jan 3, 2017
@titilambert titilambert changed the title [WIP] Add EBox sensor component Add EBox sensor component Jan 3, 2017
self._state = round(self.ebox_data.data[self.type], 2)


class EBoxData(object):
Copy link
Member

Choose a reason for hiding this comment

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

This platform contains too much protocol specific details. Please extract into a 3rd party lib and base it upon that.

@balloob
Copy link
Member

balloob commented Jan 24, 2017

I'll close this for now. Please reopen when extracted as third party lib and updated the code.

@balloob balloob closed this Jan 24, 2017
@home-assistant home-assistant locked and limited conversation to collaborators Apr 30, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants