Example #1
0
 def post_config(self):
     """
     posts the config using the HAHQConfigPoster
     """
     config_poster = HAHQConfigPoster(
         config_file_path=self.config_file_path)
     config_poster.post_config(self.server_url, self.agent_token)
Example #2
0
 def post_config(self):
     """
     posts the config using the HAHQConfigPoster
     """
     config_poster = HAHQConfigPoster(config_file_path=self.config_file_path)
     config_poster.post_config(
         self.server_url,
         self.agent_token
     )
Example #3
0
    def get_config(self, client=None, userdata=None, msg=None):
        """
        retrieves the current config from the backend. In case the local config is newer than the one retrieved by the
        backend, the local config is pushed to the server.

        params are just dummies, so that this method can be called as an MQTT callback
        """
        config_getter = HAHQConfigGetter(self.server_url, self.agent_token,
                                         self.config_file_path)

        config_poster = HAHQConfigPoster(self.config_file_path)

        if config_getter.config_timestamp > config_poster.config_timestamp:
            if config_getter.config_data != config_poster.config_data:
                config_getter.save_config()
        else:
            if config_getter.config_data != config_poster.config_data:
                config_poster.post_config(self.server_url, self.agent_token)
Example #4
0
    def get_config(self, client=None, userdata=None, msg=None):
        """
        retrieves the current config from the backend. In case the local config is newer than the one retrieved by the
        backend, the local config is pushed to the server.

        params are just dummies, so that this method can be called as an MQTT callback
        """
        config_getter = HAHQConfigGetter(
            self.server_url,
            self.agent_token,
            self.config_file_path
        )

        config_poster = HAHQConfigPoster(self.config_file_path)

        if config_getter.config_timestamp > config_poster.config_timestamp:
            if config_getter.config_data != config_poster.config_data:
                config_getter.save_config()
        else:
            if config_getter.config_data != config_poster.config_data:
                config_poster.post_config(
                    self.server_url,
                    self.agent_token
                )