Exemple #1
0
 def _extract_one_button_set(self, p_config) -> dict:
     """ Extract the config info for one button.
     - Name: Button 1
       Comment: This is _test button 1
       Family:
          Name: Insteon
          Address: 11.44.33
       Dimmable: true  # Optional
       Room:
          Name: Living Room
     @param p_config: is the config fragment containing one button's information.
     @return: a ButtonInformation() obj filled in.
     """
     l_obj = CameraInformation()
     l_required = ['Name', 'Family']
     for l_key, l_value in p_config.items():
         if l_key == 'Family':
             l_obj.Family = familyConfig().load_family_config(l_value, self.m_pyhouse_obj)
         elif l_key == 'Room':
             l_obj.Room = roomConfig(self.m_pyhouse_obj).load_room_config(l_value)
             pass
         else:
             setattr(l_obj, l_key, l_value)
     # Check for required data missing from the config file.
     for l_key in [l_attr for l_attr in dir(l_obj) if not l_attr.startswith('_') and not callable(getattr(l_obj, l_attr))]:
         if getattr(l_obj, l_key) == None and l_key in l_required:
             LOG.warn('Location Yaml is missing an entry for "{}"'.format(l_key))
     # LOG.debug(PrettyFormatAny.form(l_obj, 'Button'))
     # LOG.debug(PrettyFormatAny.form(l_obj.Family, 'Button.Family'))
     return l_obj
Exemple #2
0
 def _extract_one_thermostat(self, p_config) -> dict:
     """ Extract the config info for one button.
     @param p_config: is the config fragment containing one button's information.
     @return: a ButtonInformation() obj filled in.
     """
     l_obj = ThermostatInformation()
     l_required = ['Name', 'Family']
     for l_key, l_value in p_config.items():
         if l_key == 'Family':
             l_obj.Family = familyConfig().load_family_config(l_value, self.m_pyhouse_obj)
         elif l_key == 'Room':
             l_obj.Room = roomConfig(self.m_pyhouse_obj).load_room_config(l_value)
             pass
         else:
             setattr(l_obj, l_key, l_value)
     # Check for required data missing from the config file.
     for l_key in [l_attr for l_attr in dir(l_obj) if not l_attr.startswith('_') and not callable(getattr(l_obj, l_attr))]:
         if getattr(l_obj, l_key) == None and l_key in l_required:
             LOG.warn('"{}" is missing an entry for "{}"'.format(CONFIG_FILE_NAME, l_key))
     # LOG.debug(PrettyFormatAny.form(l_obj, 'Button'))
     # LOG.debug(PrettyFormatAny.form(l_obj.Family, 'Button.Family'))
     return l_obj
Exemple #3
0
 def _extract_family(self, p_config):
     """
     """
     # LOG.debug('Extracting Family next')
     l_ret = familyConfig().load_family_config(p_config, self.m_pyhouse_obj)
     return l_ret
Exemple #4
0
 def _extract_family(self, p_config):
     """
     """
     l_ret = familyConfig().load_family_config(p_config, self.m_pyhouse_obj)
     return l_ret