api_secret = config.get(CONF_API_SECRET)
sensor_id = config.get(CONF_SENSOR_ID)
data = NeurioData(api_key, api_secret, sensor_id)
@Throttle(MIN_TIME_BETWEEN_DAILY_UPDATES)
def update_daily():
Update the daily power usage.
data.get_daily_usage()
@Throttle(MIN_TIME_BETWEEN_ACTIVE_UPDATES)
def update_active():
Update the active power usage.
data.get_active_power()
update_daily()
update_active()
// Active power sensor
add_devices([NeurioEnergy(data, ACTIVE_NAME, ACTIVE_TYPE, update_active)])
// Daily power sensor
add_devices([NeurioEnergy(data, DAILY_NAME, DAILY_TYPE, update_daily)])
class NeurioData(object):
Stores data retrieved from Neurio sensor.