1
0
mirror of https://github.com/esphome/esphome.git synced 2025-10-30 06:33:51 +00:00

Disable MQTT if not used (#373)

* Disable MQTT if not used

* Lint
This commit is contained in:
Otto Winter
2019-01-29 17:29:21 +01:00
committed by GitHub
parent 7b26ecc0dc
commit 176c712eeb
66 changed files with 389 additions and 530 deletions

View File

@@ -370,7 +370,7 @@ def build_effect(full_config):
raise NotImplementedError("Effect {} not implemented".format(next(config.keys())))
def setup_light_core_(light_var, mqtt_var, config):
def setup_light_core_(light_var, config):
if CONF_INTERNAL in config:
add(light_var.set_internal(config[CONF_INTERNAL]))
if CONF_DEFAULT_TRANSITION_LENGTH in config:
@@ -385,13 +385,12 @@ def setup_light_core_(light_var, mqtt_var, config):
if effects:
add(light_var.add_effects(ArrayInitializer(*effects)))
setup_mqtt_component(mqtt_var, config)
setup_mqtt_component(light_var.Pget_mqtt(), config)
def setup_light(light_obj, mqtt_obj, config):
def setup_light(light_obj, config):
light_var = Pvariable(config[CONF_ID], light_obj, has_side_effects=False)
mqtt_var = Pvariable(config[CONF_MQTT_ID], mqtt_obj, has_side_effects=False)
CORE.add_job(setup_light_core_, light_var, mqtt_var, config)
CORE.add_job(setup_light_core_, light_var, config)
BUILD_FLAGS = '-DUSE_LIGHT'

View File

@@ -19,7 +19,7 @@ def to_code(config):
yield
rhs = App.make_binary_light(config[CONF_NAME], output_)
light_struct = variable(config[CONF_MAKE_ID], rhs)
light.setup_light(light_struct.Pstate, light_struct.Pmqtt, config)
light.setup_light(light_struct.Pstate, config)
setup_component(light_struct.Pstate, config)

View File

@@ -33,7 +33,7 @@ def to_code(config):
config[CONF_WARM_WHITE_COLOR_TEMPERATURE],
cold_white, warm_white)
light_struct = variable(config[CONF_MAKE_ID], rhs)
light.setup_light(light_struct.Pstate, light_struct.Pmqtt, config)
light.setup_light(light_struct.Pstate, config)
setup_component(light_struct.Pstate, config)

View File

@@ -98,7 +98,7 @@ def to_code(config):
r, g, b = config[CONF_COLOR_CORRECT]
add(fast_led.set_correction(r, g, b))
light.setup_light(make.Pstate, make.Pmqtt, config)
light.setup_light(make.Pstate, config)
setup_component(fast_led, config)

View File

@@ -78,7 +78,7 @@ def to_code(config):
r, g, b = config[CONF_COLOR_CORRECT]
add(fast_led.set_correction(r, g, b))
light.setup_light(make.Pstate, make.Pmqtt, config)
light.setup_light(make.Pstate, config)
setup_component(fast_led, config)

View File

@@ -22,7 +22,7 @@ def to_code(config):
yield
rhs = App.make_monochromatic_light(config[CONF_NAME], output_)
light_struct = variable(config[CONF_MAKE_ID], rhs)
light.setup_light(light_struct.Pstate, light_struct.Pmqtt, config)
light.setup_light(light_struct.Pstate, config)
setup_component(light_struct.Pstate, config)

View File

@@ -156,7 +156,7 @@ def to_code(config):
if CONF_COLOR_CORRECT in config:
add(output.set_correction(*config[CONF_COLOR_CORRECT]))
light.setup_light(make.Pstate, make.Pmqtt, config)
light.setup_light(make.Pstate, config)
setup_component(output, config)

View File

@@ -28,7 +28,7 @@ def to_code(config):
yield
rhs = App.make_rgb_light(config[CONF_NAME], red, green, blue)
light_struct = variable(config[CONF_MAKE_ID], rhs)
light.setup_light(light_struct.Pstate, light_struct.Pmqtt, config)
light.setup_light(light_struct.Pstate, config)
setup_component(light_struct.Pstate, config)

View File

@@ -31,7 +31,7 @@ def to_code(config):
yield
rhs = App.make_rgbw_light(config[CONF_NAME], red, green, blue, white)
light_struct = variable(config[CONF_MAKE_ID], rhs)
light.setup_light(light_struct.Pstate, light_struct.Pmqtt, config)
light.setup_light(light_struct.Pstate, config)
setup_component(light_struct.Pstate, config)

View File

@@ -61,7 +61,7 @@ def to_code(config):
config[CONF_WARM_WHITE_COLOR_TEMPERATURE],
red, green, blue, cold_white, warm_white)
light_struct = variable(config[CONF_MAKE_ID], rhs)
light.setup_light(light_struct.Pstate, light_struct.Pmqtt, config)
light.setup_light(light_struct.Pstate, config)
setup_component(light_struct.Pstate, config)