Help with a currency exchange rate sensor

I wanted to learn how to develop for HA so I started working on an exchange rate sensor that would read the current exchange rates from Openexchagerates (or a similar).

Here’s the URL that can be used:

The URL includes the base currency (which is USD) and the API-key (this is a working key for you all to test). The output looks like

I created the following entry in the configuration.yaml

sensor 2:
  platform: currency
  api_key: 37cd8756cd4848579956d31835b4f7ee
  base: USD
  quote: INR

And following all the resources that I could understand, I wrote a simple custom component that I was hoping will return 66.620737 (which is the value on row 73 in the output corresponding to the USDINR exchange rate). Clearly, I did not get too far with my first attempt. Here’s what I have so far based on @kellbot’s wundergound sensor, but I cannot get it to return the value as the state.

I am hoping someone will be able to guide me on this.

You never call update() on the data object and neither do you override the state property in your sensor to return the data.

Thanks @balloob! I updated the sensor and it returns the desired value now - Super Excited !!

Here’s the updated script if someone wants to use I will learn how to upload it on Github.

Just one more question. Right now, I have hardcoded the quote currency in the code (line 31). How do I modify it so that it can use the quote currency provided in the config? I tried return self.currency[quote] and return self.currency[CONF_QUOTE], but both give an errors.