def setup_platform(hass, config, add_devices, discovery_info=None):
 import pyowm
 longitude = config.get(CONF_LONGITUDE, round(hass.config.longitude, 5))
 latitude = config.get(CONF_LATITUDE, round(hass.config.latitude, 5))
 name = config.get(CONF_NAME)
 try:
  owm = pyowm.OWM(config.get(CONF_API_KEY))
 except pyowm.exceptions.api_call_error.APICallError:
  _LOGGER.error('Error while connecting to OpenWeatherMap')
  return False
 data = WeatherData(owm, latitude, longitude)
 add_devices([OpenWeatherMapWeather(name, data, hass.config.units.temperature_unit)], True)

def setup_platform ( hass , config , add_devices , discovery_info = None ) : import pyowm longitude = config . get ( CONF_LONGITUDE , round ( hass . config . longitude , 5 ) ) latitude = config . get ( CONF_LATITUDE , round ( hass . config . latitude , 5 ) ) name = config . get ( CONF_NAME ) try : owm = pyowm . OWM ( config . get ( CONF_API_KEY ) ) except pyowm . exceptions . api_call_error . APICallError : _LOGGER . error ( 'Error while connecting to OpenWeatherMap' ) return False data = WeatherData ( owm , latitude , longitude ) add_devices ( [ OpenWeatherMapWeather ( name , data , hass . config . units . temperature_unit ) ] , True )
set up the hydroquebec sensor .