_LOGGER.warning("Sensor ID auto-detected, set api_sensor_id: "%s"",
user_info["locations"][0]["sensors"][0]["sensorId"])
sensor_id = user_info["locations"][0]["sensors"][0]["sensorId"]
dev = []dev.append(NeurioEnergy(api_key, api_secret, sensor_id))add_devices(dev)
// pylint: disable=too-many-instance-attributes
class NeurioEnergy(Entity):
After Change
def setup_platform(hass, config, add_devices, discovery_info=None):
Setup the Neurio sensor.
name = config.get(CONF_NAME)
api_key = config.get(CONF_API_KEY)
api_secret = config.get(CONF_API_SECRET)
sensor_id = config.get(CONF_SENSOR_ID)
if not sensor_id:
import neurio
neurio_tp = neurio.TokenProvider(key=api_key, secret=api_secret)
neurio_client = neurio.Client(token_provider=neurio_tp)
user_info = neurio_client.get_user_information()
_LOGGER.warning("Sensor ID auto-detected, set api_sensor_id: "%s"",
user_info["locations"][0]["sensors"][0]["sensorId"])
sensor_id = user_info["locations"][0]["sensors"][0]["sensorId"]
add_devices([NeurioEnergy(api_key, api_secret, name, sensor_id)])
// pylint: disable=too-many-instance-attributes
class NeurioEnergy(Entity):