From 0c5564ef624b87880f505531ecd039bfc1d7f93c Mon Sep 17 00:00:00 2001 From: BigNocciolino Date: Thu, 10 Mar 2022 15:33:56 +0100 Subject: [PATCH 1/4] fixed: unload entity error --- custom_components/cryptostate/__init__.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/custom_components/cryptostate/__init__.py b/custom_components/cryptostate/__init__.py index cef10b6..5b4f299 100644 --- a/custom_components/cryptostate/__init__.py +++ b/custom_components/cryptostate/__init__.py @@ -71,9 +71,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 asyncio.gather( - [hass.config_entries.async_forward_entry_unload(entry, "sensor")] - ) + unloaded = await hass.config_entries.async_unload_platforms(entry, "sensor") if unloaded: hass.data[DOMAIN].pop(entry.entry_id) From c3231c75aaa4487bb285aede1b03404c3586e6f6 Mon Sep 17 00:00:00 2001 From: BigNocciolino Date: Thu, 10 Mar 2022 18:58:32 +0100 Subject: [PATCH 2/4] added config for pylint --- custom_components/cryptostate/config_flow.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/custom_components/cryptostate/config_flow.py b/custom_components/cryptostate/config_flow.py index 327e021..f1fbdfa 100644 --- a/custom_components/cryptostate/config_flow.py +++ b/custom_components/cryptostate/config_flow.py @@ -1,12 +1,11 @@ -from email.policy import default -from homeassistant import config_entries +"""Config flow for cryptotracker""" from homeassistant.core import callback -import voluptuous as vol - +from homeassistant import config_entries from homeassistant.helpers.aiohttp_client import async_create_clientsession -from .const import DOMAIN, CONF_BASE, CONF_CRYPTO, DEFAULT_NAME +from .const import DOMAIN, CONF_BASE, CONF_CRYPTO from homeassistant.const import CONF_NAME from .api import CryptoTrackerApiClient +import voluptuous as vol class CryptoTrackerConfigFlow(config_entries.ConfigFlow, domain=DOMAIN): @@ -68,6 +67,6 @@ async def _test_credentials(self, crypto, base): else: self._errors[CONF_CRYPTO] = "invalid_crypto" return False - except Exception: + except Exception: # pylint: disable=broad-except pass - return False + return False \ No newline at end of file From ca8c29d016421ea69370f0eb816145aa69bae712 Mon Sep 17 00:00:00 2001 From: BigNocciolino Date: Mon, 14 Mar 2022 16:28:42 +0100 Subject: [PATCH 3/4] added info for moving from v1.0 --- README.md | 32 ++++++++++++++++++++++++++------ 1 file changed, 26 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 9684c7a..e6b779d 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ 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 +**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) ## Features @@ -20,22 +20,42 @@ Go to `Configuration` => `Devices & Services` => `+ Add Integration` => `Cryptos **Note:** To add multiple sensors you need to repeat the previous instructions. -## Setup +## 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 +### My configuration -Sience the api update itself every day i suggest to use the built in `Statistic graph` card. +Sience the api update itself every day i suggest to use the built in [Statistic graph](https://www.home-assistant.io/lovelace/statistics-graph/) card. **Example:** ![Example](https://github.com/PepegaBruh/CryptoTracker/blob/main/images/long_term_example.png?raw=true) -## Information +## 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 +## Moving from the config file + +Moving from the config fil to the UI is really simple, first of all you need to look all the `-compare:` options in your sensor configuration in the yaml. + +``` yaml +sensor: +- platform: cryptostate + resources: + # This will gi in the (Crypto ticker) - (Base ticker) section UI. + - compare: doge-eur + # This will go in the (Name) section of the UI + name: dogecoin +``` + +This up here can be an example of configuration, to move this to the UI we need to take the `Crypto ticker`, the `Base ticker` and the `Name`. + +- `Crypto ticker` => `doge` +- `Base ticker` => `eur` +- `Name` => `dogecoin` + +## Credit - Special thanks to [fawazahmed0](https://github.com/fawazahmed0/currency-api), consider to star his project From cfb32373e89005f6b2296d597ae673e0542a8e02 Mon Sep 17 00:00:00 2001 From: BigNocciolino Date: Tue, 15 Mar 2022 17:12:29 +0100 Subject: [PATCH 4/4] updated readme --- README.md | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index e6b779d..6de87e3 100644 --- a/README.md +++ b/README.md @@ -14,16 +14,18 @@ Component for tracking data generated by the API created by [fawazahmed0](https: ## Installation -The component is available in the hacs store, you only need to search it and after you can configure it from IU. +This integration is distributed using [HACS](https://hacs.xyz/) -Go to `Configuration` => `Devices & Services` => `+ Add Integration` => `Cryptostate`. +After installing it go to `Configuration` => `Devices & Services` => `+ Add Integration` and search for `Cryptostate`. -**Note:** To add multiple sensors you need to repeat the previous instructions. +**Note:** To add multiple sensors you need add multiple instaces of the sensor. ## 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) +To get a full list of available currencies visit this [page](https://cdn.jsdelivr.net/gh/fawazahmed0/currency-api@1/latest/currencies.json). + ### My configuration Sience the api update itself every day i suggest to use the built in [Statistic graph](https://www.home-assistant.io/lovelace/statistics-graph/) card. @@ -32,10 +34,6 @@ Sience the api update itself every day i suggest to use the built in [Statistic ![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). - ## Moving from the config file Moving from the config fil to the UI is really simple, first of all you need to look all the `-compare:` options in your sensor configuration in the yaml.