public static IHomeAssistantMqttConfigurationBuilder AddBinarySensor( this IHomeAssistantMqttConfigurationBuilder configurationBuilder, Func <IBinarySensorMqttEntityConfigurationBuilder, IBinarySensorMqttEntityConfigurationBuilder> configurator) { IBinarySensorMqttEntityConfigurationBuilder builder = new BinarySensorMqttEntityConfigurationBuilder(); builder = configurator(builder); configurationBuilder.ServiceCollection.AddSingleton(sp => { var entityConfiguration = builder.Build(); return(entityConfiguration); }); return(configurationBuilder); }
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); }