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 support for Fixer.io #2336

Merged
merged 2 commits into from
Jun 21, 2016
Merged

Add support for Fixer.io #2336

merged 2 commits into from
Jun 21, 2016

Conversation

fabaff
Copy link
Member

@fabaff fabaff commented Jun 20, 2016

Description:
There seems to be a demand for exchange rate sensors (eg. Currencylayer and #2310). Fixer.io doesn't require an API key and allows unlimited requests (for now).

Related issue (if applicable): fixes #

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

Example entry for configuration.yaml (if applicable):

sensor:
  - platform: fixer
    name: EUR
    base: EUR
    target: CHF

Checklist:

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

If code communicates with devices:

  • 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.

If the code does not interact with devices:

  • Local tests with tox run successfully. Your PR cannot be merged unless tests pass
  • Tests have been added to verify that the new code works.

self.data.update()
self._state = round(self.data.rate['rates'][self._target], 3)

class ExchangeData(object):

Choose a reason for hiding this comment

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

farcy v1.1

  • 1: E302 expected 2 blank lines, found 1

@arsaboo
Copy link
Contributor

arsaboo commented Jun 20, 2016

It's amazing that you can accomplish this in less than an hour and I spent days getting nowhere with it :)

BTW, Fixer updates the currencies only once a day. Whereas the others (Currencylayer and Openexchangerates) update their rates hourly. It will be nice if can you take the code that I have for the other two sensors and create the components for them (I wish I knew how to get the tox thing working). I will be happy to create the documentation for the same.

@fabaff
Copy link
Member Author

fabaff commented Jun 20, 2016

It's true that fixer.io is not the best source if you want to follow the trend of exchange rates closely.



# pylint: disable=too-few-public-methods
class ExchangeRateSensor(Entity):
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't unit_of_measurement be self._target ? That way you can get a graph

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, it should

@balloob balloob merged commit 278514b into home-assistant:dev Jun 21, 2016
@balloob
Copy link
Member

balloob commented Jun 21, 2016

🐬

@fabaff fabaff deleted the fixer.io branch June 22, 2016 12:07
@home-assistant home-assistant locked and limited conversation to collaborators Mar 17, 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.

4 participants