'Parse data sent by gateway.'

def parse_data(self, data):

    if (IN_USE in data):
        self._in_use = int(data[IN_USE])
        if (not self._in_use):
            self._load_power = 0
    if (POWER_CONSUMED in data):
        self._power_consumed = round(float(data[POWER_CONSUMED]), 2)
    if (LOAD_POWER in data):
        self._load_power = round(float(data[LOAD_POWER]), 2)
    value = data.get(self._data_key)
    if (value is None):
        return False
    state = (value == 'on')
    if (self._state == state):
        return False
    self._state = state
    return True
