def main(): with aiohttp.ClientSession() as session: api = ChainSo('LTC', 'M9m37h3dVkLDS13wYK7vcs7ck6MMMX6yhK', loop, session) yield from api.async_get_data() # Print the data for key, value in api.data.items(): print("{}: {}".format(key, value))
def async_setup_platform(hass, config, async_add_devices, discovery_info=None): """Set up the sochain sensors.""" from pysochain import ChainSo address = config.get(CONF_ADDRESS) network = config.get(CONF_NETWORK) name = config.get(CONF_NAME) session = async_get_clientsession(hass) chainso = ChainSo(network, address, hass.loop, session) async_add_devices([SochainSensor(name, network.upper(), chainso)], True)
async def async_setup_platform( hass: HomeAssistant, config: ConfigType, async_add_entities: AddEntitiesCallback, discovery_info: DiscoveryInfoType | None = None, ) -> None: """Set up the sochain sensors.""" address = config[CONF_ADDRESS] network = config[CONF_NETWORK] name = config[CONF_NAME] session = async_get_clientsession(hass) chainso = ChainSo(network, address, hass.loop, session) async_add_entities([SochainSensor(name, network.upper(), chainso)], True)