'Update the device entity state to match the arguments.'

def _update_model(self, new_state, data):

    if new_state:
        brightness = data
        if (brightness is not None):
            self._brightness = brightness
        try:
            self._state = (self._brightness > 0)
        except AttributeError:
            self._state = True
    else:
        self._state = False
