'Request handler.'

@callback
def get(self, request, host):

    hass = request.app['hass']
    data = request.query
    (states, consumptions, cumulated_consumptions, start_dates) = ([], [], [], [])
    for i in range(1, 5):
        out = ('output%d' % i)
        states.append((data.get(('%s_state' % out)) == STATE_ON))
        consumptions.append(float(data.get(('%s_consumption' % out), 0)))
        cumulated_consumptions.append((float(data.get(('%s_cumulatedConsumption' % out), 0)) / 1000))
        start_dates.append(data.get(('%s_consumptionStart' % out), ''))
    _LOGGER.debug('%s:    %s,    %s,    %s    since    %s', host, states, consumptions, cumulated_consumptions, start_dates)
    ndev = DEVICES[host].netio
    ndev.consumptions = consumptions
    ndev.cumulated_consumptions = cumulated_consumptions
    ndev.states = states
    ndev.start_dates = start_dates
    for dev in DEVICES[host].entities:
        hass.async_add_job(dev.async_update_ha_state())
    return self.json(True)
