From bd45f6bd8e7398477b04210a36b492e844cd6a5b Mon Sep 17 00:00:00 2001 From: Otto Winter Date: Fri, 24 May 2019 16:20:28 +0200 Subject: [PATCH] Register components properly --- esphome/components/bang_bang/climate.py | 2 +- esphome/components/climate/climate_mode.cpp | 8 ++++---- esphome/components/deep_sleep/deep_sleep_component.cpp | 2 +- .../components/homeassistant/binary_sensor/__init__.py | 3 ++- esphome/components/homeassistant/sensor/__init__.py | 3 ++- esphome/components/mqtt/mqtt_climate.cpp | 8 ++++---- 6 files changed, 14 insertions(+), 12 deletions(-) diff --git a/esphome/components/bang_bang/climate.py b/esphome/components/bang_bang/climate.py index 88828ef44f..4ef811c55d 100644 --- a/esphome/components/bang_bang/climate.py +++ b/esphome/components/bang_bang/climate.py @@ -7,7 +7,7 @@ from esphome.const import CONF_AWAY_CONFIG, CONF_COOL_ACTION, \ CONF_ID, CONF_IDLE_ACTION, CONF_SENSOR bang_bang_ns = cg.esphome_ns.namespace('bang_bang') -BangBangClimate = bang_bang_ns.class_('BangBangClimate', climate.Climate) +BangBangClimate = bang_bang_ns.class_('BangBangClimate', climate.Climate, cg.Component) BangBangClimateTargetTempConfig = bang_bang_ns.struct('BangBangClimateTargetTempConfig') CONFIG_SCHEMA = cv.All(climate.CLIMATE_SCHEMA.extend({ diff --git a/esphome/components/climate/climate_mode.cpp b/esphome/components/climate/climate_mode.cpp index 32d42b706f..07b97f4f33 100644 --- a/esphome/components/climate/climate_mode.cpp +++ b/esphome/components/climate/climate_mode.cpp @@ -6,13 +6,13 @@ namespace climate { const char *climate_mode_to_string(ClimateMode mode) { switch (mode) { case CLIMATE_MODE_OFF: - return "off"; + return "OFF"; case CLIMATE_MODE_AUTO: - return "auto"; + return "AUTO"; case CLIMATE_MODE_COOL: - return "cool"; + return "COOL"; case CLIMATE_MODE_HEAT: - return "heat"; + return "HEAT"; default: return "UNKNOWN"; } diff --git a/esphome/components/deep_sleep/deep_sleep_component.cpp b/esphome/components/deep_sleep/deep_sleep_component.cpp index ed14f3c824..5f6aaf24cd 100644 --- a/esphome/components/deep_sleep/deep_sleep_component.cpp +++ b/esphome/components/deep_sleep/deep_sleep_component.cpp @@ -19,7 +19,7 @@ void DeepSleepComponent::setup() { void DeepSleepComponent::dump_config() { ESP_LOGCONFIG(TAG, "Setting up Deep Sleep..."); if (this->sleep_duration_.has_value()) { - ESP_LOGCONFIG(TAG, " Sleep Duration: %llu ms", *this->sleep_duration_ / 1000); + ESP_LOGCONFIG(TAG, " Sleep Duration: %u ms", *this->sleep_duration_ / 1000); } if (this->run_duration_.has_value()) { ESP_LOGCONFIG(TAG, " Run Duration: %u ms", *this->run_duration_); diff --git a/esphome/components/homeassistant/binary_sensor/__init__.py b/esphome/components/homeassistant/binary_sensor/__init__.py index b78836f18f..88e2f2fcb2 100644 --- a/esphome/components/homeassistant/binary_sensor/__init__.py +++ b/esphome/components/homeassistant/binary_sensor/__init__.py @@ -6,7 +6,8 @@ from .. import homeassistant_ns DEPENDENCIES = ['api'] HomeassistantBinarySensor = homeassistant_ns.class_('HomeassistantBinarySensor', - binary_sensor.BinarySensor) + binary_sensor.BinarySensor, + cg.Component) CONFIG_SCHEMA = binary_sensor.BINARY_SENSOR_SCHEMA.extend({ cv.GenerateID(): cv.declare_id(HomeassistantBinarySensor), diff --git a/esphome/components/homeassistant/sensor/__init__.py b/esphome/components/homeassistant/sensor/__init__.py index cd5e4a74e2..577efca79b 100644 --- a/esphome/components/homeassistant/sensor/__init__.py +++ b/esphome/components/homeassistant/sensor/__init__.py @@ -6,7 +6,8 @@ from .. import homeassistant_ns DEPENDENCIES = ['api'] -HomeassistantSensor = homeassistant_ns.class_('HomeassistantSensor', sensor.Sensor) +HomeassistantSensor = homeassistant_ns.class_('HomeassistantSensor', sensor.Sensor, + cg.Component) CONFIG_SCHEMA = sensor.sensor_schema(UNIT_EMPTY, ICON_EMPTY, 1).extend({ cv.GenerateID(): cv.declare_id(HomeassistantSensor), diff --git a/esphome/components/mqtt/mqtt_climate.cpp b/esphome/components/mqtt/mqtt_climate.cpp index 590a6db7b4..8085fbf0f2 100644 --- a/esphome/components/mqtt/mqtt_climate.cpp +++ b/esphome/components/mqtt/mqtt_climate.cpp @@ -24,12 +24,12 @@ void MQTTClimateComponent::send_discovery(JsonObject &root, mqtt::SendDiscoveryC JsonArray &modes = root.createNestedArray("modes"); // sort array for nice UI in HA if (traits.supports_mode(CLIMATE_MODE_AUTO)) - modes.add(climate_mode_to_string(CLIMATE_MODE_AUTO)); - modes.add(climate_mode_to_string(CLIMATE_MODE_OFF)); + modes.add("auto"); + modes.add("off"); if (traits.supports_mode(CLIMATE_MODE_COOL)) - modes.add(climate_mode_to_string(CLIMATE_MODE_COOL)); + modes.add("cool"); if (traits.supports_mode(CLIMATE_MODE_HEAT)) - modes.add(climate_mode_to_string(CLIMATE_MODE_HEAT)); + modes.add("heat"); if (traits.get_supports_two_point_target_temperature()) { // temperature_low_command_topic