mirror of
https://github.com/esphome/esphome.git
synced 2024-11-24 12:06:26 +01:00
Merge branch 'dev' into dev
This commit is contained in:
commit
21bb27b9c8
@ -1,10 +1,9 @@
|
|||||||
import logging
|
import logging
|
||||||
|
|
||||||
import esphome.codegen as cg
|
import esphome.codegen as cg
|
||||||
import esphome.config_validation as cv
|
from esphome.components.ota import BASE_OTA_SCHEMA, OTAComponent, ota_to_code
|
||||||
import esphome.final_validate as fv
|
|
||||||
from esphome.components.ota import BASE_OTA_SCHEMA, ota_to_code, OTAComponent
|
|
||||||
from esphome.config_helpers import merge_config
|
from esphome.config_helpers import merge_config
|
||||||
|
import esphome.config_validation as cv
|
||||||
from esphome.const import (
|
from esphome.const import (
|
||||||
CONF_ESPHOME,
|
CONF_ESPHOME,
|
||||||
CONF_ID,
|
CONF_ID,
|
||||||
@ -18,6 +17,7 @@ from esphome.const import (
|
|||||||
CONF_VERSION,
|
CONF_VERSION,
|
||||||
)
|
)
|
||||||
from esphome.core import coroutine_with_priority
|
from esphome.core import coroutine_with_priority
|
||||||
|
import esphome.final_validate as fv
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
@ -124,7 +124,6 @@ FINAL_VALIDATE_SCHEMA = ota_esphome_final_validate
|
|||||||
@coroutine_with_priority(52.0)
|
@coroutine_with_priority(52.0)
|
||||||
async def to_code(config):
|
async def to_code(config):
|
||||||
var = cg.new_Pvariable(config[CONF_ID])
|
var = cg.new_Pvariable(config[CONF_ID])
|
||||||
await ota_to_code(var, config)
|
|
||||||
cg.add(var.set_port(config[CONF_PORT]))
|
cg.add(var.set_port(config[CONF_PORT]))
|
||||||
if CONF_PASSWORD in config:
|
if CONF_PASSWORD in config:
|
||||||
cg.add(var.set_auth_password(config[CONF_PASSWORD]))
|
cg.add(var.set_auth_password(config[CONF_PASSWORD]))
|
||||||
@ -132,3 +131,4 @@ async def to_code(config):
|
|||||||
cg.add_define("USE_OTA_VERSION", config[CONF_VERSION])
|
cg.add_define("USE_OTA_VERSION", config[CONF_VERSION])
|
||||||
|
|
||||||
await cg.register_component(var, config)
|
await cg.register_component(var, config)
|
||||||
|
await ota_to_code(var, config)
|
||||||
|
@ -6,3 +6,5 @@ Nextion = nextion_ns.class_("Nextion", cg.PollingComponent, uart.UARTDevice)
|
|||||||
nextion_ref = Nextion.operator("ref")
|
nextion_ref = Nextion.operator("ref")
|
||||||
|
|
||||||
CONF_NEXTION_ID = "nextion_id"
|
CONF_NEXTION_ID = "nextion_id"
|
||||||
|
CONF_PUBLISH_STATE = "publish_state"
|
||||||
|
CONF_SEND_TO_NEXTION = "send_to_nextion"
|
||||||
|
@ -5,6 +5,13 @@
|
|||||||
namespace esphome {
|
namespace esphome {
|
||||||
namespace nextion {
|
namespace nextion {
|
||||||
|
|
||||||
|
class BufferOverflowTrigger : public Trigger<> {
|
||||||
|
public:
|
||||||
|
explicit BufferOverflowTrigger(Nextion *nextion) {
|
||||||
|
nextion->add_buffer_overflow_event_callback([this]() { this->trigger(); });
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
class SetupTrigger : public Trigger<> {
|
class SetupTrigger : public Trigger<> {
|
||||||
public:
|
public:
|
||||||
explicit SetupTrigger(Nextion *nextion) {
|
explicit SetupTrigger(Nextion *nextion) {
|
||||||
@ -42,11 +49,73 @@ class TouchTrigger : public Trigger<uint8_t, uint8_t, bool> {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
class BufferOverflowTrigger : public Trigger<> {
|
template<typename... Ts> class NextionPublishFloatAction : public Action<Ts...> {
|
||||||
public:
|
public:
|
||||||
explicit BufferOverflowTrigger(Nextion *nextion) {
|
explicit NextionPublishFloatAction(NextionComponent *component) : component_(component) {}
|
||||||
nextion->add_buffer_overflow_event_callback([this]() { this->trigger(); });
|
|
||||||
|
TEMPLATABLE_VALUE(float, state)
|
||||||
|
TEMPLATABLE_VALUE(bool, publish_state)
|
||||||
|
TEMPLATABLE_VALUE(bool, send_to_nextion)
|
||||||
|
|
||||||
|
void play(Ts... x) override {
|
||||||
|
this->component_->set_state(this->state_.value(x...), this->publish_state_.value(x...),
|
||||||
|
this->send_to_nextion_.value(x...));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void set_state(std::function<void(Ts..., float)> state) { this->state_ = state; }
|
||||||
|
void set_publish_state(std::function<void(Ts..., bool)> publish_state) { this->publish_state_ = publish_state; }
|
||||||
|
void set_send_to_nextion(std::function<void(Ts..., bool)> send_to_nextion) {
|
||||||
|
this->send_to_nextion_ = send_to_nextion;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected:
|
||||||
|
NextionComponent *component_;
|
||||||
|
};
|
||||||
|
|
||||||
|
template<typename... Ts> class NextionPublishTextAction : public Action<Ts...> {
|
||||||
|
public:
|
||||||
|
explicit NextionPublishTextAction(NextionComponent *component) : component_(component) {}
|
||||||
|
|
||||||
|
TEMPLATABLE_VALUE(const char *, state)
|
||||||
|
TEMPLATABLE_VALUE(bool, publish_state)
|
||||||
|
TEMPLATABLE_VALUE(bool, send_to_nextion)
|
||||||
|
|
||||||
|
void play(Ts... x) override {
|
||||||
|
this->component_->set_state(this->state_.value(x...), this->publish_state_.value(x...),
|
||||||
|
this->send_to_nextion_.value(x...));
|
||||||
|
}
|
||||||
|
|
||||||
|
void set_state(std::function<void(Ts..., const char *)> state) { this->state_ = state; }
|
||||||
|
void set_publish_state(std::function<void(Ts..., bool)> publish_state) { this->publish_state_ = publish_state; }
|
||||||
|
void set_send_to_nextion(std::function<void(Ts..., bool)> send_to_nextion) {
|
||||||
|
this->send_to_nextion_ = send_to_nextion;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected:
|
||||||
|
NextionComponent *component_;
|
||||||
|
};
|
||||||
|
|
||||||
|
template<typename... Ts> class NextionPublishBoolAction : public Action<Ts...> {
|
||||||
|
public:
|
||||||
|
explicit NextionPublishBoolAction(NextionComponent *component) : component_(component) {}
|
||||||
|
|
||||||
|
TEMPLATABLE_VALUE(bool, state)
|
||||||
|
TEMPLATABLE_VALUE(bool, publish_state)
|
||||||
|
TEMPLATABLE_VALUE(bool, send_to_nextion)
|
||||||
|
|
||||||
|
void play(Ts... x) override {
|
||||||
|
this->component_->set_state(this->state_.value(x...), this->publish_state_.value(x...),
|
||||||
|
this->send_to_nextion_.value(x...));
|
||||||
|
}
|
||||||
|
|
||||||
|
void set_state(std::function<void(Ts..., bool)> state) { this->state_ = state; }
|
||||||
|
void set_publish_state(std::function<void(Ts..., bool)> publish_state) { this->publish_state_ = publish_state; }
|
||||||
|
void set_send_to_nextion(std::function<void(Ts..., bool)> send_to_nextion) {
|
||||||
|
this->send_to_nextion_ = send_to_nextion;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected:
|
||||||
|
NextionComponent *component_;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace nextion
|
} // namespace nextion
|
||||||
|
@ -1,9 +1,16 @@
|
|||||||
|
from esphome import automation
|
||||||
import esphome.codegen as cg
|
import esphome.codegen as cg
|
||||||
import esphome.config_validation as cv
|
import esphome.config_validation as cv
|
||||||
from esphome.components import binary_sensor
|
from esphome.components import binary_sensor
|
||||||
|
|
||||||
from esphome.const import CONF_COMPONENT_ID, CONF_PAGE_ID, CONF_ID
|
from esphome.const import (
|
||||||
from .. import nextion_ns, CONF_NEXTION_ID
|
CONF_ID,
|
||||||
|
CONF_STATE,
|
||||||
|
CONF_COMPONENT_ID,
|
||||||
|
CONF_PAGE_ID,
|
||||||
|
)
|
||||||
|
|
||||||
|
from .. import nextion_ns, CONF_NEXTION_ID, CONF_PUBLISH_STATE, CONF_SEND_TO_NEXTION
|
||||||
|
|
||||||
|
|
||||||
from ..base_component import (
|
from ..base_component import (
|
||||||
@ -19,6 +26,10 @@ NextionBinarySensor = nextion_ns.class_(
|
|||||||
"NextionBinarySensor", binary_sensor.BinarySensor, cg.PollingComponent
|
"NextionBinarySensor", binary_sensor.BinarySensor, cg.PollingComponent
|
||||||
)
|
)
|
||||||
|
|
||||||
|
NextionPublishBoolAction = nextion_ns.class_(
|
||||||
|
"NextionPublishBoolAction", automation.Action
|
||||||
|
)
|
||||||
|
|
||||||
CONFIG_SCHEMA = cv.All(
|
CONFIG_SCHEMA = cv.All(
|
||||||
binary_sensor.binary_sensor_schema(NextionBinarySensor)
|
binary_sensor.binary_sensor_schema(NextionBinarySensor)
|
||||||
.extend(
|
.extend(
|
||||||
@ -52,3 +63,33 @@ async def to_code(config):
|
|||||||
if CONF_COMPONENT_NAME in config or CONF_VARIABLE_NAME in config:
|
if CONF_COMPONENT_NAME in config or CONF_VARIABLE_NAME in config:
|
||||||
await setup_component_core_(var, config, ".val")
|
await setup_component_core_(var, config, ".val")
|
||||||
cg.add(hub.register_binarysensor_component(var))
|
cg.add(hub.register_binarysensor_component(var))
|
||||||
|
|
||||||
|
|
||||||
|
@automation.register_action(
|
||||||
|
"binary_sensor.nextion.publish",
|
||||||
|
NextionPublishBoolAction,
|
||||||
|
cv.Schema(
|
||||||
|
{
|
||||||
|
cv.Required(CONF_ID): cv.use_id(NextionBinarySensor),
|
||||||
|
cv.Required(CONF_STATE): cv.templatable(cv.boolean),
|
||||||
|
cv.Optional(CONF_PUBLISH_STATE, default="true"): cv.templatable(cv.boolean),
|
||||||
|
cv.Optional(CONF_SEND_TO_NEXTION, default="true"): cv.templatable(
|
||||||
|
cv.boolean
|
||||||
|
),
|
||||||
|
}
|
||||||
|
),
|
||||||
|
)
|
||||||
|
async def sensor_nextion_publish_to_code(config, action_id, template_arg, args):
|
||||||
|
paren = await cg.get_variable(config[CONF_ID])
|
||||||
|
var = cg.new_Pvariable(action_id, template_arg, paren)
|
||||||
|
|
||||||
|
template_ = await cg.templatable(config[CONF_STATE], args, bool)
|
||||||
|
cg.add(var.set_state(template_))
|
||||||
|
|
||||||
|
template_ = await cg.templatable(config[CONF_PUBLISH_STATE], args, bool)
|
||||||
|
cg.add(var.set_publish_state(template_))
|
||||||
|
|
||||||
|
template_ = await cg.templatable(config[CONF_SEND_TO_NEXTION], args, bool)
|
||||||
|
cg.add(var.set_send_to_nextion(template_))
|
||||||
|
|
||||||
|
return var
|
||||||
|
@ -1,12 +1,11 @@
|
|||||||
|
from esphome import automation
|
||||||
import esphome.codegen as cg
|
import esphome.codegen as cg
|
||||||
import esphome.config_validation as cv
|
import esphome.config_validation as cv
|
||||||
from esphome.components import sensor
|
from esphome.components import sensor
|
||||||
|
|
||||||
from esphome.const import (
|
from esphome.const import CONF_ID, CONF_COMPONENT_ID, CONF_STATE
|
||||||
CONF_ID,
|
|
||||||
CONF_COMPONENT_ID,
|
from .. import nextion_ns, CONF_NEXTION_ID, CONF_PUBLISH_STATE, CONF_SEND_TO_NEXTION
|
||||||
)
|
|
||||||
from .. import nextion_ns, CONF_NEXTION_ID
|
|
||||||
|
|
||||||
from ..base_component import (
|
from ..base_component import (
|
||||||
setup_component_core_,
|
setup_component_core_,
|
||||||
@ -25,6 +24,10 @@ CODEOWNERS = ["@senexcrenshaw"]
|
|||||||
|
|
||||||
NextionSensor = nextion_ns.class_("NextionSensor", sensor.Sensor, cg.PollingComponent)
|
NextionSensor = nextion_ns.class_("NextionSensor", sensor.Sensor, cg.PollingComponent)
|
||||||
|
|
||||||
|
NextionPublishFloatAction = nextion_ns.class_(
|
||||||
|
"NextionPublishFloatAction", automation.Action
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def CheckWaveID(value):
|
def CheckWaveID(value):
|
||||||
value = cv.int_(value)
|
value = cv.int_(value)
|
||||||
@ -95,3 +98,33 @@ async def to_code(config):
|
|||||||
|
|
||||||
if CONF_WAVE_MAX_LENGTH in config:
|
if CONF_WAVE_MAX_LENGTH in config:
|
||||||
cg.add(var.set_wave_max_length(config[CONF_WAVE_MAX_LENGTH]))
|
cg.add(var.set_wave_max_length(config[CONF_WAVE_MAX_LENGTH]))
|
||||||
|
|
||||||
|
|
||||||
|
@automation.register_action(
|
||||||
|
"sensor.nextion.publish",
|
||||||
|
NextionPublishFloatAction,
|
||||||
|
cv.Schema(
|
||||||
|
{
|
||||||
|
cv.Required(CONF_ID): cv.use_id(NextionSensor),
|
||||||
|
cv.Required(CONF_STATE): cv.templatable(cv.float_),
|
||||||
|
cv.Optional(CONF_PUBLISH_STATE, default="true"): cv.templatable(cv.boolean),
|
||||||
|
cv.Optional(CONF_SEND_TO_NEXTION, default="true"): cv.templatable(
|
||||||
|
cv.boolean
|
||||||
|
),
|
||||||
|
}
|
||||||
|
),
|
||||||
|
)
|
||||||
|
async def sensor_nextion_publish_to_code(config, action_id, template_arg, args):
|
||||||
|
paren = await cg.get_variable(config[CONF_ID])
|
||||||
|
var = cg.new_Pvariable(action_id, template_arg, paren)
|
||||||
|
|
||||||
|
template_ = await cg.templatable(config[CONF_STATE], args, float)
|
||||||
|
cg.add(var.set_state(template_))
|
||||||
|
|
||||||
|
template_ = await cg.templatable(config[CONF_PUBLISH_STATE], args, bool)
|
||||||
|
cg.add(var.set_publish_state(template_))
|
||||||
|
|
||||||
|
template_ = await cg.templatable(config[CONF_SEND_TO_NEXTION], args, bool)
|
||||||
|
cg.add(var.set_send_to_nextion(template_))
|
||||||
|
|
||||||
|
return var
|
||||||
|
@ -1,9 +1,11 @@
|
|||||||
|
from esphome import automation
|
||||||
import esphome.codegen as cg
|
import esphome.codegen as cg
|
||||||
import esphome.config_validation as cv
|
import esphome.config_validation as cv
|
||||||
from esphome.components import switch
|
from esphome.components import switch
|
||||||
|
|
||||||
from esphome.const import CONF_ID
|
from esphome.const import CONF_ID, CONF_STATE
|
||||||
from .. import nextion_ns, CONF_NEXTION_ID
|
|
||||||
|
from .. import nextion_ns, CONF_NEXTION_ID, CONF_PUBLISH_STATE, CONF_SEND_TO_NEXTION
|
||||||
|
|
||||||
from ..base_component import (
|
from ..base_component import (
|
||||||
setup_component_core_,
|
setup_component_core_,
|
||||||
@ -16,6 +18,10 @@ CODEOWNERS = ["@senexcrenshaw"]
|
|||||||
|
|
||||||
NextionSwitch = nextion_ns.class_("NextionSwitch", switch.Switch, cg.PollingComponent)
|
NextionSwitch = nextion_ns.class_("NextionSwitch", switch.Switch, cg.PollingComponent)
|
||||||
|
|
||||||
|
NextionPublishBoolAction = nextion_ns.class_(
|
||||||
|
"NextionPublishBoolAction", automation.Action
|
||||||
|
)
|
||||||
|
|
||||||
CONFIG_SCHEMA = cv.All(
|
CONFIG_SCHEMA = cv.All(
|
||||||
switch.switch_schema(NextionSwitch)
|
switch.switch_schema(NextionSwitch)
|
||||||
.extend(CONFIG_SWITCH_COMPONENT_SCHEMA)
|
.extend(CONFIG_SWITCH_COMPONENT_SCHEMA)
|
||||||
@ -33,3 +39,33 @@ async def to_code(config):
|
|||||||
cg.add(hub.register_switch_component(var))
|
cg.add(hub.register_switch_component(var))
|
||||||
|
|
||||||
await setup_component_core_(var, config, ".val")
|
await setup_component_core_(var, config, ".val")
|
||||||
|
|
||||||
|
|
||||||
|
@automation.register_action(
|
||||||
|
"switch.nextion.publish",
|
||||||
|
NextionPublishBoolAction,
|
||||||
|
cv.Schema(
|
||||||
|
{
|
||||||
|
cv.Required(CONF_ID): cv.use_id(NextionSwitch),
|
||||||
|
cv.Required(CONF_STATE): cv.templatable(cv.boolean),
|
||||||
|
cv.Optional(CONF_PUBLISH_STATE, default="true"): cv.templatable(cv.boolean),
|
||||||
|
cv.Optional(CONF_SEND_TO_NEXTION, default="true"): cv.templatable(
|
||||||
|
cv.boolean
|
||||||
|
),
|
||||||
|
}
|
||||||
|
),
|
||||||
|
)
|
||||||
|
async def sensor_nextion_publish_to_code(config, action_id, template_arg, args):
|
||||||
|
paren = await cg.get_variable(config[CONF_ID])
|
||||||
|
var = cg.new_Pvariable(action_id, template_arg, paren)
|
||||||
|
|
||||||
|
template_ = await cg.templatable(config[CONF_STATE], args, bool)
|
||||||
|
cg.add(var.set_state(template_))
|
||||||
|
|
||||||
|
template_ = await cg.templatable(config[CONF_PUBLISH_STATE], args, bool)
|
||||||
|
cg.add(var.set_publish_state(template_))
|
||||||
|
|
||||||
|
template_ = await cg.templatable(config[CONF_SEND_TO_NEXTION], args, bool)
|
||||||
|
cg.add(var.set_send_to_nextion(template_))
|
||||||
|
|
||||||
|
return var
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
|
from esphome import automation
|
||||||
from esphome.components import text_sensor
|
from esphome.components import text_sensor
|
||||||
import esphome.config_validation as cv
|
import esphome.config_validation as cv
|
||||||
import esphome.codegen as cg
|
import esphome.codegen as cg
|
||||||
from esphome.const import CONF_ID
|
from esphome.const import CONF_ID, CONF_STATE
|
||||||
|
|
||||||
from .. import nextion_ns, CONF_NEXTION_ID
|
from .. import nextion_ns, CONF_NEXTION_ID, CONF_PUBLISH_STATE, CONF_SEND_TO_NEXTION
|
||||||
|
|
||||||
from ..base_component import (
|
from ..base_component import (
|
||||||
setup_component_core_,
|
setup_component_core_,
|
||||||
@ -16,6 +17,10 @@ NextionTextSensor = nextion_ns.class_(
|
|||||||
"NextionTextSensor", text_sensor.TextSensor, cg.PollingComponent
|
"NextionTextSensor", text_sensor.TextSensor, cg.PollingComponent
|
||||||
)
|
)
|
||||||
|
|
||||||
|
NextionPublishTextAction = nextion_ns.class_(
|
||||||
|
"NextionPublishTextAction", automation.Action
|
||||||
|
)
|
||||||
|
|
||||||
CONFIG_SCHEMA = (
|
CONFIG_SCHEMA = (
|
||||||
text_sensor.text_sensor_schema(NextionTextSensor)
|
text_sensor.text_sensor_schema(NextionTextSensor)
|
||||||
.extend(CONFIG_TEXT_COMPONENT_SCHEMA)
|
.extend(CONFIG_TEXT_COMPONENT_SCHEMA)
|
||||||
@ -32,3 +37,33 @@ async def to_code(config):
|
|||||||
cg.add(hub.register_textsensor_component(var))
|
cg.add(hub.register_textsensor_component(var))
|
||||||
|
|
||||||
await setup_component_core_(var, config, ".txt")
|
await setup_component_core_(var, config, ".txt")
|
||||||
|
|
||||||
|
|
||||||
|
@automation.register_action(
|
||||||
|
"text_sensor.nextion.publish",
|
||||||
|
NextionPublishTextAction,
|
||||||
|
cv.Schema(
|
||||||
|
{
|
||||||
|
cv.Required(CONF_ID): cv.use_id(NextionTextSensor),
|
||||||
|
cv.Required(CONF_STATE): cv.templatable(cv.string_strict),
|
||||||
|
cv.Optional(CONF_PUBLISH_STATE, default="true"): cv.templatable(cv.boolean),
|
||||||
|
cv.Optional(CONF_SEND_TO_NEXTION, default="true"): cv.templatable(
|
||||||
|
cv.boolean
|
||||||
|
),
|
||||||
|
}
|
||||||
|
),
|
||||||
|
)
|
||||||
|
async def sensor_nextion_publish_to_code(config, action_id, template_arg, args):
|
||||||
|
paren = await cg.get_variable(config[CONF_ID])
|
||||||
|
var = cg.new_Pvariable(action_id, template_arg, paren)
|
||||||
|
|
||||||
|
template_ = await cg.templatable(config[CONF_STATE], args, cg.const_char_ptr)
|
||||||
|
cg.add(var.set_state(template_))
|
||||||
|
|
||||||
|
template_ = await cg.templatable(config[CONF_PUBLISH_STATE], args, cg.bool_)
|
||||||
|
cg.add(var.set_publish_state(template_))
|
||||||
|
|
||||||
|
template_ = await cg.templatable(config[CONF_SEND_TO_NEXTION], args, cg.bool_)
|
||||||
|
cg.add(var.set_send_to_nextion(template_))
|
||||||
|
|
||||||
|
return var
|
||||||
|
@ -92,6 +92,7 @@ async def to_code(config):
|
|||||||
|
|
||||||
|
|
||||||
async def ota_to_code(var, config):
|
async def ota_to_code(var, config):
|
||||||
|
await cg.past_safe_mode()
|
||||||
use_state_callback = False
|
use_state_callback = False
|
||||||
for conf in config.get(CONF_ON_STATE_CHANGE, []):
|
for conf in config.get(CONF_ON_STATE_CHANGE, []):
|
||||||
trigger = cg.new_Pvariable(conf[CONF_TRIGGER_ID], var)
|
trigger = cg.new_Pvariable(conf[CONF_TRIGGER_ID], var)
|
||||||
|
@ -55,6 +55,7 @@ chip.cmd(PAGESEL, 0x00)
|
|||||||
chip.cmd(0xC2, 0x00)
|
chip.cmd(0xC2, 0x00)
|
||||||
chip.delay(10)
|
chip.delay(10)
|
||||||
chip.cmd(TEON, 0x00)
|
chip.cmd(TEON, 0x00)
|
||||||
|
chip.cmd(PIXFMT, 0x55)
|
||||||
|
|
||||||
chip = DriverChip("AXS15231")
|
chip = DriverChip("AXS15231")
|
||||||
chip.cmd(0xBB, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5A, 0xA5)
|
chip.cmd(0xBB, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5A, 0xA5)
|
||||||
|
@ -40,13 +40,7 @@ class Rtttl : public Component {
|
|||||||
void set_speaker(speaker::Speaker *speaker) { this->speaker_ = speaker; }
|
void set_speaker(speaker::Speaker *speaker) { this->speaker_ = speaker; }
|
||||||
#endif
|
#endif
|
||||||
float get_gain() { return gain_; }
|
float get_gain() { return gain_; }
|
||||||
void set_gain(float gain) {
|
void set_gain(float gain) { this->gain_ = clamp(gain, 0.0f, 1.0f); }
|
||||||
if (gain < 0.1f)
|
|
||||||
gain = 0.1f;
|
|
||||||
if (gain > 1.0f)
|
|
||||||
gain = 1.0f;
|
|
||||||
this->gain_ = gain;
|
|
||||||
}
|
|
||||||
void play(std::string rtttl);
|
void play(std::string rtttl);
|
||||||
void stop();
|
void stop();
|
||||||
void dump_config() override;
|
void dump_config() override;
|
||||||
|
@ -7,6 +7,7 @@ from esphome.const import CONF_DATA, CONF_ID, CONF_VOLUME
|
|||||||
from esphome.core import CORE
|
from esphome.core import CORE
|
||||||
from esphome.coroutine import coroutine_with_priority
|
from esphome.coroutine import coroutine_with_priority
|
||||||
|
|
||||||
|
AUTO_LOAD = ["audio"]
|
||||||
CODEOWNERS = ["@jesserockz", "@kahrendt"]
|
CODEOWNERS = ["@jesserockz", "@kahrendt"]
|
||||||
|
|
||||||
IS_PLATFORM_COMPONENT = True
|
IS_PLATFORM_COMPONENT = True
|
||||||
|
@ -184,6 +184,9 @@ PRELOAD_CONFIG_SCHEMA = cv.Schema(
|
|||||||
cv.Optional(CONF_ESP8266_RESTORE_FROM_FLASH): cv.valid,
|
cv.Optional(CONF_ESP8266_RESTORE_FROM_FLASH): cv.valid,
|
||||||
cv.Optional(CONF_BOARD_FLASH_MODE): cv.valid,
|
cv.Optional(CONF_BOARD_FLASH_MODE): cv.valid,
|
||||||
cv.Optional(CONF_ARDUINO_VERSION): cv.valid,
|
cv.Optional(CONF_ARDUINO_VERSION): cv.valid,
|
||||||
|
cv.Optional(CONF_MIN_VERSION, default=ESPHOME_VERSION): cv.All(
|
||||||
|
cv.version_number, cv.validate_esphome_version
|
||||||
|
),
|
||||||
},
|
},
|
||||||
extra=cv.ALLOW_EXTRA,
|
extra=cv.ALLOW_EXTRA,
|
||||||
)
|
)
|
||||||
|
@ -103,7 +103,7 @@ class ESPHomeDashboard:
|
|||||||
self.loop = asyncio.get_running_loop()
|
self.loop = asyncio.get_running_loop()
|
||||||
self.ping_request = asyncio.Event()
|
self.ping_request = asyncio.Event()
|
||||||
self.entries = DashboardEntries(self)
|
self.entries = DashboardEntries(self)
|
||||||
self.load_ignored_devices()
|
await self.loop.run_in_executor(None, self.load_ignored_devices)
|
||||||
|
|
||||||
def load_ignored_devices(self) -> None:
|
def load_ignored_devices(self) -> None:
|
||||||
storage_path = Path(ignored_devices_storage_path())
|
storage_path = Path(ignored_devices_storage_path())
|
||||||
|
@ -544,7 +544,7 @@ class ImportRequestHandler(BaseHandler):
|
|||||||
|
|
||||||
class IgnoreDeviceRequestHandler(BaseHandler):
|
class IgnoreDeviceRequestHandler(BaseHandler):
|
||||||
@authenticated
|
@authenticated
|
||||||
def post(self) -> None:
|
async def post(self) -> None:
|
||||||
dashboard = DASHBOARD
|
dashboard = DASHBOARD
|
||||||
try:
|
try:
|
||||||
args = json.loads(self.request.body.decode())
|
args = json.loads(self.request.body.decode())
|
||||||
@ -576,7 +576,8 @@ class IgnoreDeviceRequestHandler(BaseHandler):
|
|||||||
else:
|
else:
|
||||||
dashboard.ignored_devices.discard(ignored_device.device_name)
|
dashboard.ignored_devices.discard(ignored_device.device_name)
|
||||||
|
|
||||||
dashboard.save_ignored_devices()
|
loop = asyncio.get_running_loop()
|
||||||
|
await loop.run_in_executor(None, dashboard.save_ignored_devices)
|
||||||
|
|
||||||
self.set_status(204)
|
self.set_status(204)
|
||||||
self.finish()
|
self.finish()
|
||||||
|
293
tests/components/nextion/common.yaml
Normal file
293
tests/components/nextion/common.yaml
Normal file
@ -0,0 +1,293 @@
|
|||||||
|
esphome:
|
||||||
|
on_boot:
|
||||||
|
# Binary sensor publish action tests
|
||||||
|
- binary_sensor.nextion.publish:
|
||||||
|
id: r0_sensor
|
||||||
|
state: True
|
||||||
|
|
||||||
|
- binary_sensor.nextion.publish:
|
||||||
|
id: r0_sensor
|
||||||
|
state: True
|
||||||
|
publish_state: True
|
||||||
|
send_to_nextion: True
|
||||||
|
|
||||||
|
- binary_sensor.nextion.publish:
|
||||||
|
id: r0_sensor
|
||||||
|
state: True
|
||||||
|
publish_state: False
|
||||||
|
send_to_nextion: True
|
||||||
|
|
||||||
|
- binary_sensor.nextion.publish:
|
||||||
|
id: r0_sensor
|
||||||
|
state: True
|
||||||
|
publish_state: True
|
||||||
|
send_to_nextion: False
|
||||||
|
|
||||||
|
- binary_sensor.nextion.publish:
|
||||||
|
id: r0_sensor
|
||||||
|
state: True
|
||||||
|
publish_state: False
|
||||||
|
send_to_nextion: False
|
||||||
|
|
||||||
|
# Templated
|
||||||
|
- binary_sensor.nextion.publish:
|
||||||
|
id: r0_sensor
|
||||||
|
state: !lambda 'return true;'
|
||||||
|
|
||||||
|
- binary_sensor.nextion.publish:
|
||||||
|
id: r0_sensor
|
||||||
|
state: !lambda 'return true;'
|
||||||
|
publish_state: !lambda 'return true;'
|
||||||
|
send_to_nextion: !lambda 'return true;'
|
||||||
|
|
||||||
|
- binary_sensor.nextion.publish:
|
||||||
|
id: r0_sensor
|
||||||
|
state: !lambda 'return true;'
|
||||||
|
publish_state: !lambda 'return false;'
|
||||||
|
send_to_nextion: !lambda 'return true;'
|
||||||
|
|
||||||
|
- binary_sensor.nextion.publish:
|
||||||
|
id: r0_sensor
|
||||||
|
state: !lambda 'return true;'
|
||||||
|
publish_state: !lambda 'return true;'
|
||||||
|
send_to_nextion: !lambda 'return false;'
|
||||||
|
|
||||||
|
- binary_sensor.nextion.publish:
|
||||||
|
id: r0_sensor
|
||||||
|
state: !lambda 'return true;'
|
||||||
|
publish_state: !lambda 'return false;'
|
||||||
|
send_to_nextion: !lambda 'return false;'
|
||||||
|
|
||||||
|
# Sensor publish action tests
|
||||||
|
- sensor.nextion.publish:
|
||||||
|
id: testnumber
|
||||||
|
state: 42.0
|
||||||
|
|
||||||
|
- sensor.nextion.publish:
|
||||||
|
id: testnumber
|
||||||
|
state: 42.0
|
||||||
|
publish_state: True
|
||||||
|
send_to_nextion: True
|
||||||
|
|
||||||
|
- sensor.nextion.publish:
|
||||||
|
id: testnumber
|
||||||
|
state: 42.0
|
||||||
|
publish_state: False
|
||||||
|
send_to_nextion: True
|
||||||
|
|
||||||
|
- sensor.nextion.publish:
|
||||||
|
id: testnumber
|
||||||
|
state: 42.0
|
||||||
|
publish_state: True
|
||||||
|
send_to_nextion: False
|
||||||
|
|
||||||
|
- sensor.nextion.publish:
|
||||||
|
id: testnumber
|
||||||
|
state: 42.0
|
||||||
|
publish_state: False
|
||||||
|
send_to_nextion: False
|
||||||
|
|
||||||
|
# Templated
|
||||||
|
- sensor.nextion.publish:
|
||||||
|
id: testnumber
|
||||||
|
state: !lambda 'return 42.0;'
|
||||||
|
|
||||||
|
- sensor.nextion.publish:
|
||||||
|
id: testnumber
|
||||||
|
state: !lambda 'return 42.0;'
|
||||||
|
publish_state: !lambda 'return true;'
|
||||||
|
send_to_nextion: !lambda 'return true;'
|
||||||
|
|
||||||
|
- sensor.nextion.publish:
|
||||||
|
id: testnumber
|
||||||
|
state: !lambda 'return 42.0;'
|
||||||
|
publish_state: !lambda 'return false;'
|
||||||
|
send_to_nextion: !lambda 'return true;'
|
||||||
|
|
||||||
|
- sensor.nextion.publish:
|
||||||
|
id: testnumber
|
||||||
|
state: !lambda 'return 42.0;'
|
||||||
|
publish_state: !lambda 'return true;'
|
||||||
|
send_to_nextion: !lambda 'return false;'
|
||||||
|
|
||||||
|
- sensor.nextion.publish:
|
||||||
|
id: testnumber
|
||||||
|
state: !lambda 'return 42.0;'
|
||||||
|
publish_state: !lambda 'return false;'
|
||||||
|
send_to_nextion: !lambda 'return false;'
|
||||||
|
|
||||||
|
# Switch publish action tests
|
||||||
|
- switch.nextion.publish:
|
||||||
|
id: r0
|
||||||
|
state: True
|
||||||
|
|
||||||
|
- switch.nextion.publish:
|
||||||
|
id: r0
|
||||||
|
state: True
|
||||||
|
publish_state: true
|
||||||
|
send_to_nextion: true
|
||||||
|
|
||||||
|
- switch.nextion.publish:
|
||||||
|
id: r0
|
||||||
|
state: True
|
||||||
|
publish_state: false
|
||||||
|
send_to_nextion: true
|
||||||
|
|
||||||
|
- switch.nextion.publish:
|
||||||
|
id: r0
|
||||||
|
state: True
|
||||||
|
publish_state: true
|
||||||
|
send_to_nextion: false
|
||||||
|
|
||||||
|
- switch.nextion.publish:
|
||||||
|
id: r0
|
||||||
|
state: True
|
||||||
|
publish_state: false
|
||||||
|
send_to_nextion: false
|
||||||
|
|
||||||
|
# Templated
|
||||||
|
- switch.nextion.publish:
|
||||||
|
id: r0
|
||||||
|
state: !lambda 'return true;'
|
||||||
|
|
||||||
|
- switch.nextion.publish:
|
||||||
|
id: r0
|
||||||
|
state: !lambda 'return true;'
|
||||||
|
publish_state: !lambda 'return true;'
|
||||||
|
send_to_nextion: !lambda 'return true;'
|
||||||
|
|
||||||
|
- switch.nextion.publish:
|
||||||
|
id: r0
|
||||||
|
state: !lambda 'return true;'
|
||||||
|
publish_state: !lambda 'return false;'
|
||||||
|
send_to_nextion: !lambda 'return true;'
|
||||||
|
|
||||||
|
- switch.nextion.publish:
|
||||||
|
id: r0
|
||||||
|
state: !lambda 'return true;'
|
||||||
|
publish_state: !lambda 'return true;'
|
||||||
|
send_to_nextion: !lambda 'return false;'
|
||||||
|
|
||||||
|
- switch.nextion.publish:
|
||||||
|
id: r0
|
||||||
|
state: !lambda 'return true;'
|
||||||
|
publish_state: !lambda 'return false;'
|
||||||
|
send_to_nextion: !lambda 'return false;'
|
||||||
|
|
||||||
|
# Test sensor publish action tests
|
||||||
|
- text_sensor.nextion.publish:
|
||||||
|
id: text0
|
||||||
|
state: 'Test'
|
||||||
|
publish_state: true
|
||||||
|
send_to_nextion: true
|
||||||
|
|
||||||
|
- text_sensor.nextion.publish:
|
||||||
|
id: text0
|
||||||
|
state: 'Test'
|
||||||
|
publish_state: false
|
||||||
|
send_to_nextion: true
|
||||||
|
|
||||||
|
- text_sensor.nextion.publish:
|
||||||
|
id: text0
|
||||||
|
state: 'Test'
|
||||||
|
publish_state: true
|
||||||
|
send_to_nextion: false
|
||||||
|
|
||||||
|
- text_sensor.nextion.publish:
|
||||||
|
id: text0
|
||||||
|
state: 'Test'
|
||||||
|
publish_state: false
|
||||||
|
send_to_nextion: false
|
||||||
|
|
||||||
|
# Templated
|
||||||
|
- text_sensor.nextion.publish:
|
||||||
|
id: text0
|
||||||
|
state: !lambda 'return "Test";'
|
||||||
|
|
||||||
|
- text_sensor.nextion.publish:
|
||||||
|
id: text0
|
||||||
|
state: !lambda 'return "Test";'
|
||||||
|
publish_state: !lambda 'return true;'
|
||||||
|
send_to_nextion: !lambda 'return true;'
|
||||||
|
|
||||||
|
- text_sensor.nextion.publish:
|
||||||
|
id: text0
|
||||||
|
state: !lambda 'return "Test";'
|
||||||
|
publish_state: !lambda 'return false;'
|
||||||
|
send_to_nextion: !lambda 'return true;'
|
||||||
|
|
||||||
|
- text_sensor.nextion.publish:
|
||||||
|
id: text0
|
||||||
|
state: !lambda 'return "Test";'
|
||||||
|
publish_state: !lambda 'return true;'
|
||||||
|
send_to_nextion: !lambda 'return false;'
|
||||||
|
|
||||||
|
- text_sensor.nextion.publish:
|
||||||
|
id: text0
|
||||||
|
state: !lambda 'return "Test";'
|
||||||
|
publish_state: !lambda 'return false;'
|
||||||
|
send_to_nextion: !lambda 'return false;'
|
||||||
|
|
||||||
|
wifi:
|
||||||
|
ssid: MySSID
|
||||||
|
password: password1
|
||||||
|
|
||||||
|
uart:
|
||||||
|
- id: uart_nextion
|
||||||
|
tx_pin: ${tx_pin}
|
||||||
|
rx_pin: ${rx_pin}
|
||||||
|
baud_rate: 115200
|
||||||
|
|
||||||
|
binary_sensor:
|
||||||
|
- platform: nextion
|
||||||
|
page_id: 0
|
||||||
|
component_id: 2
|
||||||
|
name: Nextion Touch Component
|
||||||
|
- platform: nextion
|
||||||
|
id: r0_sensor
|
||||||
|
name: R0 Sensor
|
||||||
|
component_name: page0.r0
|
||||||
|
|
||||||
|
sensor:
|
||||||
|
- platform: nextion
|
||||||
|
id: testnumber
|
||||||
|
name: testnumber
|
||||||
|
variable_name: testnumber
|
||||||
|
- platform: nextion
|
||||||
|
id: testwave
|
||||||
|
name: testwave
|
||||||
|
component_id: 2
|
||||||
|
wave_channel_id: 1
|
||||||
|
|
||||||
|
switch:
|
||||||
|
- platform: nextion
|
||||||
|
id: r0
|
||||||
|
name: R0 Switch
|
||||||
|
component_name: page0.r0
|
||||||
|
|
||||||
|
text_sensor:
|
||||||
|
- platform: nextion
|
||||||
|
name: text0
|
||||||
|
id: text0
|
||||||
|
update_interval: 4s
|
||||||
|
component_name: text0
|
||||||
|
|
||||||
|
display:
|
||||||
|
- platform: nextion
|
||||||
|
id: main_lcd
|
||||||
|
update_interval: 5s
|
||||||
|
on_sleep:
|
||||||
|
then:
|
||||||
|
lambda: 'ESP_LOGD("display","Display went to sleep");'
|
||||||
|
on_wake:
|
||||||
|
then:
|
||||||
|
lambda: 'ESP_LOGD("display","Display woke up");'
|
||||||
|
on_setup:
|
||||||
|
then:
|
||||||
|
lambda: 'ESP_LOGD("display","Display setup completed");'
|
||||||
|
on_page:
|
||||||
|
then:
|
||||||
|
lambda: 'ESP_LOGD("display","Display shows new page %u", x);'
|
||||||
|
on_buffer_overflow:
|
||||||
|
then:
|
||||||
|
logger.log: "Nextion reported a buffer overflow!"
|
@ -1,63 +1,10 @@
|
|||||||
wifi:
|
substitutions:
|
||||||
ssid: MySSID
|
tx_pin: GPIO17
|
||||||
password: password1
|
rx_pin: GPIO16
|
||||||
|
|
||||||
uart:
|
packages:
|
||||||
- id: uart_nextion
|
base: !include common.yaml
|
||||||
tx_pin: 17
|
|
||||||
rx_pin: 16
|
|
||||||
baud_rate: 115200
|
|
||||||
|
|
||||||
binary_sensor:
|
|
||||||
- platform: nextion
|
|
||||||
page_id: 0
|
|
||||||
component_id: 2
|
|
||||||
name: Nextion Touch Component
|
|
||||||
- platform: nextion
|
|
||||||
id: r0_sensor
|
|
||||||
name: R0 Sensor
|
|
||||||
component_name: page0.r0
|
|
||||||
|
|
||||||
sensor:
|
|
||||||
- platform: nextion
|
|
||||||
id: testnumber
|
|
||||||
name: testnumber
|
|
||||||
variable_name: testnumber
|
|
||||||
- platform: nextion
|
|
||||||
id: testwave
|
|
||||||
name: testwave
|
|
||||||
component_id: 2
|
|
||||||
wave_channel_id: 1
|
|
||||||
|
|
||||||
switch:
|
|
||||||
- platform: nextion
|
|
||||||
id: r0
|
|
||||||
name: R0 Switch
|
|
||||||
component_name: page0.r0
|
|
||||||
|
|
||||||
text_sensor:
|
|
||||||
- platform: nextion
|
|
||||||
name: text0
|
|
||||||
id: text0
|
|
||||||
update_interval: 4s
|
|
||||||
component_name: text0
|
|
||||||
|
|
||||||
display:
|
display:
|
||||||
- platform: nextion
|
- id: !extend main_lcd
|
||||||
tft_url: http://esphome.io/default35.tft
|
tft_url: http://esphome.io/default35.tft
|
||||||
update_interval: 5s
|
|
||||||
on_sleep:
|
|
||||||
then:
|
|
||||||
lambda: 'ESP_LOGD("display","Display went to sleep");'
|
|
||||||
on_wake:
|
|
||||||
then:
|
|
||||||
lambda: 'ESP_LOGD("display","Display woke up");'
|
|
||||||
on_setup:
|
|
||||||
then:
|
|
||||||
lambda: 'ESP_LOGD("display","Display setup completed");'
|
|
||||||
on_page:
|
|
||||||
then:
|
|
||||||
lambda: 'ESP_LOGD("display","Display shows new page %u", x);'
|
|
||||||
on_buffer_overflow:
|
|
||||||
then:
|
|
||||||
logger.log: "Nextion reported a buffer overflow!"
|
|
||||||
|
@ -1,63 +1,10 @@
|
|||||||
wifi:
|
substitutions:
|
||||||
ssid: MySSID
|
tx_pin: GPIO4
|
||||||
password: password1
|
rx_pin: GPIO5
|
||||||
|
|
||||||
uart:
|
packages:
|
||||||
- id: uart_nextion
|
base: !include common.yaml
|
||||||
tx_pin: 4
|
|
||||||
rx_pin: 5
|
|
||||||
baud_rate: 115200
|
|
||||||
|
|
||||||
binary_sensor:
|
|
||||||
- platform: nextion
|
|
||||||
page_id: 0
|
|
||||||
component_id: 2
|
|
||||||
name: Nextion Touch Component
|
|
||||||
- platform: nextion
|
|
||||||
id: r0_sensor
|
|
||||||
name: R0 Sensor
|
|
||||||
component_name: page0.r0
|
|
||||||
|
|
||||||
sensor:
|
|
||||||
- platform: nextion
|
|
||||||
id: testnumber
|
|
||||||
name: testnumber
|
|
||||||
variable_name: testnumber
|
|
||||||
- platform: nextion
|
|
||||||
id: testwave
|
|
||||||
name: testwave
|
|
||||||
component_id: 2
|
|
||||||
wave_channel_id: 1
|
|
||||||
|
|
||||||
switch:
|
|
||||||
- platform: nextion
|
|
||||||
id: r0
|
|
||||||
name: R0 Switch
|
|
||||||
component_name: page0.r0
|
|
||||||
|
|
||||||
text_sensor:
|
|
||||||
- platform: nextion
|
|
||||||
name: text0
|
|
||||||
id: text0
|
|
||||||
update_interval: 4s
|
|
||||||
component_name: text0
|
|
||||||
|
|
||||||
display:
|
display:
|
||||||
- platform: nextion
|
- id: !extend main_lcd
|
||||||
tft_url: http://esphome.io/default35.tft
|
tft_url: http://esphome.io/default35.tft
|
||||||
update_interval: 5s
|
|
||||||
on_sleep:
|
|
||||||
then:
|
|
||||||
lambda: 'ESP_LOGD("display","Display went to sleep");'
|
|
||||||
on_wake:
|
|
||||||
then:
|
|
||||||
lambda: 'ESP_LOGD("display","Display woke up");'
|
|
||||||
on_setup:
|
|
||||||
then:
|
|
||||||
lambda: 'ESP_LOGD("display","Display setup completed");'
|
|
||||||
on_page:
|
|
||||||
then:
|
|
||||||
lambda: 'ESP_LOGD("display","Display shows new page %u", x);'
|
|
||||||
on_buffer_overflow:
|
|
||||||
then:
|
|
||||||
logger.log: "Nextion reported a buffer overflow!"
|
|
||||||
|
@ -1,63 +1,10 @@
|
|||||||
wifi:
|
substitutions:
|
||||||
ssid: MySSID
|
tx_pin: GPIO4
|
||||||
password: password1
|
rx_pin: GPIO5
|
||||||
|
|
||||||
uart:
|
packages:
|
||||||
- id: uart_nextion
|
base: !include common.yaml
|
||||||
tx_pin: 4
|
|
||||||
rx_pin: 5
|
|
||||||
baud_rate: 115200
|
|
||||||
|
|
||||||
binary_sensor:
|
|
||||||
- platform: nextion
|
|
||||||
page_id: 0
|
|
||||||
component_id: 2
|
|
||||||
name: Nextion Touch Component
|
|
||||||
- platform: nextion
|
|
||||||
id: r0_sensor
|
|
||||||
name: R0 Sensor
|
|
||||||
component_name: page0.r0
|
|
||||||
|
|
||||||
sensor:
|
|
||||||
- platform: nextion
|
|
||||||
id: testnumber
|
|
||||||
name: testnumber
|
|
||||||
variable_name: testnumber
|
|
||||||
- platform: nextion
|
|
||||||
id: testwave
|
|
||||||
name: testwave
|
|
||||||
component_id: 2
|
|
||||||
wave_channel_id: 1
|
|
||||||
|
|
||||||
switch:
|
|
||||||
- platform: nextion
|
|
||||||
id: r0
|
|
||||||
name: R0 Switch
|
|
||||||
component_name: page0.r0
|
|
||||||
|
|
||||||
text_sensor:
|
|
||||||
- platform: nextion
|
|
||||||
name: text0
|
|
||||||
id: text0
|
|
||||||
update_interval: 4s
|
|
||||||
component_name: text0
|
|
||||||
|
|
||||||
display:
|
display:
|
||||||
- platform: nextion
|
- id: !extend main_lcd
|
||||||
tft_url: http://esphome.io/default35.tft
|
tft_url: http://esphome.io/default35.tft
|
||||||
update_interval: 5s
|
|
||||||
on_sleep:
|
|
||||||
then:
|
|
||||||
lambda: 'ESP_LOGD("display","Display went to sleep");'
|
|
||||||
on_wake:
|
|
||||||
then:
|
|
||||||
lambda: 'ESP_LOGD("display","Display woke up");'
|
|
||||||
on_setup:
|
|
||||||
then:
|
|
||||||
lambda: 'ESP_LOGD("display","Display setup completed");'
|
|
||||||
on_page:
|
|
||||||
then:
|
|
||||||
lambda: 'ESP_LOGD("display","Display shows new page %u", x);'
|
|
||||||
on_buffer_overflow:
|
|
||||||
then:
|
|
||||||
logger.log: "Nextion reported a buffer overflow!"
|
|
||||||
|
@ -1,63 +1,10 @@
|
|||||||
wifi:
|
substitutions:
|
||||||
ssid: MySSID
|
tx_pin: GPIO17
|
||||||
password: password1
|
rx_pin: GPIO16
|
||||||
|
|
||||||
uart:
|
packages:
|
||||||
- id: uart_nextion
|
base: !include common.yaml
|
||||||
tx_pin: 17
|
|
||||||
rx_pin: 16
|
|
||||||
baud_rate: 115200
|
|
||||||
|
|
||||||
binary_sensor:
|
|
||||||
- platform: nextion
|
|
||||||
page_id: 0
|
|
||||||
component_id: 2
|
|
||||||
name: Nextion Touch Component
|
|
||||||
- platform: nextion
|
|
||||||
id: r0_sensor
|
|
||||||
name: R0 Sensor
|
|
||||||
component_name: page0.r0
|
|
||||||
|
|
||||||
sensor:
|
|
||||||
- platform: nextion
|
|
||||||
id: testnumber
|
|
||||||
name: testnumber
|
|
||||||
variable_name: testnumber
|
|
||||||
- platform: nextion
|
|
||||||
id: testwave
|
|
||||||
name: testwave
|
|
||||||
component_id: 2
|
|
||||||
wave_channel_id: 1
|
|
||||||
|
|
||||||
switch:
|
|
||||||
- platform: nextion
|
|
||||||
id: r0
|
|
||||||
name: R0 Switch
|
|
||||||
component_name: page0.r0
|
|
||||||
|
|
||||||
text_sensor:
|
|
||||||
- platform: nextion
|
|
||||||
name: text0
|
|
||||||
id: text0
|
|
||||||
update_interval: 4s
|
|
||||||
component_name: text0
|
|
||||||
|
|
||||||
display:
|
display:
|
||||||
- platform: nextion
|
- id: !extend main_lcd
|
||||||
tft_url: http://esphome.io/default35.tft
|
tft_url: http://esphome.io/default35.tft
|
||||||
update_interval: 5s
|
|
||||||
on_sleep:
|
|
||||||
then:
|
|
||||||
lambda: 'ESP_LOGD("display","Display went to sleep");'
|
|
||||||
on_wake:
|
|
||||||
then:
|
|
||||||
lambda: 'ESP_LOGD("display","Display woke up");'
|
|
||||||
on_setup:
|
|
||||||
then:
|
|
||||||
lambda: 'ESP_LOGD("display","Display setup completed");'
|
|
||||||
on_page:
|
|
||||||
then:
|
|
||||||
lambda: 'ESP_LOGD("display","Display shows new page %u", x);'
|
|
||||||
on_buffer_overflow:
|
|
||||||
then:
|
|
||||||
logger.log: "Nextion reported a buffer overflow!"
|
|
||||||
|
@ -1,63 +1,10 @@
|
|||||||
wifi:
|
substitutions:
|
||||||
ssid: MySSID
|
tx_pin: GPIO4
|
||||||
password: password1
|
rx_pin: GPIO5
|
||||||
|
|
||||||
uart:
|
packages:
|
||||||
- id: uart_nextion
|
base: !include common.yaml
|
||||||
tx_pin: 4
|
|
||||||
rx_pin: 5
|
|
||||||
baud_rate: 115200
|
|
||||||
|
|
||||||
binary_sensor:
|
|
||||||
- platform: nextion
|
|
||||||
page_id: 0
|
|
||||||
component_id: 2
|
|
||||||
name: Nextion Touch Component
|
|
||||||
- platform: nextion
|
|
||||||
id: r0_sensor
|
|
||||||
name: R0 Sensor
|
|
||||||
component_name: page0.r0
|
|
||||||
|
|
||||||
sensor:
|
|
||||||
- platform: nextion
|
|
||||||
id: testnumber
|
|
||||||
name: testnumber
|
|
||||||
variable_name: testnumber
|
|
||||||
- platform: nextion
|
|
||||||
id: testwave
|
|
||||||
name: testwave
|
|
||||||
component_id: 2
|
|
||||||
wave_channel_id: 1
|
|
||||||
|
|
||||||
switch:
|
|
||||||
- platform: nextion
|
|
||||||
id: r0
|
|
||||||
name: R0 Switch
|
|
||||||
component_name: page0.r0
|
|
||||||
|
|
||||||
text_sensor:
|
|
||||||
- platform: nextion
|
|
||||||
name: text0
|
|
||||||
id: text0
|
|
||||||
update_interval: 4s
|
|
||||||
component_name: text0
|
|
||||||
|
|
||||||
display:
|
display:
|
||||||
- platform: nextion
|
- id: !extend main_lcd
|
||||||
tft_url: http://esphome.io/default35.tft
|
tft_url: http://esphome.io/default35.tft
|
||||||
update_interval: 5s
|
|
||||||
on_sleep:
|
|
||||||
then:
|
|
||||||
lambda: 'ESP_LOGD("display","Display went to sleep");'
|
|
||||||
on_wake:
|
|
||||||
then:
|
|
||||||
lambda: 'ESP_LOGD("display","Display woke up");'
|
|
||||||
on_setup:
|
|
||||||
then:
|
|
||||||
lambda: 'ESP_LOGD("display","Display setup completed");'
|
|
||||||
on_page:
|
|
||||||
then:
|
|
||||||
lambda: 'ESP_LOGD("display","Display shows new page %u", x);'
|
|
||||||
on_buffer_overflow:
|
|
||||||
then:
|
|
||||||
logger.log: "Nextion reported a buffer overflow!"
|
|
||||||
|
@ -1,58 +1,7 @@
|
|||||||
uart:
|
substitutions:
|
||||||
- id: uart_nextion
|
tx_pin: GPIO4
|
||||||
tx_pin: 4
|
rx_pin: GPIO5
|
||||||
rx_pin: 5
|
|
||||||
baud_rate: 115200
|
|
||||||
|
|
||||||
binary_sensor:
|
packages:
|
||||||
- platform: nextion
|
base: !include common.yaml
|
||||||
page_id: 0
|
|
||||||
component_id: 2
|
|
||||||
name: Nextion Touch Component
|
|
||||||
- platform: nextion
|
|
||||||
id: r0_sensor
|
|
||||||
name: R0 Sensor
|
|
||||||
component_name: page0.r0
|
|
||||||
|
|
||||||
sensor:
|
|
||||||
- platform: nextion
|
|
||||||
id: testnumber
|
|
||||||
name: testnumber
|
|
||||||
variable_name: testnumber
|
|
||||||
- platform: nextion
|
|
||||||
id: testwave
|
|
||||||
name: testwave
|
|
||||||
component_id: 2
|
|
||||||
wave_channel_id: 1
|
|
||||||
|
|
||||||
switch:
|
|
||||||
- platform: nextion
|
|
||||||
id: r0
|
|
||||||
name: R0 Switch
|
|
||||||
component_name: page0.r0
|
|
||||||
|
|
||||||
text_sensor:
|
|
||||||
- platform: nextion
|
|
||||||
name: text0
|
|
||||||
id: text0
|
|
||||||
update_interval: 4s
|
|
||||||
component_name: text0
|
|
||||||
|
|
||||||
display:
|
|
||||||
- platform: nextion
|
|
||||||
update_interval: 5s
|
|
||||||
on_sleep:
|
|
||||||
then:
|
|
||||||
lambda: 'ESP_LOGD("display","Display went to sleep");'
|
|
||||||
on_wake:
|
|
||||||
then:
|
|
||||||
lambda: 'ESP_LOGD("display","Display woke up");'
|
|
||||||
on_setup:
|
|
||||||
then:
|
|
||||||
lambda: 'ESP_LOGD("display","Display setup completed");'
|
|
||||||
on_page:
|
|
||||||
then:
|
|
||||||
lambda: 'ESP_LOGD("display","Display shows new page %u", x);'
|
|
||||||
on_buffer_overflow:
|
|
||||||
then:
|
|
||||||
logger.log: "Nextion reported a buffer overflow!"
|
|
||||||
|
Loading…
Reference in New Issue
Block a user