예제 #1
0
        protected AutomationBase(AutomationId id)
        {
            if (id == null)
            {
                throw new ArgumentNullException(nameof(id));
            }

            Id       = id;
            Settings = new SettingsContainer(StoragePath.WithFilename("Automations", id.Value, "Settings.json"));
            GeneralSettingsWrapper = new AutomationSettingsWrapper(Settings);
        }
예제 #2
0
        protected ComponentBase(ComponentId id)
        {
            if (id == null)
            {
                throw new ArgumentNullException(nameof(id));
            }

            Id = id;

            Settings = new SettingsContainer(StoragePath.WithFilename("Components", id.Value, "Settings.json"));
            GeneralSettingsWrapper = new ComponentSettingsWrapper(Settings);
        }
        public SynonymServiceStorage()
        {
            var rootPath = StoragePath.WithFilename("Services", "SynonymService");

            if (!Directory.Exists(rootPath))
            {
                Directory.CreateDirectory(rootPath);
            }

            _areaSynonymsFilename           = Path.Combine(rootPath, "Areas.json");
            _componentSynonymsFilename      = Path.Combine(rootPath, "Components.json");
            _componentStateSynonymsFilename = Path.Combine(rootPath, "ComponentStates.json");
        }
        public ComponentStateHistoryTracker(IComponent component)
        {
            if (component == null)
            {
                throw new ArgumentNullException(nameof(component));
            }

            _component = component;

            _filename = StoragePath.WithFilename("Components", component.Id.Value, "History.csv");
            StoragePath.EnsureDirectoryExists(_filename);

            component.StateChanged += CreateDataPointAsync;
        }
예제 #5
0
        public static bool TryCreateFromDefaultConfigurationFile(out TelegramBotService telegramBotService)
        {
            string filename = StoragePath.WithFilename("TelegramBotConfiguration.json");

            return(TryCreateFromConfigurationFile(filename, out telegramBotService));
        }
예제 #6
0
 private static string GenerateFilename(ActuatorId actuatorId)
 {
     return(StoragePath.WithFilename("Actuators", actuatorId.Value, "Configuration.json"));
 }