ESPHome version 2021.10.x updates (#30)

This commit is contained in:
Chris Nussbaum 2021-11-11 12:46:56 -06:00 committed by GitHub
parent c3d51bce9a
commit df2c532d13
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 16 additions and 17 deletions

View File

@ -1,6 +1,7 @@
#pragma once
#include "esphome/core/component.h"
#include "esphome/core/gpio.h"
#include "esphome/components/sensor/sensor.h"
#include "esphome/components/switch/switch.h"

View File

@ -1,8 +1,8 @@
#include "pool_controller.h"
#include "esphome/components/time/automation.h"
#include "esphome/core/application.h"
#include "esphome/core/base_automation.h"
#include "esphome/core/log.h"
#include "pool_controller.h"
namespace esphome {
namespace pool_controller {
@ -25,7 +25,7 @@ PoolController::PoolController() {
App.register_component(this->pump_select_);
App.register_select(this->pump_select_);
this->pump_select_->set_name("Pool Pump Mode");
this->pump_select_->traits.set_icon("mdi:pump");
this->pump_select_->set_icon("mdi:pump");
this->pump_select_->traits.set_options({"Off", "Normal", "Always Except Peak", "Always"});
this->pump_select_->add_on_state_callback([this](std::string value) -> void {
auto options = this->pump_select_->traits.get_options();
@ -38,7 +38,7 @@ PoolController::PoolController() {
App.register_component(this->cleaner_select_);
App.register_select(this->cleaner_select_);
this->cleaner_select_->set_name("Pool Cleaner Mode");
this->cleaner_select_->traits.set_icon("mdi:robot-vacuum");
this->cleaner_select_->set_icon("mdi:robot-vacuum");
this->cleaner_select_->traits.set_options({"Off", "Normal", "When Pump Is On"});
this->cleaner_select_->add_on_state_callback([this](std::string value) -> void {
auto options = this->cleaner_select_->traits.get_options();

View File

@ -1,5 +1,5 @@
#include "esphome/core/log.h"
#include "pool_select.h"
#include "esphome/core/log.h"
namespace esphome {
namespace pool_controller {
@ -9,7 +9,7 @@ static const char *const TAG = "pool_select";
void PoolSelect::setup() {
std::string value;
size_t index;
this->pref_ = global_preferences.make_preference<size_t>(this->get_object_id_hash());
this->pref_ = global_preferences->make_preference<size_t>(this->get_object_id_hash());
if (!this->pref_.load(&index)) {
value = "Off";
ESP_LOGD(TAG, "State from initial (could not load): %s", value.c_str());

View File

@ -5,6 +5,7 @@
#include "esphome/components/switch/switch.h"
#include "esphome/components/time/real_time_clock.h"
#include "esphome/core/component.h"
#include "esphome/core/hal.h"
#include "esphome/core/preferences.h"
namespace esphome {

View File

@ -13,12 +13,12 @@ from esphome.const import (
CONF_UPDATE_INTERVAL,
)
DEPENDENCIES = ["api"]
CONF_LIGHT_WATTAGE = "light_wattage"
light_ns = cg.esphome_ns.namespace("light")
api_ns = cg.esphome_ns.namespace("api")
APIServer = api_ns.class_("APIServer", cg.Component, cg.Controller)
TreoLight = light_ns.class_("TreoLedPoolLight", light.LightOutput, cg.PollingComponent, APIServer)
TreoLight = light_ns.class_("TreoLedPoolLight", light.LightOutput, cg.PollingComponent)
CONFIG_SCHEMA = cv.All(
light.LIGHT_SCHEMA.extend(

View File

@ -1,5 +1,5 @@
#include "esphome/core/log.h"
#include "treo_led_pool_light.h"
#include "esphome/core/log.h"
namespace esphome {
namespace light {
@ -32,7 +32,7 @@ void TreoLedPoolLight::setup_state(light::LightState *state) {
auto *effectFast = new TreoColorLightEffect("Fast Change", this, 8);
state->add_effects({ effectSlow, effectWhite , effectBlue , effectGreen , effectRed , effectAmber , effectMagenta , effectFast });
this->rtc_ = global_preferences.make_preference<uint8_t>(state->get_object_id_hash() ^ RESTORE_COLOR_VERSION);
this->rtc_ = global_preferences->make_preference<uint8_t>(state->get_object_id_hash() ^ RESTORE_COLOR_VERSION);
this->rtc_.load(&this->current_color_);
this->target_color_ = this->current_color_;

View File

@ -1,6 +1,6 @@
#include "tuya_dimmer_as_fan.h"
#include "esphome/core/log.h"
#include "esphome/components/fan/fan_helpers.h"
#include "tuya_dimmer_as_fan.h"
namespace esphome {
namespace tuya {

View File

@ -21,7 +21,7 @@ from esphome.const import (
)
from esphome.components.tuya import CONF_TUYA_ID, Tuya
DEPENDENCIES = ["tuya"]
DEPENDENCIES = ["api", "tuya"]
CONF_DIMMER_DATAPOINT = "dimmer_datapoint"
CONF_MIN_VALUE_DATAPOINT = "min_value_datapoint"
@ -42,9 +42,7 @@ CONF_ON_DOUBLE_CLICK_WHILE_ON = "on_double_click_while_on"
CONF_LIGHT_WATTAGE = "light_wattage"
tuya_ns = cg.esphome_ns.namespace("tuya")
api_ns = cg.esphome_ns.namespace("api")
APIServer = api_ns.class_("APIServer", cg.Component, cg.Controller)
TuyaLight = tuya_ns.class_("TuyaLightPlus", light.LightOutput, cg.PollingComponent, APIServer)
TuyaLight = tuya_ns.class_("TuyaLightPlus", light.LightOutput, cg.PollingComponent)
DoubleClickWhileOffTrigger = tuya_ns.class_('DoubleClickWhileOffTrigger', auto.Trigger.template())
DoubleClickWhileOnTrigger = tuya_ns.class_('DoubleClickWhileOnTrigger', auto.Trigger.template())

View File

@ -1,5 +1,5 @@
#include "esphome/core/log.h"
#include "tuya_light_plus.h"
#include "esphome/core/log.h"
namespace esphome {
namespace tuya {

View File

@ -9,7 +9,6 @@ esphome:
name: ${device_id}
platform: ${platform}
board: ${board}
arduino_version: latest
build_path: ../build/${device_id}
packages: