hass-core/homeassistant/components/nightscout/utils.py
Marcio Granzotto Rodrigues 52a9921ed3
Nightscout PR fixes (#38737)
* Don't allow duplicate nightscout configs

* Fix nightscout translations

* Remove unnecessary should_poll method

* Remove SVG attribute, as it was duplicating the state

* Use aiohttp client session from HA

* Move validate_input outside the config class

* Use the entry unique_id on the sensor

* Move create entity logic

* Handle unexpected exception on Nightscout config
2020-08-13 07:46:07 -04:00

7 lines
180 B
Python

"""Nightscout util functions."""
import hashlib
def hash_from_url(url: str):
"""Hash url to create a unique ID."""
return hashlib.sha256(url.encode("utf-8")).hexdigest()