Merge branch 'dev' into add-graphical-layout-system

This commit is contained in:
Michael Davidson 2024-02-10 12:12:54 +11:00 committed by GitHub
commit 12a58b6b36
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
411 changed files with 9063 additions and 82 deletions

View File

@ -1,6 +1,8 @@
#include "cse7766.h"
#include "esphome/core/log.h"
#include <cinttypes>
#include <iomanip>
#include <sstream>
namespace esphome {
namespace cse7766 {
@ -68,20 +70,26 @@ bool CSE7766Component::check_byte_() {
return true;
}
void CSE7766Component::parse_data_() {
ESP_LOGVV(TAG, "CSE7766 Data: ");
#if ESPHOME_LOG_LEVEL >= ESPHOME_LOG_LEVEL_VERY_VERBOSE
{
std::stringstream ss;
ss << "Raw data:" << std::hex << std::uppercase << std::setfill('0');
for (uint8_t i = 0; i < 23; i++) {
ESP_LOGVV(TAG, " %u: 0b" BYTE_TO_BINARY_PATTERN " (0x%02X)", i + 1, BYTE_TO_BINARY(this->raw_data_[i]),
this->raw_data_[i]);
ss << ' ' << std::setw(2) << static_cast<unsigned>(this->raw_data_[i]);
}
ESP_LOGVV(TAG, "%s", ss.str().c_str());
}
#endif
// Parse header
uint8_t header1 = this->raw_data_[0];
if (header1 == 0xAA) {
ESP_LOGE(TAG, "CSE7766 not calibrated!");
return;
}
bool power_cycle_exceeds_range = false;
if ((header1 & 0xF0) == 0xF0) {
if (header1 & 0xD) {
ESP_LOGE(TAG, "CSE7766 reports abnormal external circuit or chip damage: (0x%02X)", header1);
@ -94,74 +102,106 @@ void CSE7766Component::parse_data_() {
if (header1 & (1 << 0)) {
ESP_LOGE(TAG, " Coefficient storage area is abnormal.");
}
// Datasheet: voltage or current cycle exceeding range means invalid values
return;
}
power_cycle_exceeds_range = header1 & (1 << 1);
}
uint32_t voltage_calib = this->get_24_bit_uint_(2);
// Parse data frame
uint32_t voltage_coeff = this->get_24_bit_uint_(2);
uint32_t voltage_cycle = this->get_24_bit_uint_(5);
uint32_t current_calib = this->get_24_bit_uint_(8);
uint32_t current_coeff = this->get_24_bit_uint_(8);
uint32_t current_cycle = this->get_24_bit_uint_(11);
uint32_t power_calib = this->get_24_bit_uint_(14);
uint32_t power_coeff = this->get_24_bit_uint_(14);
uint32_t power_cycle = this->get_24_bit_uint_(17);
uint8_t adj = this->raw_data_[20];
uint32_t cf_pulses = (this->raw_data_[21] << 8) + this->raw_data_[22];
bool have_power = adj & 0x10;
bool have_current = adj & 0x20;
bool have_voltage = adj & 0x40;
float voltage = 0.0f;
if (have_voltage) {
// voltage cycle of serial port outputted is a complete cycle;
float voltage = voltage_calib / float(voltage_cycle);
if (this->voltage_sensor_ != nullptr)
voltage = voltage_coeff / float(voltage_cycle);
if (this->voltage_sensor_ != nullptr) {
this->voltage_sensor_->publish_state(voltage);
}
bool have_power = adj & 0x10;
float power = 0.0f;
if (have_power) {
// power cycle of serial port outputted is a complete cycle;
// According to the user manual, power cycle exceeding range means the measured power is 0
if (!power_cycle_exceeds_range) {
power = power_calib / float(power_cycle);
}
if (this->power_sensor_ != nullptr)
this->power_sensor_->publish_state(power);
uint32_t difference;
float power = 0.0f;
float energy = 0.0f;
if (power_cycle_exceeds_range) {
// Datasheet: power cycle exceeding range means active power is 0
if (this->power_sensor_ != nullptr) {
this->power_sensor_->publish_state(0.0f);
}
} else if (have_power) {
power = power_coeff / float(power_cycle);
if (this->power_sensor_ != nullptr) {
this->power_sensor_->publish_state(power);
}
// Add CF pulses to the total energy only if we have Power coefficient to multiply by
if (this->cf_pulses_last_ == 0) {
this->cf_pulses_last_ = cf_pulses;
}
uint32_t cf_diff;
if (cf_pulses < this->cf_pulses_last_) {
difference = cf_pulses + (0x10000 - this->cf_pulses_last_);
cf_diff = cf_pulses + (0x10000 - this->cf_pulses_last_);
} else {
difference = cf_pulses - this->cf_pulses_last_;
cf_diff = cf_pulses - this->cf_pulses_last_;
}
this->cf_pulses_last_ = cf_pulses;
this->energy_total_ += difference * float(power_calib) / 1000000.0f / 3600.0f;
energy = cf_diff * float(power_coeff) / 1000000.0f / 3600.0f;
this->energy_total_ += energy;
if (this->energy_sensor_ != nullptr)
this->energy_sensor_->publish_state(this->energy_total_);
} else if ((this->energy_sensor_ != nullptr) && !this->energy_sensor_->has_state()) {
this->energy_sensor_->publish_state(0);
}
if (adj & 0x20) {
// indicates current cycle of serial port outputted is a complete cycle;
float current = 0.0f;
if (have_voltage && !have_power) {
// Testing has shown that when we have voltage and current but not power, that means the power is 0.
// We report a power of 0, which in turn means we should report a current of 0.
if (this->power_sensor_ != nullptr)
this->power_sensor_->publish_state(0);
} else if (power != 0.0f) {
current = current_calib / float(current_cycle);
float calculated_current = 0.0f;
if (have_current) {
// Assumption: if we don't have power measurement, then current is likely below 50mA
if (have_power && voltage > 1.0f) {
calculated_current = power / voltage;
}
if (this->current_sensor_ != nullptr)
// Datasheet: minimum measured current is 50mA
if (calculated_current > 0.05f) {
current = current_coeff / float(current_cycle);
}
if (this->current_sensor_ != nullptr) {
this->current_sensor_->publish_state(current);
}
}
#if ESPHOME_LOG_LEVEL >= ESPHOME_LOG_LEVEL_VERY_VERBOSE
{
std::stringstream ss;
ss << "Parsed:";
if (have_voltage) {
ss << " V=" << voltage << "V";
}
if (have_current) {
ss << " I=" << current * 1000.0f << "mA (~" << calculated_current * 1000.0f << "mA)";
}
if (have_power) {
ss << " P=" << power << "W";
}
if (energy != 0.0f) {
ss << " E=" << energy << "kWh (" << cf_pulses << ")";
}
ESP_LOGVV(TAG, "%s", ss.str().c_str());
}
#endif
}
uint32_t CSE7766Component::get_24_bit_uint_(uint8_t start_index) {

View File

@ -1,7 +1,6 @@
import esphome.codegen as cg
import esphome.config_validation as cv
from esphome import automation
from esphome import core
from esphome.automation import maybe_simple_id
from esphome.const import CONF_ID
from esphome.components import uart
@ -101,7 +100,7 @@ def range_segment_list(input):
largest_distance = -1
for distance in input:
if isinstance(distance, core.Lambda):
if isinstance(distance, cv.Lambda):
continue
m = cv.distance(distance)
if m > 9:
@ -128,14 +127,14 @@ MMWAVE_SETTINGS_SCHEMA = cv.Schema(
cv.Optional(CONF_OUTPUT_LATENCY): {
cv.Required(CONF_DELAY_AFTER_DETECT): cv.templatable(
cv.All(
cv.positive_time_period,
cv.Range(max=core.TimePeriod(seconds=1638.375)),
cv.positive_time_period_milliseconds,
cv.Range(max=cv.TimePeriod(seconds=1638.375)),
)
),
cv.Required(CONF_DELAY_AFTER_DISAPPEAR): cv.templatable(
cv.All(
cv.positive_time_period,
cv.Range(max=core.TimePeriod(seconds=1638.375)),
cv.positive_time_period_milliseconds,
cv.Range(max=cv.TimePeriod(seconds=1638.375)),
)
),
},

View File

@ -50,7 +50,7 @@ class DfrobotSen0395SettingsAction : public Action<Ts...>, public Parented<Dfrob
float detect = this->delay_after_detect_.value(x...);
float disappear = this->delay_after_disappear_.value(x...);
if (detect >= 0 && disappear >= 0) {
this->parent_->enqueue(make_unique<OutputLatencyCommand>(detect, disappear));
this->parent_->enqueue(make_unique<SetLatencyCommand>(detect, disappear));
}
}
if (this->start_after_power_on_.has_value()) {

View File

@ -1,5 +1,7 @@
#include "commands.h"
#include <cmath>
#include "esphome/core/log.h"
#include "dfrobot_sen0395.h"
@ -194,32 +196,22 @@ uint8_t DetRangeCfgCommand::on_message(std::string &message) {
return 0; // Command not done yet.
}
OutputLatencyCommand::OutputLatencyCommand(float delay_after_detection, float delay_after_disappear) {
delay_after_detection = round(delay_after_detection / 0.025) * 0.025;
delay_after_disappear = round(delay_after_disappear / 0.025) * 0.025;
if (delay_after_detection < 0)
delay_after_detection = 0;
if (delay_after_detection > 1638.375)
delay_after_detection = 1638.375;
if (delay_after_disappear < 0)
delay_after_disappear = 0;
if (delay_after_disappear > 1638.375)
delay_after_disappear = 1638.375;
this->delay_after_detection_ = delay_after_detection;
this->delay_after_disappear_ = delay_after_disappear;
this->cmd_ = str_sprintf("outputLatency -1 %.0f %.0f", delay_after_detection / 0.025, delay_after_disappear / 0.025);
SetLatencyCommand::SetLatencyCommand(float delay_after_detection, float delay_after_disappear) {
delay_after_detection = std::round(delay_after_detection / 0.025f) * 0.025f;
delay_after_disappear = std::round(delay_after_disappear / 0.025f) * 0.025f;
this->delay_after_detection_ = clamp(delay_after_detection, 0.0f, 1638.375f);
this->delay_after_disappear_ = clamp(delay_after_disappear, 0.0f, 1638.375f);
this->cmd_ = str_sprintf("setLatency %.03f %.03f", this->delay_after_detection_, this->delay_after_disappear_);
};
uint8_t OutputLatencyCommand::on_message(std::string &message) {
uint8_t SetLatencyCommand::on_message(std::string &message) {
if (message == "sensor is not stopped") {
ESP_LOGE(TAG, "Cannot configure output latency. Sensor is not stopped!");
return 1; // Command done
} else if (message == "Done") {
ESP_LOGI(TAG, "Updated output latency config:");
ESP_LOGI(TAG, "Signal that someone was detected is delayed by %.02fs.", this->delay_after_detection_);
ESP_LOGI(TAG, "Signal that nobody is detected anymore is delayed by %.02fs.", this->delay_after_disappear_);
ESP_LOGI(TAG, "Signal that someone was detected is delayed by %.03f s.", this->delay_after_detection_);
ESP_LOGI(TAG, "Signal that nobody is detected anymore is delayed by %.03f s.", this->delay_after_disappear_);
ESP_LOGD(TAG, "Used command: %s", this->cmd_.c_str());
return 1; // Command done
}

View File

@ -62,9 +62,9 @@ class DetRangeCfgCommand : public Command {
// TODO: Set min max values in component, so they can be published as sensor.
};
class OutputLatencyCommand : public Command {
class SetLatencyCommand : public Command {
public:
OutputLatencyCommand(float delay_after_detection, float delay_after_disappear);
SetLatencyCommand(float delay_after_detection, float delay_after_disappear);
uint8_t on_message(std::string &message) override;
protected:

View File

@ -161,10 +161,12 @@ light::ESPColorView ESP32RMTLEDStripLightOutput::get_view_internal(int32_t index
break;
}
uint8_t multiplier = this->is_rgbw_ ? 4 : 3;
return {this->buf_ + (index * multiplier) + r,
this->buf_ + (index * multiplier) + g,
this->buf_ + (index * multiplier) + b,
this->is_rgbw_ ? this->buf_ + (index * multiplier) + 3 : nullptr,
uint8_t white = this->is_wrgb_ ? 0 : 3;
return {this->buf_ + (index * multiplier) + r + this->is_wrgb_,
this->buf_ + (index * multiplier) + g + this->is_wrgb_,
this->buf_ + (index * multiplier) + b + this->is_wrgb_,
this->is_rgbw_ || this->is_wrgb_ ? this->buf_ + (index * multiplier) + white : nullptr,
&this->effect_data_[index],
&this->correction_};
}

View File

@ -33,7 +33,7 @@ class ESP32RMTLEDStripLightOutput : public light::AddressableLight {
int32_t size() const override { return this->num_leds_; }
light::LightTraits get_traits() override {
auto traits = light::LightTraits();
if (this->is_rgbw_) {
if (this->is_rgbw_ || this->is_wrgb_) {
traits.set_supported_color_modes({light::ColorMode::RGB_WHITE, light::ColorMode::WHITE});
} else {
traits.set_supported_color_modes({light::ColorMode::RGB});
@ -44,6 +44,7 @@ class ESP32RMTLEDStripLightOutput : public light::AddressableLight {
void set_pin(uint8_t pin) { this->pin_ = pin; }
void set_num_leds(uint16_t num_leds) { this->num_leds_ = num_leds; }
void set_is_rgbw(bool is_rgbw) { this->is_rgbw_ = is_rgbw; }
void set_is_wrgb(bool is_wrgb) { this->is_wrgb_ = is_wrgb; }
/// Set a maximum refresh rate in µs as some lights do not like being updated too often.
void set_max_refresh_rate(uint32_t interval_us) { this->max_refresh_rate_ = interval_us; }
@ -72,6 +73,7 @@ class ESP32RMTLEDStripLightOutput : public light::AddressableLight {
uint8_t pin_;
uint16_t num_leds_;
bool is_rgbw_;
bool is_wrgb_;
rmt_item32_t bit0_, bit1_;
RGBOrder rgb_order_;

View File

@ -52,6 +52,7 @@ CHIPSETS = {
CONF_IS_RGBW = "is_rgbw"
CONF_IS_WRGB = "is_wrgb"
CONF_BIT0_HIGH = "bit0_high"
CONF_BIT0_LOW = "bit0_low"
CONF_BIT1_HIGH = "bit1_high"
@ -90,6 +91,7 @@ CONFIG_SCHEMA = cv.All(
cv.Optional(CONF_MAX_REFRESH_RATE): cv.positive_time_period_microseconds,
cv.Optional(CONF_CHIPSET): cv.one_of(*CHIPSETS, upper=True),
cv.Optional(CONF_IS_RGBW, default=False): cv.boolean,
cv.Optional(CONF_IS_WRGB, default=False): cv.boolean,
cv.Inclusive(
CONF_BIT0_HIGH,
"custom",
@ -145,6 +147,7 @@ async def to_code(config):
cg.add(var.set_rgb_order(config[CONF_RGB_ORDER]))
cg.add(var.set_is_rgbw(config[CONF_IS_RGBW]))
cg.add(var.set_is_wrgb(config[CONF_IS_WRGB]))
cg.add(
var.set_rmt_channel(

View File

@ -4,6 +4,7 @@ from esphome.const import (
KEY_TARGET_FRAMEWORK,
KEY_TARGET_PLATFORM,
PLATFORM_HOST,
CONF_MAC_ADDRESS,
)
from esphome.core import CORE
from esphome.helpers import IS_MACOS
@ -28,13 +29,18 @@ def set_core_data(config):
CONFIG_SCHEMA = cv.All(
cv.Schema({}),
cv.Schema(
{
cv.Optional(CONF_MAC_ADDRESS, default="98:35:69:ab:f6:79"): cv.mac_address,
}
),
set_core_data,
)
async def to_code(config):
cg.add_build_flag("-DUSE_HOST")
cg.add_define("USE_ESPHOME_HOST_MAC_ADDRESS", config[CONF_MAC_ADDRESS].parts)
cg.add_build_flag("-std=c++17")
cg.add_build_flag("-lsodium")
if IS_MACOS:

View File

@ -120,6 +120,7 @@ void LightState::loop() {
// Apply transformer (if any)
if (this->transformer_ != nullptr) {
auto values = this->transformer_->apply();
this->is_transformer_active_ = true;
if (values.has_value()) {
this->current_values = *values;
this->output_->update_state(this);
@ -131,6 +132,7 @@ void LightState::loop() {
this->current_values = this->transformer_->get_target_values();
this->transformer_->stop();
this->is_transformer_active_ = false;
this->transformer_ = nullptr;
this->target_state_reached_callback_.call();
}
@ -214,6 +216,8 @@ void LightState::current_values_as_ct(float *color_temperature, float *white_bri
this->gamma_correct_);
}
bool LightState::is_transformer_active() { return this->is_transformer_active_; }
void LightState::start_effect_(uint32_t effect_index) {
this->stop_effect_();
if (effect_index == 0)
@ -263,6 +267,7 @@ void LightState::start_flash_(const LightColorValues &target, uint32_t length, b
}
void LightState::set_immediately_(const LightColorValues &target, bool set_remote_values) {
this->is_transformer_active_ = false;
this->transformer_ = nullptr;
this->current_values = target;
if (set_remote_values) {

View File

@ -144,6 +144,17 @@ class LightState : public EntityBase, public Component {
void current_values_as_ct(float *color_temperature, float *white_brightness);
/**
* Indicator if a transformer (e.g. transition) is active. This is useful
* for effects e.g. at the start of the apply() method, add a check like:
*
* if (this->state_->is_transformer_active()) {
* // Something is already running.
* return;
* }
*/
bool is_transformer_active();
protected:
friend LightOutput;
friend LightCall;
@ -203,6 +214,9 @@ class LightState : public EntityBase, public Component {
LightRestoreMode restore_mode_;
/// List of effects for this light.
std::vector<LightEffect *> effects_;
// for effects, true if a transformer (transition) is active.
bool is_transformer_active_ = false;
};
} // namespace light

View File

@ -3,6 +3,8 @@
#include "esphome/core/component.h"
#include "esphome/core/hal.h"
#include <vector>
namespace esphome {
namespace lightwaverf {

View File

@ -212,6 +212,14 @@ void HOT Logger::log_message_(int level, const char *tag, int offset) {
return;
#endif
#ifdef USE_HOST
time_t rawtime;
struct tm *timeinfo;
char buffer[80];
time(&rawtime);
timeinfo = localtime(&rawtime);
strftime(buffer, sizeof buffer, "[%H:%M:%S]", timeinfo);
fputs(buffer, stdout);
puts(msg);
#endif

View File

@ -62,6 +62,7 @@ from esphome.const import (
DEVICE_CLASS_VOLATILE_ORGANIC_COMPOUNDS_PARTS,
DEVICE_CLASS_VOLTAGE,
DEVICE_CLASS_VOLUME,
DEVICE_CLASS_VOLUME_FLOW_RATE,
DEVICE_CLASS_VOLUME_STORAGE,
DEVICE_CLASS_WATER,
DEVICE_CLASS_WEIGHT,
@ -117,6 +118,7 @@ DEVICE_CLASSES = [
DEVICE_CLASS_VOLATILE_ORGANIC_COMPOUNDS_PARTS,
DEVICE_CLASS_VOLTAGE,
DEVICE_CLASS_VOLUME,
DEVICE_CLASS_VOLUME_FLOW_RATE,
DEVICE_CLASS_VOLUME_STORAGE,
DEVICE_CLASS_WATER,
DEVICE_CLASS_WEIGHT,

View File

@ -82,6 +82,7 @@ from esphome.const import (
DEVICE_CLASS_VOLATILE_ORGANIC_COMPOUNDS_PARTS,
DEVICE_CLASS_VOLTAGE,
DEVICE_CLASS_VOLUME,
DEVICE_CLASS_VOLUME_FLOW_RATE,
DEVICE_CLASS_VOLUME_STORAGE,
DEVICE_CLASS_WATER,
DEVICE_CLASS_WEIGHT,
@ -141,6 +142,7 @@ DEVICE_CLASSES = [
DEVICE_CLASS_VOLATILE_ORGANIC_COMPOUNDS_PARTS,
DEVICE_CLASS_VOLTAGE,
DEVICE_CLASS_VOLUME,
DEVICE_CLASS_VOLUME_FLOW_RATE,
DEVICE_CLASS_VOLUME_STORAGE,
DEVICE_CLASS_WATER,
DEVICE_CLASS_WEIGHT,

View File

@ -25,6 +25,7 @@ namespace sntp {
static const char *const TAG = "sntp";
void SNTPComponent::setup() {
#ifndef USE_HOST
ESP_LOGCONFIG(TAG, "Setting up SNTP...");
#if defined(USE_ESP32) || defined(USE_LIBRETINY)
if (sntp_enabled()) {
@ -48,6 +49,7 @@ void SNTPComponent::setup() {
#endif
sntp_init();
#endif
}
void SNTPComponent::dump_config() {
ESP_LOGCONFIG(TAG, "SNTP Time:");
@ -57,7 +59,7 @@ void SNTPComponent::dump_config() {
ESP_LOGCONFIG(TAG, " Timezone: '%s'", this->timezone_.c_str());
}
void SNTPComponent::update() {
#ifndef USE_ESP_IDF
#if !defined(USE_ESP_IDF) && !defined(USE_HOST)
// force resync
if (sntp_enabled()) {
sntp_stop();

View File

@ -28,7 +28,7 @@ class Filter {
* @param value The new value.
* @return An optional string, the new value that should be pushed out.
*/
virtual optional<std::string> new_value(std::string value);
virtual optional<std::string> new_value(std::string value) = 0;
/// Initialize this filter, please note this can be called more than once.
virtual void initialize(TextSensor *parent, Filter *next);

View File

@ -8,6 +8,8 @@ wled_ns = cg.esphome_ns.namespace("wled")
WLEDLightEffect = wled_ns.class_("WLEDLightEffect", AddressableLightEffect)
CONFIG_SCHEMA = cv.All(cv.Schema({}), cv.only_with_arduino)
CONF_SYNC_GROUP_MASK = "sync_group_mask"
CONF_BLANK_ON_START = "blank_on_start"
@register_addressable_effect(
@ -16,10 +18,13 @@ CONFIG_SCHEMA = cv.All(cv.Schema({}), cv.only_with_arduino)
"WLED",
{
cv.Optional(CONF_PORT, default=21324): cv.port,
cv.Optional(CONF_SYNC_GROUP_MASK, default=0): cv.int_range(min=0, max=255),
cv.Optional(CONF_BLANK_ON_START, default=True): cv.boolean,
},
)
async def wled_light_effect_to_code(config, effect_id):
effect = cg.new_Pvariable(effect_id, config[CONF_NAME])
cg.add(effect.set_port(config[CONF_PORT]))
cg.add(effect.set_sync_group_mask(config[CONF_SYNC_GROUP_MASK]))
cg.add(effect.set_blank_on_start(config[CONF_BLANK_ON_START]))
return effect

View File

@ -13,6 +13,10 @@
#include <WiFiUdp.h>
#endif
#ifdef USE_BK72XX
#include <WiFiUdp.h>
#endif
namespace esphome {
namespace wled {
@ -29,7 +33,11 @@ WLEDLightEffect::WLEDLightEffect(const std::string &name) : AddressableLightEffe
void WLEDLightEffect::start() {
AddressableLightEffect::start();
blank_at_ = 0;
if (this->blank_on_start_) {
this->blank_at_ = 0;
} else {
this->blank_at_ = UINT32_MAX;
}
}
void WLEDLightEffect::stop() {
@ -101,8 +109,11 @@ bool WLEDLightEffect::parse_frame_(light::AddressableLight &it, const uint8_t *p
if (!parse_drgb_frame_(it, payload, size))
return false;
} else {
if (!parse_notifier_frame_(it, payload, size))
if (!parse_notifier_frame_(it, payload, size)) {
return false;
} else {
timeout = UINT8_MAX;
}
}
break;
@ -143,8 +154,32 @@ bool WLEDLightEffect::parse_frame_(light::AddressableLight &it, const uint8_t *p
}
bool WLEDLightEffect::parse_notifier_frame_(light::AddressableLight &it, const uint8_t *payload, uint16_t size) {
// Packet needs to be empty
return size == 0;
// Receive at least RGBW and Brightness for all LEDs from WLED Sync Notification
// https://kno.wled.ge/interfaces/udp-notifier/
// https://github.com/Aircoookie/WLED/blob/main/wled00/udp.cpp
if (size < 34) {
return false;
}
uint8_t payload_sync_group_mask = payload[34];
if ((payload_sync_group_mask & this->sync_group_mask_) != this->sync_group_mask_) {
ESP_LOGD(TAG, "sync group mask does not match");
return false;
}
uint8_t bri = payload[0];
uint8_t r = esp_scale8(payload[1], bri);
uint8_t g = esp_scale8(payload[2], bri);
uint8_t b = esp_scale8(payload[3], bri);
uint8_t w = esp_scale8(payload[8], bri);
for (auto &&led : it) {
led.set(Color(r, g, b, w));
}
return true;
}
bool WLEDLightEffect::parse_warls_frame_(light::AddressableLight &it, const uint8_t *payload, uint16_t size) {

View File

@ -21,6 +21,8 @@ class WLEDLightEffect : public light::AddressableLightEffect {
void stop() override;
void apply(light::AddressableLight &it, const Color &current_color) override;
void set_port(uint16_t port) { this->port_ = port; }
void set_sync_group_mask(uint8_t mask) { this->sync_group_mask_ = mask; }
void set_blank_on_start(bool blank) { this->blank_on_start_ = blank; }
protected:
void blank_all_leds_(light::AddressableLight &it);
@ -35,6 +37,8 @@ class WLEDLightEffect : public light::AddressableLightEffect {
std::unique_ptr<UDP> udp_;
uint32_t blank_at_{0};
uint32_t dropped_{0};
uint8_t sync_group_mask_{0};
bool blank_on_start_{true};
};
} // namespace wled

View File

@ -1084,6 +1084,7 @@ DEVICE_CLASS_VOLATILE_ORGANIC_COMPOUNDS = "volatile_organic_compounds"
DEVICE_CLASS_VOLATILE_ORGANIC_COMPOUNDS_PARTS = "volatile_organic_compounds_parts"
DEVICE_CLASS_VOLTAGE = "voltage"
DEVICE_CLASS_VOLUME = "volume"
DEVICE_CLASS_VOLUME_FLOW_RATE = "volume_flow_rate"
DEVICE_CLASS_VOLUME_STORAGE = "volume_storage"
DEVICE_CLASS_WATER = "water"
DEVICE_CLASS_WEIGHT = "weight"

View File

@ -1,8 +1,9 @@
#pragma once
#include <string>
#include <functional>
#include <cmath>
#include <cstdint>
#include <functional>
#include <string>
#include "esphome/core/optional.h"

View File

@ -11,6 +11,12 @@
#include <cstdio>
#include <cstring>
#ifdef USE_HOST
#include <net/if.h>
#include <netinet/in.h>
#include <sys/ioctl.h>
#include <unistd.h>
#endif
#if defined(USE_ESP8266)
#include <osapi.h>
#include <user_interface.h>
@ -415,7 +421,7 @@ std::string value_accuracy_to_string(float value, int8_t accuracy_decimals) {
int8_t step_to_accuracy_decimals(float step) {
// use printf %g to find number of digits based on temperature step
char buf[32];
sprintf(buf, "%.5g", step);
snprintf(buf, sizeof buf, "%.5g", step);
std::string str{buf};
size_t dot_pos = str.find('.');
@ -551,7 +557,10 @@ void HighFrequencyLoopRequester::stop() {
bool HighFrequencyLoopRequester::is_high_frequency() { return num_requests > 0; }
void get_mac_address_raw(uint8_t *mac) { // NOLINT(readability-non-const-parameter)
#if defined(USE_ESP32)
#if defined(USE_HOST)
static const uint8_t esphome_host_mac_address[6] = USE_ESPHOME_HOST_MAC_ADDRESS;
memcpy(mac, esphome_host_mac_address, sizeof(esphome_host_mac_address));
#elif defined(USE_ESP32)
#if defined(CONFIG_SOC_IEEE802154_SUPPORTED) || defined(USE_ESP32_IGNORE_EFUSE_MAC_CRC)
// When CONFIG_SOC_IEEE802154_SUPPORTED is defined, esp_efuse_mac_get_default
// returns the 802.15.4 EUI-64 address. Read directly from eFuse instead.
@ -569,6 +578,8 @@ void get_mac_address_raw(uint8_t *mac) { // NOLINT(readability-non-const-parame
WiFi.macAddress(mac);
#elif defined(USE_LIBRETINY)
WiFi.macAddress(mac);
#else
// this should be an error, but that messes with CI checks. #error No mac address method defined
#endif
}
std::string get_mac_address() {

View File

@ -1,5 +1,6 @@
#pragma once
#include <cstdint>
#include <cstdlib>
#include <ctime>
#include <string>

View File

@ -1,4 +1,5 @@
async_timeout==4.0.3; python_version <= "3.10"
cryptography==42.0.2
voluptuous==0.14.1
PyYAML==6.0.1
paho-mqtt==1.6.1
@ -12,7 +13,7 @@ platformio==6.1.13 # When updating platformio, also update Dockerfile
esptool==4.7.0
click==8.1.7
esphome-dashboard==20231107.0
aioesphomeapi==21.0.1
aioesphomeapi==21.0.2
zeroconf==0.131.0
python-magic==0.4.27

View File

@ -1,3 +1,2 @@
pillow==10.2.0
cairosvg==2.7.1
cryptography==41.0.4

View File

@ -0,0 +1,13 @@
uart:
- id: uart_a01nyub
tx_pin:
number: 4
rx_pin:
number: 5
baud_rate: 9600
sensor:
- platform: a01nyub
id: a01nyub_sensor
name: a01nyub Distance
uart_id: uart_a01nyub

View File

@ -0,0 +1,13 @@
uart:
- id: uart_a01nyub
tx_pin:
number: 4
rx_pin:
number: 5
baud_rate: 9600
sensor:
- platform: a01nyub
id: a01nyub_sensor
name: a01nyub Distance
uart_id: uart_a01nyub

View File

@ -0,0 +1,13 @@
uart:
- id: uart_a01nyub
tx_pin:
number: 17
rx_pin:
number: 16
baud_rate: 9600
sensor:
- platform: a01nyub
id: a01nyub_sensor
name: a01nyub Distance
uart_id: uart_a01nyub

View File

@ -0,0 +1,13 @@
uart:
- id: uart_a01nyub
tx_pin:
number: 17
rx_pin:
number: 16
baud_rate: 9600
sensor:
- platform: a01nyub
id: a01nyub_sensor
name: a01nyub Distance
uart_id: uart_a01nyub

View File

@ -0,0 +1,13 @@
uart:
- id: uart_a01nyub
tx_pin:
number: 4
rx_pin:
number: 5
baud_rate: 9600
sensor:
- platform: a01nyub
id: a01nyub_sensor
name: a01nyub Distance
uart_id: uart_a01nyub

View File

@ -0,0 +1,13 @@
uart:
- id: uart_a01nyub
tx_pin:
number: 4
rx_pin:
number: 5
baud_rate: 9600
sensor:
- platform: a01nyub
id: a01nyub_sensor
name: a01nyub Distance
uart_id: uart_a01nyub

View File

@ -0,0 +1,13 @@
uart:
- id: uart_a02yyuw
tx_pin:
number: 4
rx_pin:
number: 5
baud_rate: 9600
sensor:
- platform: a02yyuw
id: a02yyuw_sensor
name: a02yyuw Distance
uart_id: uart_a02yyuw

View File

@ -0,0 +1,13 @@
uart:
- id: uart_a02yyuw
tx_pin:
number: 4
rx_pin:
number: 5
baud_rate: 9600
sensor:
- platform: a02yyuw
id: a02yyuw_sensor
name: a02yyuw Distance
uart_id: uart_a02yyuw

View File

@ -0,0 +1,13 @@
uart:
- id: uart_a02yyuw
tx_pin:
number: 17
rx_pin:
number: 16
baud_rate: 9600
sensor:
- platform: a02yyuw
id: a02yyuw_sensor
name: a02yyuw Distance
uart_id: uart_a02yyuw

View File

@ -0,0 +1,13 @@
uart:
- id: uart_a02yyuw
tx_pin:
number: 17
rx_pin:
number: 16
baud_rate: 9600
sensor:
- platform: a02yyuw
id: a02yyuw_sensor
name: a02yyuw Distance
uart_id: uart_a02yyuw

View File

@ -0,0 +1,13 @@
uart:
- id: uart_a02yyuw
tx_pin:
number: 4
rx_pin:
number: 5
baud_rate: 9600
sensor:
- platform: a02yyuw
id: a02yyuw_sensor
name: a02yyuw Distance
uart_id: uart_a02yyuw

View File

@ -0,0 +1,13 @@
uart:
- id: uart_a02yyuw
tx_pin:
number: 4
rx_pin:
number: 5
baud_rate: 9600
sensor:
- platform: a02yyuw
id: a02yyuw_sensor
name: a02yyuw Distance
uart_id: uart_a02yyuw

View File

@ -0,0 +1,12 @@
stepper:
- platform: a4988
id: a4988_stepper
step_pin:
number: 2
dir_pin:
number: 3
sleep_pin:
number: 5
max_speed: 250 steps/s
acceleration: 100 steps/s^2
deceleration: 200 steps/s^2

View File

@ -0,0 +1,12 @@
stepper:
- platform: a4988
id: a4988_stepper
step_pin:
number: 2
dir_pin:
number: 3
sleep_pin:
number: 5
max_speed: 250 steps/s
acceleration: 100 steps/s^2
deceleration: 200 steps/s^2

View File

@ -0,0 +1,12 @@
stepper:
- platform: a4988
id: a4988_stepper
step_pin:
number: 22
dir_pin:
number: 23
sleep_pin:
number: 25
max_speed: 250 steps/s
acceleration: 100 steps/s^2
deceleration: 200 steps/s^2

View File

@ -0,0 +1,12 @@
stepper:
- platform: a4988
id: a4988_stepper
step_pin:
number: 22
dir_pin:
number: 23
sleep_pin:
number: 25
max_speed: 250 steps/s
acceleration: 100 steps/s^2
deceleration: 200 steps/s^2

View File

@ -0,0 +1,12 @@
stepper:
- platform: a4988
id: a4988_stepper
step_pin:
number: 1
dir_pin:
number: 2
sleep_pin:
number: 5
max_speed: 250 steps/s
acceleration: 100 steps/s^2
deceleration: 200 steps/s^2

View File

@ -0,0 +1,12 @@
stepper:
- platform: a4988
id: a4988_stepper
step_pin:
number: 2
dir_pin:
number: 3
sleep_pin:
number: 5
max_speed: 250 steps/s
acceleration: 100 steps/s^2
deceleration: 200 steps/s^2

View File

@ -0,0 +1,21 @@
sensor:
- platform: absolute_humidity
name: Absolute Humidity
temperature: template_temperature
humidity: template_humidity
- platform: template
id: template_humidity
lambda: |-
if (millis() > 10000) {
return 0.6;
} else {
return 0.0;
}
- platform: template
id: template_temperature
lambda: |-
if (millis() > 10000) {
return 42.0;
} else {
return 0.0;
}

View File

@ -0,0 +1,21 @@
sensor:
- platform: absolute_humidity
name: Absolute Humidity
temperature: template_temperature
humidity: template_humidity
- platform: template
id: template_humidity
lambda: |-
if (millis() > 10000) {
return 0.6;
} else {
return 0.0;
}
- platform: template
id: template_temperature
lambda: |-
if (millis() > 10000) {
return 42.0;
} else {
return 0.0;
}

View File

@ -0,0 +1,21 @@
sensor:
- platform: absolute_humidity
name: Absolute Humidity
temperature: template_temperature
humidity: template_humidity
- platform: template
id: template_humidity
lambda: |-
if (millis() > 10000) {
return 0.6;
} else {
return 0.0;
}
- platform: template
id: template_temperature
lambda: |-
if (millis() > 10000) {
return 42.0;
} else {
return 0.0;
}

View File

@ -0,0 +1,21 @@
sensor:
- platform: absolute_humidity
name: Absolute Humidity
temperature: template_temperature
humidity: template_humidity
- platform: template
id: template_humidity
lambda: |-
if (millis() > 10000) {
return 0.6;
} else {
return 0.0;
}
- platform: template
id: template_temperature
lambda: |-
if (millis() > 10000) {
return 42.0;
} else {
return 0.0;
}

View File

@ -0,0 +1,21 @@
sensor:
- platform: absolute_humidity
name: Absolute Humidity
temperature: template_temperature
humidity: template_humidity
- platform: template
id: template_humidity
lambda: |-
if (millis() > 10000) {
return 0.6;
} else {
return 0.0;
}
- platform: template
id: template_temperature
lambda: |-
if (millis() > 10000) {
return 42.0;
} else {
return 0.0;
}

View File

@ -0,0 +1,21 @@
sensor:
- platform: absolute_humidity
name: Absolute Humidity
temperature: template_temperature
humidity: template_humidity
- platform: template
id: template_humidity
lambda: |-
if (millis() > 10000) {
return 0.6;
} else {
return 0.0;
}
- platform: template
id: template_temperature
lambda: |-
if (millis() > 10000) {
return 42.0;
} else {
return 0.0;
}

View File

@ -0,0 +1,7 @@
output:
- platform: ac_dimmer
id: ac_dimmer_1
gate_pin:
number: 5
zero_cross_pin:
number: 6

View File

@ -0,0 +1,7 @@
output:
- platform: ac_dimmer
id: ac_dimmer_1
gate_pin:
number: 12
zero_cross_pin:
number: 13

View File

@ -0,0 +1,7 @@
output:
- platform: ac_dimmer
id: ac_dimmer_1
gate_pin:
number: 5
zero_cross_pin:
number: 4

View File

@ -0,0 +1,7 @@
output:
- platform: ac_dimmer
id: ac_dimmer_1
gate_pin:
number: 5
zero_cross_pin:
number: 6

View File

@ -0,0 +1,14 @@
spi:
- id: spi_adc128s102
clk_pin: 6
mosi_pin: 7
miso_pin: 5
adc128s102:
cs_pin: 8
id: adc128s102_adc
sensor:
- platform: adc128s102
id: adc128s102_channel_0
channel: 0

View File

@ -0,0 +1,14 @@
spi:
- id: spi_adc128s102
clk_pin: 6
mosi_pin: 7
miso_pin: 5
adc128s102:
cs_pin: 8
id: adc128s102_adc
sensor:
- platform: adc128s102
id: adc128s102_channel_0
channel: 0

View File

@ -0,0 +1,14 @@
spi:
- id: spi_adc128s102
clk_pin: 16
mosi_pin: 17
miso_pin: 15
adc128s102:
cs_pin: 12
id: adc128s102_adc
sensor:
- platform: adc128s102
id: adc128s102_channel_0
channel: 0

View File

@ -0,0 +1,14 @@
spi:
- id: spi_adc128s102
clk_pin: 16
mosi_pin: 17
miso_pin: 15
adc128s102:
cs_pin: 12
id: adc128s102_adc
sensor:
- platform: adc128s102
id: adc128s102_channel_0
channel: 0

View File

@ -0,0 +1,14 @@
spi:
- id: spi_adc128s102
clk_pin: 14
mosi_pin: 13
miso_pin: 12
adc128s102:
cs_pin: 15
id: adc128s102_adc
sensor:
- platform: adc128s102
id: adc128s102_channel_0
channel: 0

View File

@ -0,0 +1,14 @@
spi:
- id: spi_adc128s102
clk_pin: 2
mosi_pin: 3
miso_pin: 4
adc128s102:
cs_pin: 5
id: adc128s102_adc
sensor:
- platform: adc128s102
id: adc128s102_channel_0
channel: 0

View File

@ -0,0 +1,31 @@
light:
- platform: esp32_rmt_led_strip
id: led_matrix_32x8
default_transition_length: 500ms
chipset: ws2812
rgb_order: GRB
num_leds: 256
pin: 2
rmt_channel: 0
display:
- platform: addressable_light
id: led_matrix_32x8_display
addressable_light_id: led_matrix_32x8
width: 32
height: 8
pixel_mapper: |-
if (x % 2 == 0) {
return (x * 8) + y;
}
return (x * 8) + (7 - y);
lambda: |-
Color red = Color(0xFF0000);
Color green = Color(0x00FF00);
Color blue = Color(0x0000FF);
it.rectangle(0, 0, it.get_width(), it.get_height(), red);
it.rectangle(1, 1, it.get_width()-2, it.get_height()-2, green);
it.rectangle(2, 2, it.get_width()-4, it.get_height()-4, blue);
it.rectangle(3, 3, it.get_width()-6, it.get_height()-6, red);
rotation: 0°
update_interval: 16ms

View File

@ -0,0 +1,31 @@
light:
- platform: esp32_rmt_led_strip
id: led_matrix_32x8
default_transition_length: 500ms
chipset: ws2812
rgb_order: GRB
num_leds: 256
pin: 2
rmt_channel: 0
display:
- platform: addressable_light
id: led_matrix_32x8_display
addressable_light_id: led_matrix_32x8
width: 32
height: 8
pixel_mapper: |-
if (x % 2 == 0) {
return (x * 8) + y;
}
return (x * 8) + (7 - y);
lambda: |-
Color red = Color(0xFF0000);
Color green = Color(0x00FF00);
Color blue = Color(0x0000FF);
it.rectangle(0, 0, it.get_width(), it.get_height(), red);
it.rectangle(1, 1, it.get_width()-2, it.get_height()-2, green);
it.rectangle(2, 2, it.get_width()-4, it.get_height()-4, blue);
it.rectangle(3, 3, it.get_width()-6, it.get_height()-6, red);
rotation: 0°
update_interval: 16ms

View File

@ -0,0 +1,31 @@
light:
- platform: esp32_rmt_led_strip
id: led_matrix_32x8
default_transition_length: 500ms
chipset: ws2812
rgb_order: GRB
num_leds: 256
pin: 2
rmt_channel: 0
display:
- platform: addressable_light
id: led_matrix_32x8_display
addressable_light_id: led_matrix_32x8
width: 32
height: 8
pixel_mapper: |-
if (x % 2 == 0) {
return (x * 8) + y;
}
return (x * 8) + (7 - y);
lambda: |-
Color red = Color(0xFF0000);
Color green = Color(0x00FF00);
Color blue = Color(0x0000FF);
it.rectangle(0, 0, it.get_width(), it.get_height(), red);
it.rectangle(1, 1, it.get_width()-2, it.get_height()-2, green);
it.rectangle(2, 2, it.get_width()-4, it.get_height()-4, blue);
it.rectangle(3, 3, it.get_width()-6, it.get_height()-6, red);
rotation: 0°
update_interval: 16ms

View File

@ -0,0 +1,32 @@
light:
- platform: fastled_clockless
id: led_matrix_32x8
name: led_matrix_32x8
chipset: WS2812B
pin: 2
num_leds: 256
rgb_order: GRB
default_transition_length: 0s
color_correct: [50%, 50%, 50%]
display:
- platform: addressable_light
id: led_matrix_32x8_display
addressable_light_id: led_matrix_32x8
width: 32
height: 8
pixel_mapper: |-
if (x % 2 == 0) {
return (x * 8) + y;
}
return (x * 8) + (7 - y);
lambda: |-
Color red = Color(0xFF0000);
Color green = Color(0x00FF00);
Color blue = Color(0x0000FF);
it.rectangle(0, 0, it.get_width(), it.get_height(), red);
it.rectangle(1, 1, it.get_width()-2, it.get_height()-2, green);
it.rectangle(2, 2, it.get_width()-4, it.get_height()-4, blue);
it.rectangle(3, 3, it.get_width()-6, it.get_height()-6, red);
rotation: 0°
update_interval: 16ms

View File

@ -0,0 +1,34 @@
i2c:
- id: i2c_ade7953
scl: 5
sda: 4
sensor:
- platform: ade7953_i2c
irq_pin: 6
voltage:
name: ADE7953 Voltage
id: ade7953_voltage
current_a:
name: ADE7953 Current A
id: ade7953_current_a
current_b:
name: ADE7953 Current B
id: ade7953_current_b
power_factor_a:
name: ADE7953 Power Factor A
power_factor_b:
name: ADE7953 Power Factor B
apparent_power_a:
name: ADE7953 Apparent Power A
apparent_power_b:
name: ADE7953 Apparent Power B
active_power_a:
name: ADE7953 Active Power A
active_power_b:
name: ADE7953 Active Power B
reactive_power_a:
name: ADE7953 Reactive Power A
reactive_power_b:
name: ADE7953 Reactive Power B
update_interval: 1s

View File

@ -0,0 +1,34 @@
i2c:
- id: i2c_ade7953
scl: 5
sda: 4
sensor:
- platform: ade7953_i2c
irq_pin: 6
voltage:
name: ADE7953 Voltage
id: ade7953_voltage
current_a:
name: ADE7953 Current A
id: ade7953_current_a
current_b:
name: ADE7953 Current B
id: ade7953_current_b
power_factor_a:
name: ADE7953 Power Factor A
power_factor_b:
name: ADE7953 Power Factor B
apparent_power_a:
name: ADE7953 Apparent Power A
apparent_power_b:
name: ADE7953 Apparent Power B
active_power_a:
name: ADE7953 Active Power A
active_power_b:
name: ADE7953 Active Power B
reactive_power_a:
name: ADE7953 Reactive Power A
reactive_power_b:
name: ADE7953 Reactive Power B
update_interval: 1s

View File

@ -0,0 +1,34 @@
i2c:
- id: i2c_ade7953
scl: 16
sda: 17
sensor:
- platform: ade7953_i2c
irq_pin: 15
voltage:
name: ADE7953 Voltage
id: ade7953_voltage
current_a:
name: ADE7953 Current A
id: ade7953_current_a
current_b:
name: ADE7953 Current B
id: ade7953_current_b
power_factor_a:
name: ADE7953 Power Factor A
power_factor_b:
name: ADE7953 Power Factor B
apparent_power_a:
name: ADE7953 Apparent Power A
apparent_power_b:
name: ADE7953 Apparent Power B
active_power_a:
name: ADE7953 Active Power A
active_power_b:
name: ADE7953 Active Power B
reactive_power_a:
name: ADE7953 Reactive Power A
reactive_power_b:
name: ADE7953 Reactive Power B
update_interval: 1s

View File

@ -0,0 +1,34 @@
i2c:
- id: i2c_ade7953
scl: 16
sda: 17
sensor:
- platform: ade7953_i2c
irq_pin: 15
voltage:
name: ADE7953 Voltage
id: ade7953_voltage
current_a:
name: ADE7953 Current A
id: ade7953_current_a
current_b:
name: ADE7953 Current B
id: ade7953_current_b
power_factor_a:
name: ADE7953 Power Factor A
power_factor_b:
name: ADE7953 Power Factor B
apparent_power_a:
name: ADE7953 Apparent Power A
apparent_power_b:
name: ADE7953 Apparent Power B
active_power_a:
name: ADE7953 Active Power A
active_power_b:
name: ADE7953 Active Power B
reactive_power_a:
name: ADE7953 Reactive Power A
reactive_power_b:
name: ADE7953 Reactive Power B
update_interval: 1s

View File

@ -0,0 +1,34 @@
i2c:
- id: i2c_ade7953
scl: 5
sda: 4
sensor:
- platform: ade7953_i2c
irq_pin: 15
voltage:
name: ADE7953 Voltage
id: ade7953_voltage
current_a:
name: ADE7953 Current A
id: ade7953_current_a
current_b:
name: ADE7953 Current B
id: ade7953_current_b
power_factor_a:
name: ADE7953 Power Factor A
power_factor_b:
name: ADE7953 Power Factor B
apparent_power_a:
name: ADE7953 Apparent Power A
apparent_power_b:
name: ADE7953 Apparent Power B
active_power_a:
name: ADE7953 Active Power A
active_power_b:
name: ADE7953 Active Power B
reactive_power_a:
name: ADE7953 Reactive Power A
reactive_power_b:
name: ADE7953 Reactive Power B
update_interval: 1s

View File

@ -0,0 +1,34 @@
i2c:
- id: i2c_ade7953
scl: 5
sda: 4
sensor:
- platform: ade7953_i2c
irq_pin: 6
voltage:
name: ADE7953 Voltage
id: ade7953_voltage
current_a:
name: ADE7953 Current A
id: ade7953_current_a
current_b:
name: ADE7953 Current B
id: ade7953_current_b
power_factor_a:
name: ADE7953 Power Factor A
power_factor_b:
name: ADE7953 Power Factor B
apparent_power_a:
name: ADE7953 Apparent Power A
apparent_power_b:
name: ADE7953 Apparent Power B
active_power_a:
name: ADE7953 Active Power A
active_power_b:
name: ADE7953 Active Power B
reactive_power_a:
name: ADE7953 Reactive Power A
reactive_power_b:
name: ADE7953 Reactive Power B
update_interval: 1s

View File

@ -0,0 +1,36 @@
spi:
- id: spi_ade7953
clk_pin: 6
mosi_pin: 7
miso_pin: 5
sensor:
- platform: ade7953_spi
cs_pin: 8
irq_pin: 9
voltage:
name: ADE7953 Voltage
id: ade7953_voltage
current_a:
name: ADE7953 Current A
id: ade7953_current_a
current_b:
name: ADE7953 Current B
id: ade7953_current_b
power_factor_a:
name: ADE7953 Power Factor A
power_factor_b:
name: ADE7953 Power Factor B
apparent_power_a:
name: ADE7953 Apparent Power A
apparent_power_b:
name: ADE7953 Apparent Power B
active_power_a:
name: ADE7953 Active Power A
active_power_b:
name: ADE7953 Active Power B
reactive_power_a:
name: ADE7953 Reactive Power A
reactive_power_b:
name: ADE7953 Reactive Power B
update_interval: 1s

View File

@ -0,0 +1,36 @@
spi:
- id: spi_ade7953
clk_pin: 6
mosi_pin: 7
miso_pin: 5
sensor:
- platform: ade7953_spi
cs_pin: 8
irq_pin: 9
voltage:
name: ADE7953 Voltage
id: ade7953_voltage
current_a:
name: ADE7953 Current A
id: ade7953_current_a
current_b:
name: ADE7953 Current B
id: ade7953_current_b
power_factor_a:
name: ADE7953 Power Factor A
power_factor_b:
name: ADE7953 Power Factor B
apparent_power_a:
name: ADE7953 Apparent Power A
apparent_power_b:
name: ADE7953 Apparent Power B
active_power_a:
name: ADE7953 Active Power A
active_power_b:
name: ADE7953 Active Power B
reactive_power_a:
name: ADE7953 Reactive Power A
reactive_power_b:
name: ADE7953 Reactive Power B
update_interval: 1s

View File

@ -0,0 +1,36 @@
spi:
- id: spi_ade7953
clk_pin: 16
mosi_pin: 17
miso_pin: 15
sensor:
- platform: ade7953_spi
cs_pin: 5
irq_pin: 13
voltage:
name: ADE7953 Voltage
id: ade7953_voltage
current_a:
name: ADE7953 Current A
id: ade7953_current_a
current_b:
name: ADE7953 Current B
id: ade7953_current_b
power_factor_a:
name: ADE7953 Power Factor A
power_factor_b:
name: ADE7953 Power Factor B
apparent_power_a:
name: ADE7953 Apparent Power A
apparent_power_b:
name: ADE7953 Apparent Power B
active_power_a:
name: ADE7953 Active Power A
active_power_b:
name: ADE7953 Active Power B
reactive_power_a:
name: ADE7953 Reactive Power A
reactive_power_b:
name: ADE7953 Reactive Power B
update_interval: 1s

View File

@ -0,0 +1,36 @@
spi:
- id: spi_ade7953
clk_pin: 16
mosi_pin: 17
miso_pin: 15
sensor:
- platform: ade7953_spi
cs_pin: 5
irq_pin: 13
voltage:
name: ADE7953 Voltage
id: ade7953_voltage
current_a:
name: ADE7953 Current A
id: ade7953_current_a
current_b:
name: ADE7953 Current B
id: ade7953_current_b
power_factor_a:
name: ADE7953 Power Factor A
power_factor_b:
name: ADE7953 Power Factor B
apparent_power_a:
name: ADE7953 Apparent Power A
apparent_power_b:
name: ADE7953 Apparent Power B
active_power_a:
name: ADE7953 Active Power A
active_power_b:
name: ADE7953 Active Power B
reactive_power_a:
name: ADE7953 Reactive Power A
reactive_power_b:
name: ADE7953 Reactive Power B
update_interval: 1s

View File

@ -0,0 +1,36 @@
spi:
- id: spi_ade7953
clk_pin: 14
mosi_pin: 13
miso_pin: 12
sensor:
- platform: ade7953_spi
cs_pin: 15
irq_pin: 5
voltage:
name: ADE7953 Voltage
id: ade7953_voltage
current_a:
name: ADE7953 Current A
id: ade7953_current_a
current_b:
name: ADE7953 Current B
id: ade7953_current_b
power_factor_a:
name: ADE7953 Power Factor A
power_factor_b:
name: ADE7953 Power Factor B
apparent_power_a:
name: ADE7953 Apparent Power A
apparent_power_b:
name: ADE7953 Apparent Power B
active_power_a:
name: ADE7953 Active Power A
active_power_b:
name: ADE7953 Active Power B
reactive_power_a:
name: ADE7953 Reactive Power A
reactive_power_b:
name: ADE7953 Reactive Power B
update_interval: 1s

View File

@ -0,0 +1,36 @@
spi:
- id: spi_ade7953
clk_pin: 2
mosi_pin: 3
miso_pin: 4
sensor:
- platform: ade7953_spi
cs_pin: 5
irq_pin: 6
voltage:
name: ADE7953 Voltage
id: ade7953_voltage
current_a:
name: ADE7953 Current A
id: ade7953_current_a
current_b:
name: ADE7953 Current B
id: ade7953_current_b
power_factor_a:
name: ADE7953 Power Factor A
power_factor_b:
name: ADE7953 Power Factor B
apparent_power_a:
name: ADE7953 Apparent Power A
apparent_power_b:
name: ADE7953 Apparent Power B
active_power_a:
name: ADE7953 Active Power A
active_power_b:
name: ADE7953 Active Power B
reactive_power_a:
name: ADE7953 Reactive Power A
reactive_power_b:
name: ADE7953 Reactive Power B
update_interval: 1s

View File

@ -0,0 +1,13 @@
i2c:
- id: i2c_ads1115
scl: 5
sda: 4
ads1115:
address: 0x48
sensor:
- platform: ads1115
multiplexer: A0_A1
gain: 1.024
id: ads1115_sensor

View File

@ -0,0 +1,13 @@
i2c:
- id: i2c_ads1115
scl: 5
sda: 4
ads1115:
address: 0x48
sensor:
- platform: ads1115
multiplexer: A0_A1
gain: 1.024
id: ads1115_sensor

View File

@ -0,0 +1,13 @@
i2c:
- id: i2c_ads1115
scl: 16
sda: 17
ads1115:
address: 0x48
sensor:
- platform: ads1115
multiplexer: A0_A1
gain: 1.024
id: ads1115_sensor

View File

@ -0,0 +1,13 @@
i2c:
- id: i2c_ads1115
scl: 16
sda: 17
ads1115:
address: 0x48
sensor:
- platform: ads1115
multiplexer: A0_A1
gain: 1.024
id: ads1115_sensor

View File

@ -0,0 +1,13 @@
i2c:
- id: i2c_ads1115
scl: 5
sda: 4
ads1115:
address: 0x48
sensor:
- platform: ads1115
multiplexer: A0_A1
gain: 1.024
id: ads1115_sensor

View File

@ -0,0 +1,13 @@
i2c:
- id: i2c_ads1115
scl: 5
sda: 4
ads1115:
address: 0x48
sensor:
- platform: ads1115
multiplexer: A0_A1
gain: 1.024
id: ads1115_sensor

View File

@ -0,0 +1,11 @@
i2c:
- id: i2c_aht10
scl: 5
sda: 4
sensor:
- platform: aht10
temperature:
name: Temperature
humidity:
name: Humidity

View File

@ -0,0 +1,11 @@
i2c:
- id: i2c_aht10
scl: 5
sda: 4
sensor:
- platform: aht10
temperature:
name: Temperature
humidity:
name: Humidity

View File

@ -0,0 +1,11 @@
i2c:
- id: i2c_aht10
scl: 16
sda: 17
sensor:
- platform: aht10
temperature:
name: Temperature
humidity:
name: Humidity

View File

@ -0,0 +1,11 @@
i2c:
- id: i2c_aht10
scl: 16
sda: 17
sensor:
- platform: aht10
temperature:
name: Temperature
humidity:
name: Humidity

View File

@ -0,0 +1,11 @@
i2c:
- id: i2c_aht10
scl: 5
sda: 4
sensor:
- platform: aht10
temperature:
name: Temperature
humidity:
name: Humidity

View File

@ -0,0 +1,11 @@
i2c:
- id: i2c_aht10
scl: 5
sda: 4
sensor:
- platform: aht10
temperature:
name: Temperature
humidity:
name: Humidity

View File

@ -0,0 +1,22 @@
esp32_ble_tracker:
ble_client:
- mac_address: 01:02:03:04:05:06
id: airthingsmini01
sensor:
- id: airthingswm
platform: airthings_wave_mini
ble_client_id: airthingsmini01
update_interval: 5min
battery_update_interval: 12h
temperature:
name: Wave Mini Temperature
humidity:
name: Wave Mini Humidity
pressure:
name: Wave Mini Pressure
tvoc:
name: Wave Mini VOC
battery_voltage:
name: Wave Mini Battery Voltage

View File

@ -0,0 +1,22 @@
esp32_ble_tracker:
ble_client:
- mac_address: 01:02:03:04:05:06
id: airthingsmini01
sensor:
- id: airthingswm
platform: airthings_wave_mini
ble_client_id: airthingsmini01
update_interval: 5min
battery_update_interval: 12h
temperature:
name: Wave Mini Temperature
humidity:
name: Wave Mini Humidity
pressure:
name: Wave Mini Pressure
tvoc:
name: Wave Mini VOC
battery_voltage:
name: Wave Mini Battery Voltage

View File

@ -0,0 +1,22 @@
esp32_ble_tracker:
ble_client:
- mac_address: 01:02:03:04:05:06
id: airthingsmini01
sensor:
- id: airthingswm
platform: airthings_wave_mini
ble_client_id: airthingsmini01
update_interval: 5min
battery_update_interval: 12h
temperature:
name: Wave Mini Temperature
humidity:
name: Wave Mini Humidity
pressure:
name: Wave Mini Pressure
tvoc:
name: Wave Mini VOC
battery_voltage:
name: Wave Mini Battery Voltage

View File

@ -0,0 +1,22 @@
esp32_ble_tracker:
ble_client:
- mac_address: 01:02:03:04:05:06
id: airthingsmini01
sensor:
- id: airthingswm
platform: airthings_wave_mini
ble_client_id: airthingsmini01
update_interval: 5min
battery_update_interval: 12h
temperature:
name: Wave Mini Temperature
humidity:
name: Wave Mini Humidity
pressure:
name: Wave Mini Pressure
tvoc:
name: Wave Mini VOC
battery_voltage:
name: Wave Mini Battery Voltage

View File

@ -0,0 +1,28 @@
esp32_ble_tracker:
ble_client:
- mac_address: 01:02:03:04:05:06
id: airthings01
sensor:
- id: airthingswp
platform: airthings_wave_plus
ble_client_id: airthings01
update_interval: 5min
battery_update_interval: 12h
temperature:
name: Wave Plus Temperature
radon:
name: Wave Plus Radon
radon_long_term:
name: Wave Plus Radon Long Term
pressure:
name: Wave Plus Pressure
humidity:
name: Wave Plus Humidity
co2:
name: Wave Plus CO2
tvoc:
name: Wave Plus VOC
battery_voltage:
name: Wave Plus Battery Voltage

View File

@ -0,0 +1,28 @@
esp32_ble_tracker:
ble_client:
- mac_address: 01:02:03:04:05:06
id: airthings01
sensor:
- id: airthingswp
platform: airthings_wave_plus
ble_client_id: airthings01
update_interval: 5min
battery_update_interval: 12h
temperature:
name: Wave Plus Temperature
radon:
name: Wave Plus Radon
radon_long_term:
name: Wave Plus Radon Long Term
pressure:
name: Wave Plus Pressure
humidity:
name: Wave Plus Humidity
co2:
name: Wave Plus CO2
tvoc:
name: Wave Plus VOC
battery_voltage:
name: Wave Plus Battery Voltage

View File

@ -0,0 +1,28 @@
esp32_ble_tracker:
ble_client:
- mac_address: 01:02:03:04:05:06
id: airthings01
sensor:
- id: airthingswp
platform: airthings_wave_plus
ble_client_id: airthings01
update_interval: 5min
battery_update_interval: 12h
temperature:
name: Wave Plus Temperature
radon:
name: Wave Plus Radon
radon_long_term:
name: Wave Plus Radon Long Term
pressure:
name: Wave Plus Pressure
humidity:
name: Wave Plus Humidity
co2:
name: Wave Plus CO2
tvoc:
name: Wave Plus VOC
battery_voltage:
name: Wave Plus Battery Voltage

View File

@ -0,0 +1,28 @@
esp32_ble_tracker:
ble_client:
- mac_address: 01:02:03:04:05:06
id: airthings01
sensor:
- id: airthingswp
platform: airthings_wave_plus
ble_client_id: airthings01
update_interval: 5min
battery_update_interval: 12h
temperature:
name: Wave Plus Temperature
radon:
name: Wave Plus Radon
radon_long_term:
name: Wave Plus Radon Long Term
pressure:
name: Wave Plus Pressure
humidity:
name: Wave Plus Humidity
co2:
name: Wave Plus CO2
tvoc:
name: Wave Plus VOC
battery_voltage:
name: Wave Plus Battery Voltage

View File

@ -0,0 +1,64 @@
binary_sensor:
- platform: gpio
id: bin1
pin: 1
alarm_control_panel:
- platform: template
id: alarmcontrolpanel1
name: Alarm Panel
codes:
- "1234"
requires_code_to_arm: true
arming_home_time: 1s
arming_night_time: 1s
arming_away_time: 15s
pending_time: 15s
trigger_time: 30s
binary_sensors:
- input: bin1
bypass_armed_home: true
bypass_armed_night: true
on_state:
then:
- lambda: !lambda |-
ESP_LOGD("TEST", "State change %s", LOG_STR_ARG(alarm_control_panel_state_to_string(id(alarmcontrolpanel1)->get_state())));
- platform: template
id: alarmcontrolpanel2
name: Alarm Panel
codes:
- "1234"
requires_code_to_arm: true
arming_home_time: 1s
arming_night_time: 1s
arming_away_time: 15s
pending_time: 15s
trigger_time: 30s
binary_sensors:
- input: bin1
bypass_armed_home: true
bypass_armed_night: true
on_disarmed:
then:
- logger.log: "### DISARMED ###"
on_pending:
then:
- logger.log: "### PENDING ###"
on_arming:
then:
- logger.log: "### ARMING ###"
on_armed_home:
then:
- logger.log: "### ARMED HOME ###"
on_armed_night:
then:
- logger.log: "### ARMED NIGHT ###"
on_armed_away:
then:
- logger.log: "### ARMED AWAY ###"
on_triggered:
then:
- logger.log: "### TRIGGERED ###"
on_cleared:
then:
- logger.log: "### CLEARED ###"

View File

@ -0,0 +1,64 @@
binary_sensor:
- platform: gpio
id: bin1
pin: 1
alarm_control_panel:
- platform: template
id: alarmcontrolpanel1
name: Alarm Panel
codes:
- "1234"
requires_code_to_arm: true
arming_home_time: 1s
arming_night_time: 1s
arming_away_time: 15s
pending_time: 15s
trigger_time: 30s
binary_sensors:
- input: bin1
bypass_armed_home: true
bypass_armed_night: true
on_state:
then:
- lambda: !lambda |-
ESP_LOGD("TEST", "State change %s", LOG_STR_ARG(alarm_control_panel_state_to_string(id(alarmcontrolpanel1)->get_state())));
- platform: template
id: alarmcontrolpanel2
name: Alarm Panel
codes:
- "1234"
requires_code_to_arm: true
arming_home_time: 1s
arming_night_time: 1s
arming_away_time: 15s
pending_time: 15s
trigger_time: 30s
binary_sensors:
- input: bin1
bypass_armed_home: true
bypass_armed_night: true
on_disarmed:
then:
- logger.log: "### DISARMED ###"
on_pending:
then:
- logger.log: "### PENDING ###"
on_arming:
then:
- logger.log: "### ARMING ###"
on_armed_home:
then:
- logger.log: "### ARMED HOME ###"
on_armed_night:
then:
- logger.log: "### ARMED NIGHT ###"
on_armed_away:
then:
- logger.log: "### ARMED AWAY ###"
on_triggered:
then:
- logger.log: "### TRIGGERED ###"
on_cleared:
then:
- logger.log: "### CLEARED ###"

View File

@ -0,0 +1,64 @@
binary_sensor:
- platform: gpio
id: bin1
pin: 1
alarm_control_panel:
- platform: template
id: alarmcontrolpanel1
name: Alarm Panel
codes:
- "1234"
requires_code_to_arm: true
arming_home_time: 1s
arming_night_time: 1s
arming_away_time: 15s
pending_time: 15s
trigger_time: 30s
binary_sensors:
- input: bin1
bypass_armed_home: true
bypass_armed_night: true
on_state:
then:
- lambda: !lambda |-
ESP_LOGD("TEST", "State change %s", LOG_STR_ARG(alarm_control_panel_state_to_string(id(alarmcontrolpanel1)->get_state())));
- platform: template
id: alarmcontrolpanel2
name: Alarm Panel
codes:
- "1234"
requires_code_to_arm: true
arming_home_time: 1s
arming_night_time: 1s
arming_away_time: 15s
pending_time: 15s
trigger_time: 30s
binary_sensors:
- input: bin1
bypass_armed_home: true
bypass_armed_night: true
on_disarmed:
then:
- logger.log: "### DISARMED ###"
on_pending:
then:
- logger.log: "### PENDING ###"
on_arming:
then:
- logger.log: "### ARMING ###"
on_armed_home:
then:
- logger.log: "### ARMED HOME ###"
on_armed_night:
then:
- logger.log: "### ARMED NIGHT ###"
on_armed_away:
then:
- logger.log: "### ARMED AWAY ###"
on_triggered:
then:
- logger.log: "### TRIGGERED ###"
on_cleared:
then:
- logger.log: "### CLEARED ###"

View File

@ -0,0 +1,64 @@
binary_sensor:
- platform: gpio
id: bin1
pin: 1
alarm_control_panel:
- platform: template
id: alarmcontrolpanel1
name: Alarm Panel
codes:
- "1234"
requires_code_to_arm: true
arming_home_time: 1s
arming_night_time: 1s
arming_away_time: 15s
pending_time: 15s
trigger_time: 30s
binary_sensors:
- input: bin1
bypass_armed_home: true
bypass_armed_night: true
on_state:
then:
- lambda: !lambda |-
ESP_LOGD("TEST", "State change %s", LOG_STR_ARG(alarm_control_panel_state_to_string(id(alarmcontrolpanel1)->get_state())));
- platform: template
id: alarmcontrolpanel2
name: Alarm Panel
codes:
- "1234"
requires_code_to_arm: true
arming_home_time: 1s
arming_night_time: 1s
arming_away_time: 15s
pending_time: 15s
trigger_time: 30s
binary_sensors:
- input: bin1
bypass_armed_home: true
bypass_armed_night: true
on_disarmed:
then:
- logger.log: "### DISARMED ###"
on_pending:
then:
- logger.log: "### PENDING ###"
on_arming:
then:
- logger.log: "### ARMING ###"
on_armed_home:
then:
- logger.log: "### ARMED HOME ###"
on_armed_night:
then:
- logger.log: "### ARMED NIGHT ###"
on_armed_away:
then:
- logger.log: "### ARMED AWAY ###"
on_triggered:
then:
- logger.log: "### TRIGGERED ###"
on_cleared:
then:
- logger.log: "### CLEARED ###"

Some files were not shown because too many files have changed in this diff Show More