def refresh(self):
        """Refresh a device"""
        # new_device = {}
        if self.type in CONST.BINARY_SENSOR_TYPES:
            response = self._lupusec.get_sensors()
            for device in response:
                if device['device_id'] == self._device_id:
                    self.update(device)

            return device

        elif self.type == CONST.ALARM_TYPE:
            response = self._lupusec.get_panel()
            self.update(response)
            return response
        
        elif self.type == CONST.TYPE_POWER_SWITCH:
            response = self._lupusec.get_power_switches()
            for pss in response:
                if pss['device_id'] == self._device_id:
                    self.update(pss)
            return pss
def refresh ( self ) : if self . type in CONST . BINARY_SENSOR_TYPES : response = self . _lupusec . get_sensors ( ) for device in response : if device [ 'device_id' ] == self . _device_id : self . update ( device ) return device elif self . type == CONST . ALARM_TYPE : response = self . _lupusec . get_panel ( ) self . update ( response ) return response elif self . type == CONST . TYPE_POWER_SWITCH : response = self . _lupusec . get_power_switches ( ) for pss in response : if pss [ 'device_id' ] == self . _device_id : self . update ( pss ) return pss
Refresh a device