mirror of https://github.com/esphome/esphome.git
Merge branch 'dev' into mirage-implementation
This commit is contained in:
commit
0094165256
|
@ -785,6 +785,7 @@ def parse_args(argv):
|
||||||
parser_logs = subparsers.add_parser(
|
parser_logs = subparsers.add_parser(
|
||||||
"logs",
|
"logs",
|
||||||
help="Validate the configuration and show all logs.",
|
help="Validate the configuration and show all logs.",
|
||||||
|
aliases=["log"],
|
||||||
parents=[mqtt_options],
|
parents=[mqtt_options],
|
||||||
)
|
)
|
||||||
parser_logs.add_argument(
|
parser_logs.add_argument(
|
||||||
|
|
|
@ -4,13 +4,14 @@ from esphome.components import i2c
|
||||||
from esphome.const import CONF_ID
|
from esphome.const import CONF_ID
|
||||||
|
|
||||||
DEPENDENCIES = ["i2c"]
|
DEPENDENCIES = ["i2c"]
|
||||||
AUTO_LOAD = ["sensor", "voltage_sampler"]
|
|
||||||
MULTI_CONF = True
|
MULTI_CONF = True
|
||||||
|
|
||||||
ads1115_ns = cg.esphome_ns.namespace("ads1115")
|
ads1115_ns = cg.esphome_ns.namespace("ads1115")
|
||||||
ADS1115Component = ads1115_ns.class_("ADS1115Component", cg.Component, i2c.I2CDevice)
|
ADS1115Component = ads1115_ns.class_("ADS1115Component", cg.Component, i2c.I2CDevice)
|
||||||
|
|
||||||
CONF_CONTINUOUS_MODE = "continuous_mode"
|
CONF_CONTINUOUS_MODE = "continuous_mode"
|
||||||
|
CONF_ADS1115_ID = "ads1115_id"
|
||||||
|
|
||||||
CONFIG_SCHEMA = (
|
CONFIG_SCHEMA = (
|
||||||
cv.Schema(
|
cv.Schema(
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#include "ads1115.h"
|
#include "ads1115.h"
|
||||||
#include "esphome/core/log.h"
|
|
||||||
#include "esphome/core/hal.h"
|
#include "esphome/core/hal.h"
|
||||||
|
#include "esphome/core/log.h"
|
||||||
|
|
||||||
namespace esphome {
|
namespace esphome {
|
||||||
namespace ads1115 {
|
namespace ads1115 {
|
||||||
|
@ -75,25 +75,19 @@ void ADS1115Component::dump_config() {
|
||||||
if (this->is_failed()) {
|
if (this->is_failed()) {
|
||||||
ESP_LOGE(TAG, "Communication with ADS1115 failed!");
|
ESP_LOGE(TAG, "Communication with ADS1115 failed!");
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto *sensor : this->sensors_) {
|
|
||||||
LOG_SENSOR(" ", "Sensor", sensor);
|
|
||||||
ESP_LOGCONFIG(TAG, " Multiplexer: %u", sensor->get_multiplexer());
|
|
||||||
ESP_LOGCONFIG(TAG, " Gain: %u", sensor->get_gain());
|
|
||||||
ESP_LOGCONFIG(TAG, " Resolution: %u", sensor->get_resolution());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
float ADS1115Component::request_measurement(ADS1115Sensor *sensor) {
|
float ADS1115Component::request_measurement(ADS1115Multiplexer multiplexer, ADS1115Gain gain,
|
||||||
|
ADS1115Resolution resolution) {
|
||||||
uint16_t config = this->prev_config_;
|
uint16_t config = this->prev_config_;
|
||||||
// Multiplexer
|
// Multiplexer
|
||||||
// 0bxBBBxxxxxxxxxxxx
|
// 0bxBBBxxxxxxxxxxxx
|
||||||
config &= 0b1000111111111111;
|
config &= 0b1000111111111111;
|
||||||
config |= (sensor->get_multiplexer() & 0b111) << 12;
|
config |= (multiplexer & 0b111) << 12;
|
||||||
|
|
||||||
// Gain
|
// Gain
|
||||||
// 0bxxxxBBBxxxxxxxxx
|
// 0bxxxxBBBxxxxxxxxx
|
||||||
config &= 0b1111000111111111;
|
config &= 0b1111000111111111;
|
||||||
config |= (sensor->get_gain() & 0b111) << 9;
|
config |= (gain & 0b111) << 9;
|
||||||
|
|
||||||
if (!this->continuous_mode_) {
|
if (!this->continuous_mode_) {
|
||||||
// Start conversion
|
// Start conversion
|
||||||
|
@ -132,7 +126,7 @@ float ADS1115Component::request_measurement(ADS1115Sensor *sensor) {
|
||||||
return NAN;
|
return NAN;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sensor->get_resolution() == ADS1015_12_BITS) {
|
if (resolution == ADS1015_12_BITS) {
|
||||||
bool negative = (raw_conversion >> 15) == 1;
|
bool negative = (raw_conversion >> 15) == 1;
|
||||||
|
|
||||||
// shift raw_conversion as it's only 12-bits, left justified
|
// shift raw_conversion as it's only 12-bits, left justified
|
||||||
|
@ -151,8 +145,8 @@ float ADS1115Component::request_measurement(ADS1115Sensor *sensor) {
|
||||||
auto signed_conversion = static_cast<int16_t>(raw_conversion);
|
auto signed_conversion = static_cast<int16_t>(raw_conversion);
|
||||||
|
|
||||||
float millivolts;
|
float millivolts;
|
||||||
float divider = (sensor->get_resolution() == ADS1115_16_BITS) ? 32768.0f : 2048.0f;
|
float divider = (resolution == ADS1115_16_BITS) ? 32768.0f : 2048.0f;
|
||||||
switch (sensor->get_gain()) {
|
switch (gain) {
|
||||||
case ADS1115_GAIN_6P144:
|
case ADS1115_GAIN_6P144:
|
||||||
millivolts = (signed_conversion * 6144) / divider;
|
millivolts = (signed_conversion * 6144) / divider;
|
||||||
break;
|
break;
|
||||||
|
@ -179,14 +173,5 @@ float ADS1115Component::request_measurement(ADS1115Sensor *sensor) {
|
||||||
return millivolts / 1e3f;
|
return millivolts / 1e3f;
|
||||||
}
|
}
|
||||||
|
|
||||||
float ADS1115Sensor::sample() { return this->parent_->request_measurement(this); }
|
|
||||||
void ADS1115Sensor::update() {
|
|
||||||
float v = this->parent_->request_measurement(this);
|
|
||||||
if (!std::isnan(v)) {
|
|
||||||
ESP_LOGD(TAG, "'%s': Got Voltage=%fV", this->get_name().c_str(), v);
|
|
||||||
this->publish_state(v);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace ads1115
|
} // namespace ads1115
|
||||||
} // namespace esphome
|
} // namespace esphome
|
||||||
|
|
|
@ -1,9 +1,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "esphome/core/component.h"
|
|
||||||
#include "esphome/components/sensor/sensor.h"
|
|
||||||
#include "esphome/components/i2c/i2c.h"
|
#include "esphome/components/i2c/i2c.h"
|
||||||
#include "esphome/components/voltage_sampler/voltage_sampler.h"
|
#include "esphome/core/component.h"
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
@ -35,12 +33,8 @@ enum ADS1115Resolution {
|
||||||
ADS1015_12_BITS = 12,
|
ADS1015_12_BITS = 12,
|
||||||
};
|
};
|
||||||
|
|
||||||
class ADS1115Sensor;
|
|
||||||
|
|
||||||
class ADS1115Component : public Component, public i2c::I2CDevice {
|
class ADS1115Component : public Component, public i2c::I2CDevice {
|
||||||
public:
|
public:
|
||||||
void register_sensor(ADS1115Sensor *obj) { this->sensors_.push_back(obj); }
|
|
||||||
/// Set up the internal sensor array.
|
|
||||||
void setup() override;
|
void setup() override;
|
||||||
void dump_config() override;
|
void dump_config() override;
|
||||||
/// HARDWARE_LATE setup priority
|
/// HARDWARE_LATE setup priority
|
||||||
|
@ -48,33 +42,12 @@ class ADS1115Component : public Component, public i2c::I2CDevice {
|
||||||
void set_continuous_mode(bool continuous_mode) { continuous_mode_ = continuous_mode; }
|
void set_continuous_mode(bool continuous_mode) { continuous_mode_ = continuous_mode; }
|
||||||
|
|
||||||
/// Helper method to request a measurement from a sensor.
|
/// Helper method to request a measurement from a sensor.
|
||||||
float request_measurement(ADS1115Sensor *sensor);
|
float request_measurement(ADS1115Multiplexer multiplexer, ADS1115Gain gain, ADS1115Resolution resolution);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
std::vector<ADS1115Sensor *> sensors_;
|
|
||||||
uint16_t prev_config_{0};
|
uint16_t prev_config_{0};
|
||||||
bool continuous_mode_;
|
bool continuous_mode_;
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Internal holder class that is in instance of Sensor so that the hub can create individual sensors.
|
|
||||||
class ADS1115Sensor : public sensor::Sensor, public PollingComponent, public voltage_sampler::VoltageSampler {
|
|
||||||
public:
|
|
||||||
ADS1115Sensor(ADS1115Component *parent) : parent_(parent) {}
|
|
||||||
void update() override;
|
|
||||||
void set_multiplexer(ADS1115Multiplexer multiplexer) { multiplexer_ = multiplexer; }
|
|
||||||
void set_gain(ADS1115Gain gain) { gain_ = gain; }
|
|
||||||
void set_resolution(ADS1115Resolution resolution) { resolution_ = resolution; }
|
|
||||||
float sample() override;
|
|
||||||
uint8_t get_multiplexer() const { return multiplexer_; }
|
|
||||||
uint8_t get_gain() const { return gain_; }
|
|
||||||
uint8_t get_resolution() const { return resolution_; }
|
|
||||||
|
|
||||||
protected:
|
|
||||||
ADS1115Component *parent_;
|
|
||||||
ADS1115Multiplexer multiplexer_;
|
|
||||||
ADS1115Gain gain_;
|
|
||||||
ADS1115Resolution resolution_;
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace ads1115
|
} // namespace ads1115
|
||||||
} // namespace esphome
|
} // namespace esphome
|
||||||
|
|
|
@ -10,8 +10,9 @@ from esphome.const import (
|
||||||
UNIT_VOLT,
|
UNIT_VOLT,
|
||||||
CONF_ID,
|
CONF_ID,
|
||||||
)
|
)
|
||||||
from . import ads1115_ns, ADS1115Component
|
from .. import ads1115_ns, ADS1115Component, CONF_ADS1115_ID
|
||||||
|
|
||||||
|
AUTO_LOAD = ["voltage_sampler"]
|
||||||
DEPENDENCIES = ["ads1115"]
|
DEPENDENCIES = ["ads1115"]
|
||||||
|
|
||||||
ADS1115Multiplexer = ads1115_ns.enum("ADS1115Multiplexer")
|
ADS1115Multiplexer = ads1115_ns.enum("ADS1115Multiplexer")
|
||||||
|
@ -43,20 +44,10 @@ RESOLUTION = {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
def validate_gain(value):
|
|
||||||
if isinstance(value, float):
|
|
||||||
value = f"{value:0.03f}"
|
|
||||||
elif not isinstance(value, str):
|
|
||||||
raise cv.Invalid(f'invalid gain "{value}"')
|
|
||||||
|
|
||||||
return cv.enum(GAIN)(value)
|
|
||||||
|
|
||||||
|
|
||||||
ADS1115Sensor = ads1115_ns.class_(
|
ADS1115Sensor = ads1115_ns.class_(
|
||||||
"ADS1115Sensor", sensor.Sensor, cg.PollingComponent, voltage_sampler.VoltageSampler
|
"ADS1115Sensor", sensor.Sensor, cg.PollingComponent, voltage_sampler.VoltageSampler
|
||||||
)
|
)
|
||||||
|
|
||||||
CONF_ADS1115_ID = "ads1115_id"
|
|
||||||
CONFIG_SCHEMA = (
|
CONFIG_SCHEMA = (
|
||||||
sensor.sensor_schema(
|
sensor.sensor_schema(
|
||||||
ADS1115Sensor,
|
ADS1115Sensor,
|
||||||
|
@ -69,7 +60,7 @@ CONFIG_SCHEMA = (
|
||||||
{
|
{
|
||||||
cv.GenerateID(CONF_ADS1115_ID): cv.use_id(ADS1115Component),
|
cv.GenerateID(CONF_ADS1115_ID): cv.use_id(ADS1115Component),
|
||||||
cv.Required(CONF_MULTIPLEXER): cv.enum(MUX, upper=True, space="_"),
|
cv.Required(CONF_MULTIPLEXER): cv.enum(MUX, upper=True, space="_"),
|
||||||
cv.Required(CONF_GAIN): validate_gain,
|
cv.Required(CONF_GAIN): cv.enum(GAIN, string=True),
|
||||||
cv.Optional(CONF_RESOLUTION, default="16_BITS"): cv.enum(
|
cv.Optional(CONF_RESOLUTION, default="16_BITS"): cv.enum(
|
||||||
RESOLUTION, upper=True, space="_"
|
RESOLUTION, upper=True, space="_"
|
||||||
),
|
),
|
||||||
|
@ -80,13 +71,11 @@ CONFIG_SCHEMA = (
|
||||||
|
|
||||||
|
|
||||||
async def to_code(config):
|
async def to_code(config):
|
||||||
paren = await cg.get_variable(config[CONF_ADS1115_ID])
|
var = cg.new_Pvariable(config[CONF_ID])
|
||||||
var = cg.new_Pvariable(config[CONF_ID], paren)
|
|
||||||
await sensor.register_sensor(var, config)
|
await sensor.register_sensor(var, config)
|
||||||
await cg.register_component(var, config)
|
await cg.register_component(var, config)
|
||||||
|
await cg.register_parented(var, config[CONF_ADS1115_ID])
|
||||||
|
|
||||||
cg.add(var.set_multiplexer(config[CONF_MULTIPLEXER]))
|
cg.add(var.set_multiplexer(config[CONF_MULTIPLEXER]))
|
||||||
cg.add(var.set_gain(config[CONF_GAIN]))
|
cg.add(var.set_gain(config[CONF_GAIN]))
|
||||||
cg.add(var.set_resolution(config[CONF_RESOLUTION]))
|
cg.add(var.set_resolution(config[CONF_RESOLUTION]))
|
||||||
|
|
||||||
cg.add(paren.register_sensor(var))
|
|
|
@ -0,0 +1,30 @@
|
||||||
|
#include "ads1115_sensor.h"
|
||||||
|
|
||||||
|
#include "esphome/core/log.h"
|
||||||
|
|
||||||
|
namespace esphome {
|
||||||
|
namespace ads1115 {
|
||||||
|
|
||||||
|
static const char *const TAG = "ads1115.sensor";
|
||||||
|
|
||||||
|
float ADS1115Sensor::sample() {
|
||||||
|
return this->parent_->request_measurement(this->multiplexer_, this->gain_, this->resolution_);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ADS1115Sensor::update() {
|
||||||
|
float v = this->sample();
|
||||||
|
if (!std::isnan(v)) {
|
||||||
|
ESP_LOGD(TAG, "'%s': Got Voltage=%fV", this->get_name().c_str(), v);
|
||||||
|
this->publish_state(v);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ADS1115Sensor::dump_config() {
|
||||||
|
LOG_SENSOR(" ", "ADS1115 Sensor", this);
|
||||||
|
ESP_LOGCONFIG(TAG, " Multiplexer: %u", this->multiplexer_);
|
||||||
|
ESP_LOGCONFIG(TAG, " Gain: %u", this->gain_);
|
||||||
|
ESP_LOGCONFIG(TAG, " Resolution: %u", this->resolution_);
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace ads1115
|
||||||
|
} // namespace esphome
|
|
@ -0,0 +1,35 @@
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "esphome/core/component.h"
|
||||||
|
#include "esphome/core/helpers.h"
|
||||||
|
|
||||||
|
#include "esphome/components/sensor/sensor.h"
|
||||||
|
#include "esphome/components/voltage_sampler/voltage_sampler.h"
|
||||||
|
|
||||||
|
#include "../ads1115.h"
|
||||||
|
|
||||||
|
namespace esphome {
|
||||||
|
namespace ads1115 {
|
||||||
|
|
||||||
|
/// Internal holder class that is in instance of Sensor so that the hub can create individual sensors.
|
||||||
|
class ADS1115Sensor : public sensor::Sensor,
|
||||||
|
public PollingComponent,
|
||||||
|
public voltage_sampler::VoltageSampler,
|
||||||
|
public Parented<ADS1115Component> {
|
||||||
|
public:
|
||||||
|
void update() override;
|
||||||
|
void set_multiplexer(ADS1115Multiplexer multiplexer) { this->multiplexer_ = multiplexer; }
|
||||||
|
void set_gain(ADS1115Gain gain) { this->gain_ = gain; }
|
||||||
|
void set_resolution(ADS1115Resolution resolution) { this->resolution_ = resolution; }
|
||||||
|
float sample() override;
|
||||||
|
|
||||||
|
void dump_config() override;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
ADS1115Multiplexer multiplexer_;
|
||||||
|
ADS1115Gain gain_;
|
||||||
|
ADS1115Resolution resolution_;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace ads1115
|
||||||
|
} // namespace esphome
|
|
@ -340,6 +340,11 @@ network::IPAddresses EthernetComponent::get_ip_addresses() {
|
||||||
return addresses;
|
return addresses;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
network::IPAddress EthernetComponent::get_dns_address(uint8_t num) {
|
||||||
|
const ip_addr_t *dns_ip = dns_getserver(num);
|
||||||
|
return dns_ip;
|
||||||
|
}
|
||||||
|
|
||||||
void EthernetComponent::eth_event_handler(void *arg, esp_event_base_t event_base, int32_t event, void *event_data) {
|
void EthernetComponent::eth_event_handler(void *arg, esp_event_base_t event_base, int32_t event, void *event_data) {
|
||||||
const char *event_name;
|
const char *event_name;
|
||||||
|
|
||||||
|
|
|
@ -70,6 +70,7 @@ class EthernetComponent : public Component {
|
||||||
void set_manual_ip(const ManualIP &manual_ip);
|
void set_manual_ip(const ManualIP &manual_ip);
|
||||||
|
|
||||||
network::IPAddresses get_ip_addresses();
|
network::IPAddresses get_ip_addresses();
|
||||||
|
network::IPAddress get_dns_address(uint8_t num);
|
||||||
std::string get_use_address() const;
|
std::string get_use_address() const;
|
||||||
void set_use_address(const std::string &use_address);
|
void set_use_address(const std::string &use_address);
|
||||||
bool powerdown();
|
bool powerdown();
|
||||||
|
|
|
@ -9,6 +9,7 @@ namespace ethernet_info {
|
||||||
static const char *const TAG = "ethernet_info";
|
static const char *const TAG = "ethernet_info";
|
||||||
|
|
||||||
void IPAddressEthernetInfo::dump_config() { LOG_TEXT_SENSOR("", "EthernetInfo IPAddress", this); }
|
void IPAddressEthernetInfo::dump_config() { LOG_TEXT_SENSOR("", "EthernetInfo IPAddress", this); }
|
||||||
|
void DNSAddressEthernetInfo::dump_config() { LOG_TEXT_SENSOR("", "EthernetInfo DNS Address", this); }
|
||||||
|
|
||||||
} // namespace ethernet_info
|
} // namespace ethernet_info
|
||||||
} // namespace esphome
|
} // namespace esphome
|
||||||
|
|
|
@ -38,6 +38,27 @@ class IPAddressEthernetInfo : public PollingComponent, public text_sensor::TextS
|
||||||
std::array<text_sensor::TextSensor *, 5> ip_sensors_;
|
std::array<text_sensor::TextSensor *, 5> ip_sensors_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class DNSAddressEthernetInfo : public PollingComponent, public text_sensor::TextSensor {
|
||||||
|
public:
|
||||||
|
void update() override {
|
||||||
|
auto dns_one = ethernet::global_eth_component->get_dns_address(0);
|
||||||
|
auto dns_two = ethernet::global_eth_component->get_dns_address(1);
|
||||||
|
|
||||||
|
std::string dns_results = dns_one.str() + " " + dns_two.str();
|
||||||
|
|
||||||
|
if (dns_results != this->last_results_) {
|
||||||
|
this->last_results_ = dns_results;
|
||||||
|
this->publish_state(dns_results);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
float get_setup_priority() const override { return setup_priority::ETHERNET; }
|
||||||
|
std::string unique_id() override { return get_mac_address() + "-ethernetinfo-dns"; }
|
||||||
|
void dump_config() override;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
std::string last_results_;
|
||||||
|
};
|
||||||
|
|
||||||
} // namespace ethernet_info
|
} // namespace ethernet_info
|
||||||
} // namespace esphome
|
} // namespace esphome
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,7 @@ import esphome.config_validation as cv
|
||||||
from esphome.components import text_sensor
|
from esphome.components import text_sensor
|
||||||
from esphome.const import (
|
from esphome.const import (
|
||||||
CONF_IP_ADDRESS,
|
CONF_IP_ADDRESS,
|
||||||
|
CONF_DNS_ADDRESS,
|
||||||
ENTITY_CATEGORY_DIAGNOSTIC,
|
ENTITY_CATEGORY_DIAGNOSTIC,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -10,14 +11,18 @@ DEPENDENCIES = ["ethernet"]
|
||||||
|
|
||||||
ethernet_info_ns = cg.esphome_ns.namespace("ethernet_info")
|
ethernet_info_ns = cg.esphome_ns.namespace("ethernet_info")
|
||||||
|
|
||||||
IPAddressEsthernetInfo = ethernet_info_ns.class_(
|
IPAddressEthernetInfo = ethernet_info_ns.class_(
|
||||||
"IPAddressEthernetInfo", text_sensor.TextSensor, cg.PollingComponent
|
"IPAddressEthernetInfo", text_sensor.TextSensor, cg.PollingComponent
|
||||||
)
|
)
|
||||||
|
|
||||||
|
DNSAddressEthernetInfo = ethernet_info_ns.class_(
|
||||||
|
"DNSAddressEthernetInfo", text_sensor.TextSensor, cg.PollingComponent
|
||||||
|
)
|
||||||
|
|
||||||
CONFIG_SCHEMA = cv.Schema(
|
CONFIG_SCHEMA = cv.Schema(
|
||||||
{
|
{
|
||||||
cv.Optional(CONF_IP_ADDRESS): text_sensor.text_sensor_schema(
|
cv.Optional(CONF_IP_ADDRESS): text_sensor.text_sensor_schema(
|
||||||
IPAddressEsthernetInfo, entity_category=ENTITY_CATEGORY_DIAGNOSTIC
|
IPAddressEthernetInfo, entity_category=ENTITY_CATEGORY_DIAGNOSTIC
|
||||||
)
|
)
|
||||||
.extend(cv.polling_component_schema("1s"))
|
.extend(cv.polling_component_schema("1s"))
|
||||||
.extend(
|
.extend(
|
||||||
|
@ -27,7 +32,10 @@ CONFIG_SCHEMA = cv.Schema(
|
||||||
)
|
)
|
||||||
for x in range(5)
|
for x in range(5)
|
||||||
}
|
}
|
||||||
)
|
),
|
||||||
|
cv.Optional(CONF_DNS_ADDRESS): text_sensor.text_sensor_schema(
|
||||||
|
DNSAddressEthernetInfo, entity_category=ENTITY_CATEGORY_DIAGNOSTIC
|
||||||
|
).extend(cv.polling_component_schema("1s")),
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -40,3 +48,6 @@ async def to_code(config):
|
||||||
if sensor_conf := conf.get(f"address_{x}"):
|
if sensor_conf := conf.get(f"address_{x}"):
|
||||||
sens = await text_sensor.new_text_sensor(sensor_conf)
|
sens = await text_sensor.new_text_sensor(sensor_conf)
|
||||||
cg.add(ip_info.add_ip_sensors(x, sens))
|
cg.add(ip_info.add_ip_sensors(x, sens))
|
||||||
|
if conf := config.get(CONF_DNS_ADDRESS):
|
||||||
|
dns_info = await text_sensor.new_text_sensor(config[CONF_DNS_ADDRESS])
|
||||||
|
await cg.register_component(dns_info, config[CONF_DNS_ADDRESS])
|
||||||
|
|
|
@ -76,12 +76,27 @@ void HTU21DComponent::update() {
|
||||||
|
|
||||||
float humidity = (float(raw_humidity & 0xFFFC)) * 125.0f / 65536.0f - 6.0f;
|
float humidity = (float(raw_humidity & 0xFFFC)) * 125.0f / 65536.0f - 6.0f;
|
||||||
|
|
||||||
int8_t heater_level = this->get_heater_level();
|
ESP_LOGD(TAG, "Got Humidity=%.1f%%", humidity);
|
||||||
|
|
||||||
ESP_LOGD(TAG, "Got Humidity=%.1f%% Heater Level=%d", humidity, heater_level);
|
|
||||||
|
|
||||||
if (this->humidity_ != nullptr)
|
if (this->humidity_ != nullptr)
|
||||||
this->humidity_->publish_state(humidity);
|
this->humidity_->publish_state(humidity);
|
||||||
|
|
||||||
|
int8_t heater_level;
|
||||||
|
|
||||||
|
// HTU21D does have a heater module but does not have heater level
|
||||||
|
// Setting heater level to 1 in case the heater is ON
|
||||||
|
if (this->sensor_model_ == HTU21D_SENSOR_MODEL_HTU21D) {
|
||||||
|
if (this->is_heater_enabled()) {
|
||||||
|
heater_level = 1;
|
||||||
|
} else {
|
||||||
|
heater_level = 0;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
heater_level = this->get_heater_level();
|
||||||
|
}
|
||||||
|
|
||||||
|
ESP_LOGD(TAG, "Heater Level=%d", heater_level);
|
||||||
|
|
||||||
if (this->heater_ != nullptr)
|
if (this->heater_ != nullptr)
|
||||||
this->heater_->publish_state(heater_level);
|
this->heater_->publish_state(heater_level);
|
||||||
this->status_clear_warning();
|
this->status_clear_warning();
|
||||||
|
|
|
@ -8,6 +8,8 @@
|
||||||
namespace esphome {
|
namespace esphome {
|
||||||
namespace htu21d {
|
namespace htu21d {
|
||||||
|
|
||||||
|
enum HTU21DSensorModels { HTU21D_SENSOR_MODEL_HTU21D = 0, HTU21D_SENSOR_MODEL_SI7021, HTU21D_SENSOR_MODEL_SHT21 };
|
||||||
|
|
||||||
class HTU21DComponent : public PollingComponent, public i2c::I2CDevice {
|
class HTU21DComponent : public PollingComponent, public i2c::I2CDevice {
|
||||||
public:
|
public:
|
||||||
void set_temperature(sensor::Sensor *temperature) { temperature_ = temperature; }
|
void set_temperature(sensor::Sensor *temperature) { temperature_ = temperature; }
|
||||||
|
@ -17,6 +19,7 @@ class HTU21DComponent : public PollingComponent, public i2c::I2CDevice {
|
||||||
/// Setup (reset) the sensor and check connection.
|
/// Setup (reset) the sensor and check connection.
|
||||||
void setup() override;
|
void setup() override;
|
||||||
void dump_config() override;
|
void dump_config() override;
|
||||||
|
void set_sensor_model(HTU21DSensorModels sensor_model) { sensor_model_ = sensor_model; }
|
||||||
/// Update the sensor values (temperature+humidity).
|
/// Update the sensor values (temperature+humidity).
|
||||||
void update() override;
|
void update() override;
|
||||||
|
|
||||||
|
@ -31,6 +34,7 @@ class HTU21DComponent : public PollingComponent, public i2c::I2CDevice {
|
||||||
sensor::Sensor *temperature_{nullptr};
|
sensor::Sensor *temperature_{nullptr};
|
||||||
sensor::Sensor *humidity_{nullptr};
|
sensor::Sensor *humidity_{nullptr};
|
||||||
sensor::Sensor *heater_{nullptr};
|
sensor::Sensor *heater_{nullptr};
|
||||||
|
HTU21DSensorModels sensor_model_{HTU21D_SENSOR_MODEL_HTU21D};
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename... Ts> class SetHeaterLevelAction : public Action<Ts...>, public Parented<HTU21DComponent> {
|
template<typename... Ts> class SetHeaterLevelAction : public Action<Ts...>, public Parented<HTU21DComponent> {
|
||||||
|
|
|
@ -5,6 +5,7 @@ from esphome import automation
|
||||||
from esphome.const import (
|
from esphome.const import (
|
||||||
CONF_HUMIDITY,
|
CONF_HUMIDITY,
|
||||||
CONF_ID,
|
CONF_ID,
|
||||||
|
CONF_MODEL,
|
||||||
CONF_TEMPERATURE,
|
CONF_TEMPERATURE,
|
||||||
DEVICE_CLASS_HUMIDITY,
|
DEVICE_CLASS_HUMIDITY,
|
||||||
DEVICE_CLASS_TEMPERATURE,
|
DEVICE_CLASS_TEMPERATURE,
|
||||||
|
@ -23,10 +24,15 @@ htu21d_ns = cg.esphome_ns.namespace("htu21d")
|
||||||
HTU21DComponent = htu21d_ns.class_(
|
HTU21DComponent = htu21d_ns.class_(
|
||||||
"HTU21DComponent", cg.PollingComponent, i2c.I2CDevice
|
"HTU21DComponent", cg.PollingComponent, i2c.I2CDevice
|
||||||
)
|
)
|
||||||
|
|
||||||
SetHeaterLevelAction = htu21d_ns.class_("SetHeaterLevelAction", automation.Action)
|
SetHeaterLevelAction = htu21d_ns.class_("SetHeaterLevelAction", automation.Action)
|
||||||
SetHeaterAction = htu21d_ns.class_("SetHeaterAction", automation.Action)
|
SetHeaterAction = htu21d_ns.class_("SetHeaterAction", automation.Action)
|
||||||
|
HTU21DSensorModels = htu21d_ns.enum("HTU21DSensorModels")
|
||||||
|
|
||||||
|
MODELS = {
|
||||||
|
"HTU21D": HTU21DSensorModels.HTU21D_SENSOR_MODEL_HTU21D,
|
||||||
|
"SI7021": HTU21DSensorModels.HTU21D_SENSOR_MODEL_SI7021,
|
||||||
|
"SHT21": HTU21DSensorModels.HTU21D_SENSOR_MODEL_SHT21,
|
||||||
|
}
|
||||||
|
|
||||||
CONFIG_SCHEMA = (
|
CONFIG_SCHEMA = (
|
||||||
cv.Schema(
|
cv.Schema(
|
||||||
|
@ -49,6 +55,7 @@ CONFIG_SCHEMA = (
|
||||||
accuracy_decimals=1,
|
accuracy_decimals=1,
|
||||||
state_class=STATE_CLASS_MEASUREMENT,
|
state_class=STATE_CLASS_MEASUREMENT,
|
||||||
),
|
),
|
||||||
|
cv.Optional(CONF_MODEL, default="HTU21D"): cv.enum(MODELS, upper=True),
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
.extend(cv.polling_component_schema("60s"))
|
.extend(cv.polling_component_schema("60s"))
|
||||||
|
@ -73,6 +80,8 @@ async def to_code(config):
|
||||||
sens = await sensor.new_sensor(config[CONF_HEATER])
|
sens = await sensor.new_sensor(config[CONF_HEATER])
|
||||||
cg.add(var.set_heater(sens))
|
cg.add(var.set_heater(sens))
|
||||||
|
|
||||||
|
cg.add(var.set_sensor_model(config[CONF_MODEL]))
|
||||||
|
|
||||||
|
|
||||||
@automation.register_action(
|
@automation.register_action(
|
||||||
"htu21d.set_heater_level",
|
"htu21d.set_heater_level",
|
||||||
|
|
|
@ -729,6 +729,7 @@ void VoiceAssistant::on_event(const api::VoiceAssistantEventResponse &msg) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void VoiceAssistant::on_audio(const api::VoiceAssistantAudio &msg) {
|
void VoiceAssistant::on_audio(const api::VoiceAssistantAudio &msg) {
|
||||||
|
#ifdef USE_SPEAKER // We should never get to this function if there is no speaker anyway
|
||||||
if (this->speaker_buffer_index_ + msg.data.length() < SPEAKER_BUFFER_SIZE) {
|
if (this->speaker_buffer_index_ + msg.data.length() < SPEAKER_BUFFER_SIZE) {
|
||||||
memcpy(this->speaker_buffer_ + this->speaker_buffer_index_, msg.data.data(), msg.data.length());
|
memcpy(this->speaker_buffer_ + this->speaker_buffer_index_, msg.data.data(), msg.data.length());
|
||||||
this->speaker_buffer_index_ += msg.data.length();
|
this->speaker_buffer_index_ += msg.data.length();
|
||||||
|
@ -737,6 +738,7 @@ void VoiceAssistant::on_audio(const api::VoiceAssistantAudio &msg) {
|
||||||
} else {
|
} else {
|
||||||
ESP_LOGE(TAG, "Cannot receive audio, buffer is full");
|
ESP_LOGE(TAG, "Cannot receive audio, buffer is full");
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
VoiceAssistant *global_voice_assistant = nullptr; // NOLINT(cppcoreguidelines-avoid-non-const-global-variables)
|
VoiceAssistant *global_voice_assistant = nullptr; // NOLINT(cppcoreguidelines-avoid-non-const-global-variables)
|
||||||
|
|
|
@ -39,15 +39,10 @@ class IPAddressWiFiInfo : public PollingComponent, public text_sensor::TextSenso
|
||||||
class DNSAddressWifiInfo : public PollingComponent, public text_sensor::TextSensor {
|
class DNSAddressWifiInfo : public PollingComponent, public text_sensor::TextSensor {
|
||||||
public:
|
public:
|
||||||
void update() override {
|
void update() override {
|
||||||
std::string dns_results;
|
|
||||||
|
|
||||||
auto dns_one = wifi::global_wifi_component->get_dns_address(0);
|
auto dns_one = wifi::global_wifi_component->get_dns_address(0);
|
||||||
auto dns_two = wifi::global_wifi_component->get_dns_address(1);
|
auto dns_two = wifi::global_wifi_component->get_dns_address(1);
|
||||||
|
|
||||||
dns_results += "DNS1: ";
|
std::string dns_results = dns_one.str() + " " + dns_two.str();
|
||||||
dns_results += dns_one.str();
|
|
||||||
dns_results += " DNS2: ";
|
|
||||||
dns_results += dns_two.str();
|
|
||||||
|
|
||||||
if (dns_results != this->last_results_) {
|
if (dns_results != this->last_results_) {
|
||||||
this->last_results_ = dns_results;
|
this->last_results_ = dns_results;
|
||||||
|
|
|
@ -12,7 +12,7 @@ pyserial==3.5
|
||||||
platformio==6.1.13 # When updating platformio, also update Dockerfile
|
platformio==6.1.13 # When updating platformio, also update Dockerfile
|
||||||
esptool==4.7.0
|
esptool==4.7.0
|
||||||
click==8.1.7
|
click==8.1.7
|
||||||
esphome-dashboard==20240319.0
|
esphome-dashboard==20240412.0
|
||||||
aioesphomeapi==23.2.0
|
aioesphomeapi==23.2.0
|
||||||
zeroconf==0.131.0
|
zeroconf==0.131.0
|
||||||
python-magic==0.4.27
|
python-magic==0.4.27
|
||||||
|
|
|
@ -15,3 +15,5 @@ text_sensor:
|
||||||
- platform: ethernet_info
|
- platform: ethernet_info
|
||||||
ip_address:
|
ip_address:
|
||||||
name: IP Address
|
name: IP Address
|
||||||
|
dns_address:
|
||||||
|
name: DNS Address
|
||||||
|
|
|
@ -15,3 +15,5 @@ text_sensor:
|
||||||
- platform: ethernet_info
|
- platform: ethernet_info
|
||||||
ip_address:
|
ip_address:
|
||||||
name: IP Address
|
name: IP Address
|
||||||
|
dns_address:
|
||||||
|
name: DNS Address
|
||||||
|
|
|
@ -5,6 +5,7 @@ i2c:
|
||||||
|
|
||||||
sensor:
|
sensor:
|
||||||
- platform: htu21d
|
- platform: htu21d
|
||||||
|
model: htu21d
|
||||||
temperature:
|
temperature:
|
||||||
name: Temperature
|
name: Temperature
|
||||||
humidity:
|
humidity:
|
||||||
|
|
|
@ -5,6 +5,7 @@ i2c:
|
||||||
|
|
||||||
sensor:
|
sensor:
|
||||||
- platform: htu21d
|
- platform: htu21d
|
||||||
|
model: htu21d
|
||||||
temperature:
|
temperature:
|
||||||
name: Temperature
|
name: Temperature
|
||||||
humidity:
|
humidity:
|
||||||
|
|
|
@ -5,6 +5,7 @@ i2c:
|
||||||
|
|
||||||
sensor:
|
sensor:
|
||||||
- platform: htu21d
|
- platform: htu21d
|
||||||
|
model: htu21d
|
||||||
temperature:
|
temperature:
|
||||||
name: Temperature
|
name: Temperature
|
||||||
humidity:
|
humidity:
|
||||||
|
|
|
@ -5,6 +5,7 @@ i2c:
|
||||||
|
|
||||||
sensor:
|
sensor:
|
||||||
- platform: htu21d
|
- platform: htu21d
|
||||||
|
model: htu21d
|
||||||
temperature:
|
temperature:
|
||||||
name: Temperature
|
name: Temperature
|
||||||
humidity:
|
humidity:
|
||||||
|
|
|
@ -5,6 +5,7 @@ i2c:
|
||||||
|
|
||||||
sensor:
|
sensor:
|
||||||
- platform: htu21d
|
- platform: htu21d
|
||||||
|
model: htu21d
|
||||||
temperature:
|
temperature:
|
||||||
name: Temperature
|
name: Temperature
|
||||||
humidity:
|
humidity:
|
||||||
|
|
|
@ -5,6 +5,7 @@ i2c:
|
||||||
|
|
||||||
sensor:
|
sensor:
|
||||||
- platform: htu21d
|
- platform: htu21d
|
||||||
|
model: htu21d
|
||||||
temperature:
|
temperature:
|
||||||
name: Temperature
|
name: Temperature
|
||||||
humidity:
|
humidity:
|
||||||
|
|
|
@ -3,12 +3,146 @@ remote_receiver:
|
||||||
pin: ${pin}
|
pin: ${pin}
|
||||||
rmt_channel: ${rmt_channel}
|
rmt_channel: ${rmt_channel}
|
||||||
dump: all
|
dump: all
|
||||||
|
on_abbwelcome:
|
||||||
|
then:
|
||||||
|
- logger.log:
|
||||||
|
format: "on_abbwelcome: %u"
|
||||||
|
args: ["x.data()[0]"]
|
||||||
|
on_aeha:
|
||||||
|
then:
|
||||||
|
- logger.log:
|
||||||
|
format: "on_aeha: %u %u"
|
||||||
|
args: ["x.address", "x.data.front()"]
|
||||||
|
on_byronsx:
|
||||||
|
then:
|
||||||
|
- logger.log:
|
||||||
|
format: "on_byronsx: %u %u"
|
||||||
|
args: ["x.address", "x.command"]
|
||||||
|
on_canalsat:
|
||||||
|
then:
|
||||||
|
- logger.log:
|
||||||
|
format: "on_canalsat: %u %u"
|
||||||
|
args: ["x.address", "x.command"]
|
||||||
|
# on_canalsatld:
|
||||||
|
# then:
|
||||||
|
# - logger.log:
|
||||||
|
# format: "on_canalsatld: %u %u"
|
||||||
|
# args: ["x.address", "x.command"]
|
||||||
on_coolix:
|
on_coolix:
|
||||||
then:
|
then:
|
||||||
delay: !lambda "return x.first + x.second;"
|
- logger.log:
|
||||||
|
format: "on_coolix: %u %u"
|
||||||
|
args: ["x.first", "x.second"]
|
||||||
|
on_dish:
|
||||||
|
then:
|
||||||
|
- logger.log:
|
||||||
|
format: "on_dish: %u %u"
|
||||||
|
args: ["x.address", "x.command"]
|
||||||
|
on_dooya:
|
||||||
|
then:
|
||||||
|
- logger.log:
|
||||||
|
format: "on_dooya: %u %u %u"
|
||||||
|
args: ["x.channel", "x.button", "x.check"]
|
||||||
|
on_drayton:
|
||||||
|
then:
|
||||||
|
- logger.log:
|
||||||
|
format: "on_drayton: %u %u %u"
|
||||||
|
args: ["x.address", "x.channel", "x.command"]
|
||||||
|
on_jvc:
|
||||||
|
then:
|
||||||
|
- logger.log:
|
||||||
|
format: "on_jvc: %u"
|
||||||
|
args: ["x.data"]
|
||||||
|
on_keeloq:
|
||||||
|
then:
|
||||||
|
- logger.log:
|
||||||
|
format: "on_keeloq: %u %u %u"
|
||||||
|
args: ["x.encrypted", "x.address", "x.command"]
|
||||||
|
on_haier:
|
||||||
|
then:
|
||||||
|
- logger.log:
|
||||||
|
format: "on_haier: %u"
|
||||||
|
args: ["x.data.front()"]
|
||||||
|
on_lg:
|
||||||
|
then:
|
||||||
|
- logger.log:
|
||||||
|
format: "on_lg: %u %u"
|
||||||
|
args: ["x.data", "x.nbits"]
|
||||||
|
on_magiquest:
|
||||||
|
then:
|
||||||
|
- logger.log:
|
||||||
|
format: "on_magiquest: %u %u"
|
||||||
|
args: ["x.magnitude", "x.wand_id"]
|
||||||
|
on_midea:
|
||||||
|
then:
|
||||||
|
- logger.log:
|
||||||
|
format: "on_midea: %u %u"
|
||||||
|
args: ["x.size()", "x.data()[0]"]
|
||||||
|
on_nec:
|
||||||
|
then:
|
||||||
|
- logger.log:
|
||||||
|
format: "on_nec: %u %u"
|
||||||
|
args: ["x.address", "x.command"]
|
||||||
|
on_nexa:
|
||||||
|
then:
|
||||||
|
- logger.log:
|
||||||
|
format: "on_nexa: %u %u %u %u %u"
|
||||||
|
args: ["x.device", "x.group", "x.state", "x.channel", "x.level"]
|
||||||
|
on_panasonic:
|
||||||
|
then:
|
||||||
|
- logger.log:
|
||||||
|
format: "on_panasonic: %u %u"
|
||||||
|
args: ["x.address", "x.command"]
|
||||||
|
on_pioneer:
|
||||||
|
then:
|
||||||
|
- logger.log:
|
||||||
|
format: "on_pioneer: %u %u"
|
||||||
|
args: ["x.rc_code_1", "x.rc_code_2"]
|
||||||
|
on_pronto:
|
||||||
|
then:
|
||||||
|
- logger.log:
|
||||||
|
format: "on_pronto: %s"
|
||||||
|
args: ["x.data.c_str()"]
|
||||||
|
on_raw:
|
||||||
|
then:
|
||||||
|
- logger.log:
|
||||||
|
format: "on_raw: %u"
|
||||||
|
args: ["x.front()"]
|
||||||
|
on_rc5:
|
||||||
|
then:
|
||||||
|
- logger.log:
|
||||||
|
format: "on_rc5: %u %u"
|
||||||
|
args: ["x.address", "x.command"]
|
||||||
|
on_rc6:
|
||||||
|
then:
|
||||||
|
- logger.log:
|
||||||
|
format: "on_rc6: %u %u"
|
||||||
|
args: ["x.address", "x.command"]
|
||||||
on_rc_switch:
|
on_rc_switch:
|
||||||
then:
|
then:
|
||||||
delay: !lambda "return uint32_t(x.code) + x.protocol;"
|
- logger.log:
|
||||||
|
format: "on_rc_switch: %llu %u"
|
||||||
|
args: ["x.code", "x.protocol"]
|
||||||
|
on_samsung:
|
||||||
|
then:
|
||||||
|
- logger.log:
|
||||||
|
format: "on_samsung: %llu %u"
|
||||||
|
args: ["x.data", "x.nbits"]
|
||||||
|
on_samsung36:
|
||||||
|
then:
|
||||||
|
- logger.log:
|
||||||
|
format: "on_samsung36: %u %u"
|
||||||
|
args: ["x.address", "x.command"]
|
||||||
|
on_sony:
|
||||||
|
then:
|
||||||
|
- logger.log:
|
||||||
|
format: "on_sony: %u %u"
|
||||||
|
args: ["x.data", "x.nbits"]
|
||||||
|
on_toshiba_ac:
|
||||||
|
then:
|
||||||
|
- logger.log:
|
||||||
|
format: "on_toshiba_ac: %llu %llu"
|
||||||
|
args: ["x.rc_code_1", "x.rc_code_2"]
|
||||||
on_mirage:
|
on_mirage:
|
||||||
then:
|
then:
|
||||||
- lambda: |-
|
- lambda: |-
|
||||||
|
|
|
@ -2,12 +2,146 @@ remote_receiver:
|
||||||
id: rcvr
|
id: rcvr
|
||||||
pin: GPIO5
|
pin: GPIO5
|
||||||
dump: all
|
dump: all
|
||||||
|
on_abbwelcome:
|
||||||
|
then:
|
||||||
|
- logger.log:
|
||||||
|
format: "on_abbwelcome: %u"
|
||||||
|
args: ["x.data()[0]"]
|
||||||
|
on_aeha:
|
||||||
|
then:
|
||||||
|
- logger.log:
|
||||||
|
format: "on_aeha: %u %u"
|
||||||
|
args: ["x.address", "x.data.front()"]
|
||||||
|
on_byronsx:
|
||||||
|
then:
|
||||||
|
- logger.log:
|
||||||
|
format: "on_byronsx: %u %u"
|
||||||
|
args: ["x.address", "x.command"]
|
||||||
|
on_canalsat:
|
||||||
|
then:
|
||||||
|
- logger.log:
|
||||||
|
format: "on_canalsat: %u %u"
|
||||||
|
args: ["x.address", "x.command"]
|
||||||
|
# on_canalsatld:
|
||||||
|
# then:
|
||||||
|
# - logger.log:
|
||||||
|
# format: "on_canalsatld: %u %u"
|
||||||
|
# args: ["x.address", "x.command"]
|
||||||
on_coolix:
|
on_coolix:
|
||||||
then:
|
then:
|
||||||
delay: !lambda "return x.first + x.second;"
|
- logger.log:
|
||||||
|
format: "on_coolix: %u %u"
|
||||||
|
args: ["x.first", "x.second"]
|
||||||
|
on_dish:
|
||||||
|
then:
|
||||||
|
- logger.log:
|
||||||
|
format: "on_dish: %u %u"
|
||||||
|
args: ["x.address", "x.command"]
|
||||||
|
on_dooya:
|
||||||
|
then:
|
||||||
|
- logger.log:
|
||||||
|
format: "on_dooya: %u %u %u"
|
||||||
|
args: ["x.channel", "x.button", "x.check"]
|
||||||
|
on_drayton:
|
||||||
|
then:
|
||||||
|
- logger.log:
|
||||||
|
format: "on_drayton: %u %u %u"
|
||||||
|
args: ["x.address", "x.channel", "x.command"]
|
||||||
|
on_jvc:
|
||||||
|
then:
|
||||||
|
- logger.log:
|
||||||
|
format: "on_jvc: %u"
|
||||||
|
args: ["x.data"]
|
||||||
|
on_keeloq:
|
||||||
|
then:
|
||||||
|
- logger.log:
|
||||||
|
format: "on_keeloq: %u %u %u"
|
||||||
|
args: ["x.encrypted", "x.address", "x.command"]
|
||||||
|
on_haier:
|
||||||
|
then:
|
||||||
|
- logger.log:
|
||||||
|
format: "on_haier: %u"
|
||||||
|
args: ["x.data.front()"]
|
||||||
|
on_lg:
|
||||||
|
then:
|
||||||
|
- logger.log:
|
||||||
|
format: "on_lg: %u %u"
|
||||||
|
args: ["x.data", "x.nbits"]
|
||||||
|
on_magiquest:
|
||||||
|
then:
|
||||||
|
- logger.log:
|
||||||
|
format: "on_magiquest: %u %u"
|
||||||
|
args: ["x.magnitude", "x.wand_id"]
|
||||||
|
on_midea:
|
||||||
|
then:
|
||||||
|
- logger.log:
|
||||||
|
format: "on_midea: %u %u"
|
||||||
|
args: ["x.size()", "x.data()[0]"]
|
||||||
|
on_nec:
|
||||||
|
then:
|
||||||
|
- logger.log:
|
||||||
|
format: "on_nec: %u %u"
|
||||||
|
args: ["x.address", "x.command"]
|
||||||
|
on_nexa:
|
||||||
|
then:
|
||||||
|
- logger.log:
|
||||||
|
format: "on_nexa: %u %u %u %u %u"
|
||||||
|
args: ["x.device", "x.group", "x.state", "x.channel", "x.level"]
|
||||||
|
on_panasonic:
|
||||||
|
then:
|
||||||
|
- logger.log:
|
||||||
|
format: "on_panasonic: %u %u"
|
||||||
|
args: ["x.address", "x.command"]
|
||||||
|
on_pioneer:
|
||||||
|
then:
|
||||||
|
- logger.log:
|
||||||
|
format: "on_pioneer: %u %u"
|
||||||
|
args: ["x.rc_code_1", "x.rc_code_2"]
|
||||||
|
on_pronto:
|
||||||
|
then:
|
||||||
|
- logger.log:
|
||||||
|
format: "on_pronto: %s"
|
||||||
|
args: ["x.data.c_str()"]
|
||||||
|
on_raw:
|
||||||
|
then:
|
||||||
|
- logger.log:
|
||||||
|
format: "on_raw: %u"
|
||||||
|
args: ["x.front()"]
|
||||||
|
on_rc5:
|
||||||
|
then:
|
||||||
|
- logger.log:
|
||||||
|
format: "on_rc5: %u %u"
|
||||||
|
args: ["x.address", "x.command"]
|
||||||
|
on_rc6:
|
||||||
|
then:
|
||||||
|
- logger.log:
|
||||||
|
format: "on_rc6: %u %u"
|
||||||
|
args: ["x.address", "x.command"]
|
||||||
on_rc_switch:
|
on_rc_switch:
|
||||||
then:
|
then:
|
||||||
delay: !lambda "return uint32_t(x.code) + x.protocol;"
|
- logger.log:
|
||||||
|
format: "on_rc_switch: %llu %u"
|
||||||
|
args: ["x.code", "x.protocol"]
|
||||||
|
on_samsung:
|
||||||
|
then:
|
||||||
|
- logger.log:
|
||||||
|
format: "on_samsung: %llu %u"
|
||||||
|
args: ["x.data", "x.nbits"]
|
||||||
|
on_samsung36:
|
||||||
|
then:
|
||||||
|
- logger.log:
|
||||||
|
format: "on_samsung36: %u %u"
|
||||||
|
args: ["x.address", "x.command"]
|
||||||
|
on_sony:
|
||||||
|
then:
|
||||||
|
- logger.log:
|
||||||
|
format: "on_sony: %u %u"
|
||||||
|
args: ["x.data", "x.nbits"]
|
||||||
|
on_toshiba_ac:
|
||||||
|
then:
|
||||||
|
- logger.log:
|
||||||
|
format: "on_toshiba_ac: %llu %llu"
|
||||||
|
args: ["x.rc_code_1", "x.rc_code_2"]
|
||||||
on_mirage:
|
on_mirage:
|
||||||
then:
|
then:
|
||||||
- lambda: |-
|
- lambda: |-
|
||||||
|
|
|
@ -0,0 +1,18 @@
|
||||||
|
esphome:
|
||||||
|
name: componenttestespbk72xx
|
||||||
|
friendly_name: $component_name
|
||||||
|
|
||||||
|
bk72xx:
|
||||||
|
board: cb3s
|
||||||
|
|
||||||
|
logger:
|
||||||
|
level: VERY_VERBOSE
|
||||||
|
|
||||||
|
packages:
|
||||||
|
component_under_test: !include
|
||||||
|
file: $component_test_file
|
||||||
|
vars:
|
||||||
|
component_name: $component_name
|
||||||
|
test_name: $test_name
|
||||||
|
target_platform: $target_platform
|
||||||
|
component_test_file: $component_test_file
|
Loading…
Reference in New Issue