parameters: (self)
docstring: Reload the commands
docstring_summary: Reload the commands
docstring_tokens: Reload the commands
function: def _reload_xpl_stats(self):
          """ Reload the commands
          """
          with self._stats_lock:
              self.log.info("Event : one device changed. Reloading data for xpl stats")
              self.all_xpl_stats = {}
              with self._db.session_scope():
                  for xplstat in self._db.get_all_xpl_stat():
                      #print(xplstat)
                      #print(xplstat.params)
                      # <XplStat: name='Open/Close sensor', json_id='open_close', device_id='95', id='185', schema='ac.basic'>
                      # <XplStatParam: xplstat_id='188', multiple='None', value='None', ignore_values='', sensor_id='411', static='False', key='current', type='None'>
                      a_xplstat = {'name' : xplstat.name,
                                   'json_id' : xplstat.json_id,
                                   'device_id' : xplstat.device_id,
                                   'id' : xplstat.id,
                                   'schema' : xplstat.schema,
                                   'params' : []
                                  }
                      for a_xplstat_param in xplstat.params:
                          a_xplstat['params'].append({
                                                       'xplstat_id' : a_xplstat_param.xplstat_id,
                                                       'multiple' : a_xplstat_param.multiple,
                                                       'value' : a_xplstat_param.value,
                                                       'ignore_values' : a_xplstat_param.ignore_values,
                                                       'sensor_id' : a_xplstat_param.sensor_id,
                                                       'static' : a_xplstat_param.static,
                                                       'key' : a_xplstat_param.key,
                                                       'type' : a_xplstat_param.type
                                                     })
  
                      self.all_xpl_stats[str(xplstat.id)] = a_xplstat
                  #print(self.all_xpl_stats)
  
              self.log.info("Event : one device changed. Reloading data for xpl stats -- finished")
function_tokens: def _reload_xpl_stats ( self ) : with self . _stats_lock : self . log . info ( "Event : one device changed. Reloading data for xpl stats" ) self . all_xpl_stats = { } with self . _db . session_scope ( ) : for xplstat in self . _db . get_all_xpl_stat ( ) : #print(xplstat) #print(xplstat.params) # <XplStat: name='Open/Close sensor', json_id='open_close', device_id='95', id='185', schema='ac.basic'> # <XplStatParam: xplstat_id='188', multiple='None', value='None', ignore_values='', sensor_id='411', static='False', key='current', type='None'> a_xplstat = { 'name' : xplstat . name , 'json_id' : xplstat . json_id , 'device_id' : xplstat . device_id , 'id' : xplstat . id , 'schema' : xplstat . schema , 'params' : [ ] } for a_xplstat_param in xplstat . params : a_xplstat [ 'params' ] . append ( { 'xplstat_id' : a_xplstat_param . xplstat_id , 'multiple' : a_xplstat_param . multiple , 'value' : a_xplstat_param . value , 'ignore_values' : a_xplstat_param . ignore_values , 'sensor_id' : a_xplstat_param . sensor_id , 'static' : a_xplstat_param . static , 'key' : a_xplstat_param . key , 'type' : a_xplstat_param . type } ) self . all_xpl_stats [ str ( xplstat . id ) ] = a_xplstat #print(self.all_xpl_stats) self . log . info ( "Event : one device changed. Reloading data for xpl stats -- finished" )