diff --git a/README.md b/README.md index 6de87e3..e0ee5c7 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ [![hacs_badge](https://img.shields.io/badge/HACS-Default-orange.svg?style=for-the-badge)](https://github.com/custom-components/hacs) # CryptoTracker -Component for tracking data generated by the API created by [fawazahmed0](https://github.com/fawazahmed0/currency-api). Which provides updated data every 24 hours, with a coverage of 150+ cryptocurrencies. +Component for tracking data generated by the API created by [fawazahmed0](https://github.com/fawazahmed0/exchange-api). Which provides updated data every 24 hours, with a coverage of 150+ cryptocurrencies. **Note:** For those who have the component already configured from the config file, it will no longer work. Now it can only be configured from UI. [See this section](#moving-from-the-config-file) @@ -24,7 +24,7 @@ After installing it go to `Configuration` => `Devices & Services` => `+ Add Inte Now the component can be configured from the graphical interface, setting the value of `crypto` and the value of `base` (i.e. the value with which we want to convert crypto) -To get a full list of available currencies visit this [page](https://cdn.jsdelivr.net/gh/fawazahmed0/currency-api@1/latest/currencies.json). +To get a full list of available currencies visit this [page](https://cdn.jsdelivr.net/npm/@fawazahmed0/currency-api@latest/v1/currencies.json). ### My configuration diff --git a/custom_components/cryptostate/__init__.py b/custom_components/cryptostate/__init__.py index ee5b266..e891aa8 100644 --- a/custom_components/cryptostate/__init__.py +++ b/custom_components/cryptostate/__init__.py @@ -1,9 +1,12 @@ """Crypto tracking.""" + from datetime import timedelta import logging from homeassistant.config_entries import ConfigEntry -from homeassistant.core import Config, HomeAssistant +from homeassistant.const import Platform +from homeassistant.core import HomeAssistant +from homeassistant.helpers.typing import ConfigType from homeassistant.exceptions import ConfigEntryNotReady from homeassistant.helpers.aiohttp_client import async_get_clientsession from homeassistant.helpers.update_coordinator import DataUpdateCoordinator, UpdateFailed @@ -14,9 +17,12 @@ SCAN_INTERVAL = timedelta(hours=3) _LOGGER: logging.Logger = logging.getLogger(__package__) -PLATFORMS = ["sensor"] +PLATFORMS: list[Platform] = [ + Platform.SENSOR, +] + -async def async_setup(hass: HomeAssistant, config: Config): +async def async_setup(hass: HomeAssistant, config: ConfigType): """Set this integration using YAML is not supported.""" return True @@ -70,7 +76,7 @@ async def _async_update_data(self): async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: """Handle removal of an entry.""" # coordinator = hass.data[DOMAIN][entry.entry_id] - unloaded = await hass.config_entries.async_unload_platforms(entry, "sensor") + unloaded = await hass.config_entries.async_unload_platforms(entry, PLATFORMS) if unloaded: hass.data[DOMAIN].pop(entry.entry_id) diff --git a/custom_components/cryptostate/const.py b/custom_components/cryptostate/const.py index f3cac58..3f00cc5 100644 --- a/custom_components/cryptostate/const.py +++ b/custom_components/cryptostate/const.py @@ -5,7 +5,7 @@ NAME = "Crypto Tracker" DOMAIN = "cryptostate" -VERSION = "2.0.0" +VERSION = "2.1.2" ATTRIBUTION = "Data provided by https://github.com/fawazahmed0/currency-api#readme API" ICON = "mdi:cash-multiple" diff --git a/custom_components/cryptostate/manifest.json b/custom_components/cryptostate/manifest.json index 386c061..904701b 100644 --- a/custom_components/cryptostate/manifest.json +++ b/custom_components/cryptostate/manifest.json @@ -8,5 +8,5 @@ "requirements": [], "config_flow": true, "iot_class": "local_polling", - "version": "2.1.0" + "version": "2.1.2" } diff --git a/info.md b/info.md deleted file mode 100644 index 9684c7a..0000000 --- a/info.md +++ /dev/null @@ -1,41 +0,0 @@ -[![GitHub Activity](https://img.shields.io/github/commit-activity/y/PepegaBruh/Cryptotracker?style=for-the-badge)](https://github.com/PepegaBruh/CryptoTracker/commits/main) -[![hacs_badge](https://img.shields.io/badge/HACS-Default-orange.svg?style=for-the-badge)](https://github.com/custom-components/hacs) -# CryptoTracker - -Component for tracking data generated by the API created by [fawazahmed0](https://github.com/fawazahmed0/currency-api). Which provides updated data every 24 hours, with a coverage of 150+ cryptocurrencies. - -**Note:** For those who have the component already configured from the config file, it will no longer work. Now it can only be configured from UI - -## Features - -- UI setup -- 150+ more currencies -- Update every 12 hours - -## Installation - -The component is available in the hacs store, you only need to search it and after you can configure it from IU. - -Go to `Configuration` => `Devices & Services` => `+ Add Integration` => `Cryptostate`. - -**Note:** To add multiple sensors you need to repeat the previous instructions. - -## Setup - -Now the component can be configured from the graphical interface, setting the value of `crypto` and the value of `base` (i.e. the value with which we want to convert crypto) - -### My configuration - -Sience the api update itself every day i suggest to use the built in `Statistic graph` card. - -**Example:** - -![Example](https://github.com/PepegaBruh/CryptoTracker/blob/main/images/long_term_example.png?raw=true) - -## Information - -To get a full list of available currencies visit this [page](https://cdn.jsdelivr.net/gh/fawazahmed0/currency-api@1/latest/currencies.json). - -## Credit - -- Special thanks to [fawazahmed0](https://github.com/fawazahmed0/currency-api), consider to star his project