Exemplo n.º 1
0
        public static IHomeAssistantMqttConfigurationBuilder AddAlarmControlPanel(
            this IHomeAssistantMqttConfigurationBuilder configurationBuilder,
            IAlarmControlPanelMqttEntityConfiguration mqttEntityConfiguration)
        {
            configurationBuilder.TryRegisterStatefulEntityBindingManager <IAlarmControlPanelMqttEntityConfiguration, IAlarmControlPanel, IAlarmControlPanelEntityDefinition>();

            configurationBuilder.ServiceCollection.AddSingleton(mqttEntityConfiguration);
            return(configurationBuilder);
        }
Exemplo n.º 2
0
        public static IHomeAssistantMqttConfigurationBuilder AddBinarySensor(
            this IHomeAssistantMqttConfigurationBuilder configurationBuilder,
            IBinarySensorMqttEntityConfiguration mqttEntityConfiguration)
        {
            configurationBuilder.TryRegisterStatefulEntityBindingManager <IBinarySensorMqttEntityConfiguration, IBinarySensor, IBinarySensorEntityDefinition>();

            configurationBuilder.ServiceCollection.AddSingleton(mqttEntityConfiguration);
            return(configurationBuilder);
        }
Exemplo n.º 3
0
        public static IHomeAssistantMqttConfigurationBuilder AddBinarySensor(
            this IHomeAssistantMqttConfigurationBuilder configurationBuilder,
            Func <IBinarySensorMqttEntityConfigurationBuilder, IBinarySensorMqttEntityConfigurationBuilder> configurator)
        {
            configurationBuilder.TryRegisterStatefulEntityBindingManager <IBinarySensorMqttEntityConfiguration, IBinarySensor, IBinarySensorEntityDefinition>();

            IBinarySensorMqttEntityConfigurationBuilder builder = new BinarySensorMqttEntityConfigurationBuilder();

            builder = configurator(builder);

            configurationBuilder.ServiceCollection.AddSingleton(sp =>
            {
                var entityConfiguration = builder.Build();
                return(entityConfiguration);
            });

            return(configurationBuilder);
        }
Exemplo n.º 4
0
        public static IHomeAssistantMqttConfigurationBuilder AddAlarmControlPanel(
            this IHomeAssistantMqttConfigurationBuilder configurationBuilder,
            Func <IAlarmControlPanelMqttEntityConfigurationBuilder, IAlarmControlPanelMqttEntityConfigurationBuilder> configurator)
        {
            configurationBuilder.TryRegisterStatefulEntityBindingManager <IAlarmControlPanelMqttEntityConfiguration, IAlarmControlPanel, IAlarmControlPanelEntityDefinition>();

            IAlarmControlPanelMqttEntityConfigurationBuilder builder = new AlarmControlPanelMqttEntityConfigurationBuilder();

            builder = configurator(builder);

            configurationBuilder.ServiceCollection.AddSingleton(sp =>
            {
                IAlarmControlPanelMqttEntityConfiguration entityConfiguration = builder.Build();
                return(entityConfiguration);
            });

            return(configurationBuilder);
        }