mirror of
https://github.com/randybb/esphome-configs.git
synced 2026-03-03 07:14:10 +01:00
Compare commits
10 Commits
ba1aea9132
...
1c8c319406
| Author | SHA1 | Date | |
|---|---|---|---|
| 1c8c319406 | |||
| 8693d810b4 | |||
| d3e3175d39 | |||
| c3a5291927 | |||
| d24866b5a2 | |||
| 9812f5ed03 | |||
| 86051c9f1a | |||
| c2d1d16cbd | |||
| 239f4c3ce5 | |||
| badcad9c5a |
@@ -24,5 +24,8 @@ text_sensor:
|
|||||||
# - <<: !include text_sensor/uptime.yaml
|
# - <<: !include text_sensor/uptime.yaml
|
||||||
- <<: !include text_sensor/wifi_info.yaml
|
- <<: !include text_sensor/wifi_info.yaml
|
||||||
|
|
||||||
|
# time:
|
||||||
|
#. - <<: !include time/homeassistant.yaml
|
||||||
|
|
||||||
network:
|
network:
|
||||||
enable_ipv6: true
|
enable_ipv6: true
|
||||||
@@ -19,11 +19,6 @@ sensor:
|
|||||||
- <<: !include sensor/uptime.yaml
|
- <<: !include sensor/uptime.yaml
|
||||||
- <<: !include sensor/wifi_signal.yaml
|
- <<: !include sensor/wifi_signal.yaml
|
||||||
|
|
||||||
#switch:
|
|
||||||
# - <<: !include switch/restart.yaml
|
|
||||||
# - <<: !include switch/safe_mode.yaml
|
|
||||||
# - <<: !include switch/shutdown.yaml
|
|
||||||
|
|
||||||
text_sensor:
|
text_sensor:
|
||||||
- <<: !include text_sensor/debug.yaml
|
- <<: !include text_sensor/debug.yaml
|
||||||
- <<: !include text_sensor/version.yaml
|
- <<: !include text_sensor/version.yaml
|
||||||
|
|||||||
@@ -16,14 +16,9 @@ sensor:
|
|||||||
- <<: !include sensor/uptime.yaml
|
- <<: !include sensor/uptime.yaml
|
||||||
# - <<: !include sensor/free_heap.yaml
|
# - <<: !include sensor/free_heap.yaml
|
||||||
|
|
||||||
#switch:
|
|
||||||
# - <<: !include switch/restart.yaml
|
|
||||||
# - <<: !include switch/safe_mode.yaml
|
|
||||||
# - <<: !include switch/shutdown.yaml
|
|
||||||
|
|
||||||
text_sensor:
|
text_sensor:
|
||||||
# - <<: !include text_sensor/debug.yaml
|
# - <<: !include text_sensor/debug.yaml
|
||||||
# - <<: !include text_sensor/version.yaml
|
- <<: !include text_sensor/version.yaml
|
||||||
- <<: !include text_sensor/ethernet_info.yaml
|
- <<: !include text_sensor/ethernet_info.yaml
|
||||||
|
|
||||||
network:
|
network:
|
||||||
|
|||||||
@@ -22,11 +22,6 @@ sensor:
|
|||||||
- <<: !include sensor/uptime.yaml
|
- <<: !include sensor/uptime.yaml
|
||||||
- <<: !include sensor/wifi_signal.yaml
|
- <<: !include sensor/wifi_signal.yaml
|
||||||
|
|
||||||
#switch:
|
|
||||||
# - <<: !include switch/restart.yaml
|
|
||||||
# - <<: !include switch/safe_mode.yaml
|
|
||||||
# - <<: !include switch/shutdown.yaml
|
|
||||||
|
|
||||||
text_sensor:
|
text_sensor:
|
||||||
# - <<: !include text_sensor/debug.yaml
|
# - <<: !include text_sensor/debug.yaml
|
||||||
- <<: !include text_sensor/git_ref.yaml
|
- <<: !include text_sensor/git_ref.yaml
|
||||||
|
|||||||
@@ -3,7 +3,8 @@ ethernet:
|
|||||||
type: LAN8720
|
type: LAN8720
|
||||||
mdc_pin: 23
|
mdc_pin: 23
|
||||||
mdio_pin: 18
|
mdio_pin: 18
|
||||||
clk_pin: 17
|
clk:
|
||||||
clk_mode: CLK_OUT
|
pin: 17
|
||||||
|
mode: CLK_OUT
|
||||||
phy_addr: 0
|
phy_addr: 0
|
||||||
power_pin: 12
|
power_pin: 12
|
||||||
|
|||||||
@@ -3,12 +3,21 @@ platform: wifi_info
|
|||||||
ip_address:
|
ip_address:
|
||||||
name: IP Address
|
name: IP Address
|
||||||
icon: mdi:ip-network
|
icon: mdi:ip-network
|
||||||
|
# address_0:
|
||||||
|
# name: IP Address 0
|
||||||
|
# icon: mdi:ip-network
|
||||||
address_1:
|
address_1:
|
||||||
name: IP Address 1
|
name: IP Address 1
|
||||||
icon: mdi:ip-network
|
icon: mdi:ip-network
|
||||||
address_2:
|
address_2:
|
||||||
name: IP Address 2
|
name: IP Address 2
|
||||||
icon: mdi:ip-network
|
icon: mdi:ip-network
|
||||||
|
# address_3:
|
||||||
|
# name: IP Address 3
|
||||||
|
# icon: mdi:ip-network
|
||||||
|
# address_4:
|
||||||
|
# name: IP Address 4
|
||||||
|
# icon: mdi:ip-network
|
||||||
#ssid:
|
#ssid:
|
||||||
# name: SSID
|
# name: SSID
|
||||||
#bssid:
|
#bssid:
|
||||||
@@ -17,3 +26,5 @@ mac_address:
|
|||||||
name: MAC
|
name: MAC
|
||||||
#scan_results:
|
#scan_results:
|
||||||
# name: Latest Scan Results
|
# name: Latest Scan Results
|
||||||
|
power_save_mode:
|
||||||
|
name: WiFi Power Save Mode
|
||||||
@@ -6,3 +6,4 @@ wifi:
|
|||||||
password: !secret wifi_password
|
password: !secret wifi_password
|
||||||
enable_btm: true
|
enable_btm: true
|
||||||
enable_rrm: true
|
enable_rrm: true
|
||||||
|
min_auth_mode: WPA3
|
||||||
|
|||||||
@@ -1,116 +0,0 @@
|
|||||||
#include "esphome.h"
|
|
||||||
|
|
||||||
#define XPOWERS_CHIP_AXP2101
|
|
||||||
#include "XPowersLib.h"
|
|
||||||
|
|
||||||
#ifdef I2C_SDA
|
|
||||||
#undef I2C_SDA
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef I2C_SCL
|
|
||||||
#undef I2C_SCL
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define I2C_SDA (7)
|
|
||||||
#define I2C_SCL (6)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class AXP2101Component : public Component {
|
|
||||||
public:
|
|
||||||
void setup() override {
|
|
||||||
// This will be called once to set up the component
|
|
||||||
// think of it as the setup() call in Arduino
|
|
||||||
ESP_LOGD("custom", "Custom component setup");
|
|
||||||
|
|
||||||
if (!PMU.begin(Wire, AXP2101_SLAVE_ADDRESS, I2C_SDA, I2C_SCL)) {
|
|
||||||
Serial.println("Failed to initialize power.....");
|
|
||||||
while (1) {
|
|
||||||
delay(5000);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set VSY off voltage as 2600mV , Adjustment range 2600mV ~ 3300mV
|
|
||||||
PMU.setSysPowerDownVoltage(2600);
|
|
||||||
|
|
||||||
//Turn off not use power channel
|
|
||||||
PMU.disableDC2();
|
|
||||||
PMU.disableDC3();
|
|
||||||
PMU.disableDC4();
|
|
||||||
PMU.disableDC5();
|
|
||||||
|
|
||||||
PMU.disableALDO1();
|
|
||||||
PMU.disableALDO2();
|
|
||||||
PMU.disableALDO3();
|
|
||||||
PMU.disableALDO4();
|
|
||||||
PMU.disableBLDO1();
|
|
||||||
PMU.disableBLDO2();
|
|
||||||
|
|
||||||
PMU.disableCPUSLDO();
|
|
||||||
PMU.disableDLDO1();
|
|
||||||
PMU.disableDLDO2();
|
|
||||||
// Board 5 Pin socket 3.3V power output control
|
|
||||||
PMU.setDC3Voltage(3100); //Extern 3100~ 3400V
|
|
||||||
PMU.enableDC3();
|
|
||||||
|
|
||||||
// Camera working voltage, please do not change
|
|
||||||
PMU.setALDO1Voltage(1500); // CAM DVDD
|
|
||||||
PMU.enableALDO1();
|
|
||||||
|
|
||||||
// Camera working voltage, please do not change
|
|
||||||
PMU.setALDO2Voltage(3000); // CAM DVDD
|
|
||||||
PMU.enableALDO2();
|
|
||||||
|
|
||||||
// Camera working voltage, please do not change
|
|
||||||
PMU.setALDO4Voltage(3000); // CAM AVDD
|
|
||||||
PMU.enableALDO4();
|
|
||||||
|
|
||||||
// Pyroelectric sensor working voltage, please do not change
|
|
||||||
PMU.setALDO3Voltage(3300); // PIR VDD
|
|
||||||
PMU.enableALDO3();
|
|
||||||
|
|
||||||
// Microphone working voltage, please do not change
|
|
||||||
PMU.setBLDO1Voltage(3300); // MIC VDD
|
|
||||||
PMU.enableBLDO1();
|
|
||||||
|
|
||||||
PMU.clearIrqStatus();
|
|
||||||
|
|
||||||
PMU.enableVbusVoltageMeasure();
|
|
||||||
PMU.enableBattVoltageMeasure();
|
|
||||||
PMU.enableSystemVoltageMeasure();
|
|
||||||
PMU.disableTemperatureMeasure();
|
|
||||||
|
|
||||||
// TS Pin detection must be disable, otherwise it cannot be charged
|
|
||||||
PMU.disableTSPinMeasure();
|
|
||||||
|
|
||||||
// Disable all interrupts
|
|
||||||
PMU.disableIRQ(XPOWERS_AXP2101_ALL_IRQ);
|
|
||||||
// Clear all interrupt flags
|
|
||||||
PMU.clearIrqStatus();
|
|
||||||
// Enable the required interrupt function
|
|
||||||
PMU.enableIRQ(
|
|
||||||
XPOWERS_AXP2101_BAT_INSERT_IRQ | XPOWERS_AXP2101_BAT_REMOVE_IRQ | //BATTERY
|
|
||||||
XPOWERS_AXP2101_VBUS_INSERT_IRQ | XPOWERS_AXP2101_VBUS_REMOVE_IRQ | //VBUS
|
|
||||||
XPOWERS_AXP2101_PKEY_SHORT_IRQ | XPOWERS_AXP2101_PKEY_LONG_IRQ | //POWER KEY
|
|
||||||
XPOWERS_AXP2101_BAT_CHG_DONE_IRQ | XPOWERS_AXP2101_BAT_CHG_START_IRQ //CHARGE
|
|
||||||
// XPOWERS_PKEY_NEGATIVE_IRQ | XPOWERS_PKEY_POSITIVE_IRQ | //POWER KEY
|
|
||||||
);
|
|
||||||
|
|
||||||
// TS Pin detection must be disable, otherwise it cannot be charged
|
|
||||||
PMU.disableTSPinMeasure();
|
|
||||||
// Set the precharge charging current
|
|
||||||
PMU.setPrechargeCurr(XPOWERS_AXP2101_PRECHARGE_50MA);
|
|
||||||
// Set constant current charge current limit
|
|
||||||
PMU.setChargerConstantCurr(XPOWERS_AXP2101_CHG_CUR_300MA);
|
|
||||||
// Set stop charging termination current
|
|
||||||
PMU.setChargerTerminationCurr(XPOWERS_AXP2101_CHG_ITERM_25MA);
|
|
||||||
|
|
||||||
// Set charge cut-off voltage
|
|
||||||
PMU.setChargeTargetVoltage(XPOWERS_AXP2101_CHG_VOL_4V1);
|
|
||||||
|
|
||||||
// Set the time of pressing the button to turn off
|
|
||||||
PMU.setPowerKeyPressOffTime(XPOWERS_POWEROFF_4S);
|
|
||||||
}
|
|
||||||
private:
|
|
||||||
XPowersPMU PMU;
|
|
||||||
};
|
|
||||||
@@ -1,102 +0,0 @@
|
|||||||
esphome:
|
|
||||||
name: camera-2
|
|
||||||
platformio_options:
|
|
||||||
build_flags: "-DBOARD_HAS_PSRAM -UARDUINO_USB_CDC_ON_BOOT"
|
|
||||||
upload_speed: 921600
|
|
||||||
monitor_speed: 115200
|
|
||||||
friendly_name: "Camera 2"
|
|
||||||
libraries:
|
|
||||||
- XPowersLib=https://github.com/lewisxhe/XPowersLib.git
|
|
||||||
- "Wire"
|
|
||||||
includes:
|
|
||||||
- AXP2101_component.h
|
|
||||||
|
|
||||||
custom_component:
|
|
||||||
- lambda: |-
|
|
||||||
auto axp2101 = new AXP2101Component();
|
|
||||||
return {axp2101};
|
|
||||||
components:
|
|
||||||
- id: axp2101
|
|
||||||
|
|
||||||
esp32:
|
|
||||||
board: esp32s3box
|
|
||||||
framework:
|
|
||||||
type: arduino
|
|
||||||
|
|
||||||
# Enable Home Assistant API
|
|
||||||
api:
|
|
||||||
encryption:
|
|
||||||
key: "XXX" # Replace with your API encryption key
|
|
||||||
|
|
||||||
ota:
|
|
||||||
password: "XXX" # Replace with your OTA password
|
|
||||||
|
|
||||||
wifi:
|
|
||||||
ssid: !secret wifi_ssid # Replace with your Wi-Fi SSID stored in secrets.yaml
|
|
||||||
password: !secret wifi_password # Replace with your Wi-Fi password stored in secrets.yaml
|
|
||||||
|
|
||||||
# Enable fallback hotspot (captive portal) in case Wi-Fi connection fails
|
|
||||||
ap:
|
|
||||||
ssid: "Esp32-S3 Fallback Hotspot"
|
|
||||||
password: "XXX" # Replace with your fallback hotspot password
|
|
||||||
|
|
||||||
binary_sensor:
|
|
||||||
- platform: gpio
|
|
||||||
pin: GPIO17
|
|
||||||
name: "ttgocam2 PIR"
|
|
||||||
device_class: motion
|
|
||||||
|
|
||||||
sensor:
|
|
||||||
- platform: wifi_signal
|
|
||||||
name: "ttgocam2 WiFi Signal"
|
|
||||||
update_interval: 60s
|
|
||||||
|
|
||||||
time:
|
|
||||||
- platform: homeassistant
|
|
||||||
id: homeassistant_time
|
|
||||||
|
|
||||||
font:
|
|
||||||
- file: "nanum.ttf"
|
|
||||||
id: tnr1
|
|
||||||
size: 17
|
|
||||||
|
|
||||||
web_server:
|
|
||||||
version: 2
|
|
||||||
|
|
||||||
i2c:
|
|
||||||
sda: GPIO07
|
|
||||||
scl: GPIO06
|
|
||||||
frequency: 200kHz
|
|
||||||
|
|
||||||
esp32_camera:
|
|
||||||
name: camera-2
|
|
||||||
external_clock:
|
|
||||||
pin: GPIO38
|
|
||||||
frequency: 20MHz
|
|
||||||
i2c_pins:
|
|
||||||
sda: GPIO05
|
|
||||||
scl: GPIO04
|
|
||||||
data_pins: [GPIO14, GPIO47, GPIO48, GPIO21, GPIO13, GPIO11, GPIO10, GPIO09]
|
|
||||||
vsync_pin: GPIO8
|
|
||||||
href_pin: GPIO18
|
|
||||||
pixel_clock_pin: GPIO12
|
|
||||||
vertical_flip: false
|
|
||||||
horizontal_mirror: false
|
|
||||||
resolution: 1024x768
|
|
||||||
|
|
||||||
esp32_camera_web_server:
|
|
||||||
- port: 8080
|
|
||||||
mode: stream
|
|
||||||
- port: 8081
|
|
||||||
mode: snapshot
|
|
||||||
|
|
||||||
display:
|
|
||||||
- platform: ssd1306_i2c
|
|
||||||
update_interval: 2s
|
|
||||||
model: "SSD1306 128x64"
|
|
||||||
address: 0x3C
|
|
||||||
rotation: 180
|
|
||||||
lambda: |-
|
|
||||||
// Display current date and time
|
|
||||||
it.strftime(64, 0, id(tnr1), TextAlign::TOP_CENTER, "%m-%d-%Y", id(homeassistant_time).now());
|
|
||||||
it.strftime(64, 44, id(tnr1), TextAlign::BASELINE_CENTER, "%I:%M:%S%p", id(homeassistant_time).now());
|
|
||||||
@@ -1,31 +0,0 @@
|
|||||||
import esphome.codegen as cg
|
|
||||||
import esphome.config_validation as cv
|
|
||||||
from esphome.components import i2c
|
|
||||||
from esphome.const import CONF_ID
|
|
||||||
|
|
||||||
DEPENDENCIES = ["i2c"]
|
|
||||||
AUTO_LOAD = ["sensor", "voltage_sampler"]
|
|
||||||
MULTI_CONF = True
|
|
||||||
|
|
||||||
ads1100_ns = cg.esphome_ns.namespace("ads1100")
|
|
||||||
ADS1100Component = ads1100_ns.class_("ADS1100Component", cg.Component, i2c.I2CDevice)
|
|
||||||
|
|
||||||
CONF_CONTINUOUS_MODE = "continuous_mode"
|
|
||||||
CONFIG_SCHEMA = (
|
|
||||||
cv.Schema(
|
|
||||||
{
|
|
||||||
cv.GenerateID(): cv.declare_id(ADS1100Component),
|
|
||||||
cv.Optional(CONF_CONTINUOUS_MODE, default=False): cv.boolean,
|
|
||||||
}
|
|
||||||
)
|
|
||||||
.extend(cv.COMPONENT_SCHEMA)
|
|
||||||
.extend(i2c.i2c_device_schema(None))
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
async def to_code(config):
|
|
||||||
var = cg.new_Pvariable(config[CONF_ID])
|
|
||||||
await cg.register_component(var, config)
|
|
||||||
await i2c.register_i2c_device(var, config)
|
|
||||||
|
|
||||||
cg.add(var.set_continuous_mode(config[CONF_CONTINUOUS_MODE]))
|
|
||||||
@@ -1,170 +0,0 @@
|
|||||||
#include "ads1100.h"
|
|
||||||
#include "esphome/core/log.h"
|
|
||||||
#include "esphome/core/hal.h"
|
|
||||||
|
|
||||||
namespace esphome {
|
|
||||||
namespace ads1100 {
|
|
||||||
|
|
||||||
static const char *const TAG = "ads1100";
|
|
||||||
static const uint8_t ADS1100_REGISTER_CONVERSION = 0x00;
|
|
||||||
static const uint8_t ADS1100_REGISTER_CONFIG = 0x01;
|
|
||||||
|
|
||||||
static const uint8_t ADS1100_DATA_RATE_860_SPS = 0b111;
|
|
||||||
|
|
||||||
void ADS1100Component::setup() {
|
|
||||||
ESP_LOGCONFIG(TAG, "Setting up ADS1100...");
|
|
||||||
uint16_t value;
|
|
||||||
if (!this->read_byte_16(ADS1100_REGISTER_CONVERSION, &value)) {
|
|
||||||
this->mark_failed();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
uint16_t config = 0;
|
|
||||||
// Clear single-shot bit
|
|
||||||
// 0b0xxxxxxxxxxxxxxx
|
|
||||||
config |= 0b0000000000000000;
|
|
||||||
// Setup multiplexer
|
|
||||||
// 0bx000xxxxxxxxxxxx
|
|
||||||
config |= ADS1100_MULTIPLEXER_8 << 12;
|
|
||||||
|
|
||||||
// Setup Gain
|
|
||||||
// 0bxxxx000xxxxxxxxx
|
|
||||||
config |= ADS1100_GAIN_6P144 << 9;
|
|
||||||
|
|
||||||
if (this->continuous_mode_) {
|
|
||||||
// Set continuous mode
|
|
||||||
// 0bxxxxxxx0xxxxxxxx
|
|
||||||
config |= 0b0000000000000000;
|
|
||||||
} else {
|
|
||||||
// Set singleshot mode
|
|
||||||
// 0bxxxxxxx1xxxxxxxx
|
|
||||||
config |= 0b0000000100000000;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set data rate - 860 samples per second (we're in singleshot mode)
|
|
||||||
// 0bxxxxxxxx100xxxxx
|
|
||||||
config |= ADS1100_DATA_RATE_860_SPS << 5;
|
|
||||||
|
|
||||||
// Set comparator mode - hysteresis
|
|
||||||
// 0bxxxxxxxxxxx0xxxx
|
|
||||||
config |= 0b0000000000000000;
|
|
||||||
|
|
||||||
// Set comparator polarity - active low
|
|
||||||
// 0bxxxxxxxxxxxx0xxx
|
|
||||||
config |= 0b0000000000000000;
|
|
||||||
|
|
||||||
// Set comparator latch enabled - false
|
|
||||||
// 0bxxxxxxxxxxxxx0xx
|
|
||||||
config |= 0b0000000000000000;
|
|
||||||
|
|
||||||
// Set comparator que mode - disabled
|
|
||||||
// 0bxxxxxxxxxxxxxx11
|
|
||||||
config |= 0b0000000000000011;
|
|
||||||
|
|
||||||
if (!this->write_byte_16(ADS1100_REGISTER_CONFIG, config)) {
|
|
||||||
this->mark_failed();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
this->prev_config_ = config;
|
|
||||||
}
|
|
||||||
void ADS1100Component::dump_config() {
|
|
||||||
ESP_LOGCONFIG(TAG, "Setting up ADS1100...");
|
|
||||||
LOG_I2C_DEVICE(this);
|
|
||||||
if (this->is_failed()) {
|
|
||||||
ESP_LOGE(TAG, "Communication with ADS1100 failed!");
|
|
||||||
}
|
|
||||||
|
|
||||||
for (auto *sensor : this->sensors_) {
|
|
||||||
LOG_SENSOR(" ", "Sensor", sensor);
|
|
||||||
ESP_LOGCONFIG(TAG, " Rate: %u", sensor->get_rate());
|
|
||||||
ESP_LOGCONFIG(TAG, " Gain: %u", sensor->get_gain());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
float ADS1100Component::request_measurement(ADS1100Sensor *sensor) {
|
|
||||||
uint16_t config = this->prev_config_;
|
|
||||||
// Multiplexer
|
|
||||||
// 0bxBBBxxxxxxxxxxxx
|
|
||||||
config &= 0b1000111111111111;
|
|
||||||
config |= (sensor->get_multiplexer() & 0b111) << 12;
|
|
||||||
|
|
||||||
// Gain
|
|
||||||
// 0bxxxxBBBxxxxxxxxx
|
|
||||||
config &= 0b1111000111111111;
|
|
||||||
config |= (sensor->get_gain() & 0b111) << 9;
|
|
||||||
|
|
||||||
if (!this->continuous_mode_) {
|
|
||||||
// Start conversion
|
|
||||||
config |= 0b1000000000000000;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!this->continuous_mode_ || this->prev_config_ != config) {
|
|
||||||
if (!this->write_byte_16(ADS1100_REGISTER_CONFIG, config)) {
|
|
||||||
this->status_set_warning();
|
|
||||||
return NAN;
|
|
||||||
}
|
|
||||||
this->prev_config_ = config;
|
|
||||||
|
|
||||||
// about 1.2 ms with 860 samples per second
|
|
||||||
delay(2);
|
|
||||||
|
|
||||||
// in continuous mode, conversion will always be running, rely on the delay
|
|
||||||
// to ensure conversion is taking place with the correct settings
|
|
||||||
// can we use the rdy pin to trigger when a conversion is done?
|
|
||||||
if (!this->continuous_mode_) {
|
|
||||||
uint32_t start = millis();
|
|
||||||
while (this->read_byte_16(ADS1100_REGISTER_CONFIG, &config) && (config >> 15) == 0) {
|
|
||||||
if (millis() - start > 100) {
|
|
||||||
ESP_LOGW(TAG, "Reading ADS1100 timed out");
|
|
||||||
this->status_set_warning();
|
|
||||||
return NAN;
|
|
||||||
}
|
|
||||||
yield();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
uint16_t raw_conversion;
|
|
||||||
if (!this->read_byte_16(ADS1100_REGISTER_CONVERSION, &raw_conversion)) {
|
|
||||||
this->status_set_warning();
|
|
||||||
return NAN;
|
|
||||||
}
|
|
||||||
auto signed_conversion = static_cast<int16_t>(raw_conversion);
|
|
||||||
|
|
||||||
float millivolts;
|
|
||||||
switch (sensor->get_gain()) {
|
|
||||||
case ADS1100_GAIN_6P144:
|
|
||||||
millivolts = signed_conversion * 0.187500f;
|
|
||||||
break;
|
|
||||||
case ADS1100_GAIN_4P096:
|
|
||||||
millivolts = signed_conversion * 0.125000f;
|
|
||||||
break;
|
|
||||||
case ADS1100_GAIN_2P048:
|
|
||||||
millivolts = signed_conversion * 0.062500f;
|
|
||||||
break;
|
|
||||||
case ADS1100_GAIN_1P024:
|
|
||||||
millivolts = signed_conversion * 0.031250f;
|
|
||||||
break;
|
|
||||||
case ADS1100_GAIN_0P512:
|
|
||||||
millivolts = signed_conversion * 0.015625f;
|
|
||||||
break;
|
|
||||||
case ADS1100_GAIN_0P256:
|
|
||||||
millivolts = signed_conversion * 0.007813f;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
millivolts = NAN;
|
|
||||||
}
|
|
||||||
|
|
||||||
this->status_clear_warning();
|
|
||||||
return millivolts / 1e3f;
|
|
||||||
}
|
|
||||||
|
|
||||||
float ADS1100Sensor::sample() { return this->parent_->request_measurement(this); }
|
|
||||||
void ADS1100Sensor::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 ads1100
|
|
||||||
} // namespace esphome
|
|
||||||
@@ -1,76 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include "esphome/core/component.h"
|
|
||||||
#include "esphome/components/sensor/sensor.h"
|
|
||||||
#include "esphome/components/i2c/i2c.h"
|
|
||||||
#include "esphome/components/voltage_sampler/voltage_sampler.h"
|
|
||||||
|
|
||||||
namespace esphome {
|
|
||||||
namespace ads1100 {
|
|
||||||
|
|
||||||
enum ADS1100OSMode {
|
|
||||||
ADS1100_OSMODE_SINGLE = 0x80,
|
|
||||||
ADS1100_OSMODE_BUSY = 0x00,
|
|
||||||
ADS1100_OSMODE_NOTBUSY = 0x80,
|
|
||||||
};
|
|
||||||
|
|
||||||
enum ADS1100Mode {
|
|
||||||
ADS1100_MODE_CONTINUOUS = 0x00,
|
|
||||||
ADS1100_MODE_SINGLE = 0x10,
|
|
||||||
};
|
|
||||||
|
|
||||||
enum ADS1100Rate {
|
|
||||||
ADS1100_RATE_128 = 0x00,
|
|
||||||
ADS1100_RATE_32 = 0x04,
|
|
||||||
ADS1100_RATE_16 = 0x08,
|
|
||||||
ADS1100_RATE_8 = 0x0c,
|
|
||||||
};
|
|
||||||
|
|
||||||
enum ADS1100Gain {
|
|
||||||
ADS1100_GAIN_1 = 0x01,
|
|
||||||
ADS1100_GAIN_2 = 0x02,
|
|
||||||
ADS1100_GAIN_4 = 0x03,
|
|
||||||
ADS1100_GAIN_8 = 0x04,
|
|
||||||
};
|
|
||||||
|
|
||||||
class ADS1100Sensor;
|
|
||||||
|
|
||||||
class ADS1100Component : public Component, public i2c::I2CDevice {
|
|
||||||
public:
|
|
||||||
void register_sensor(ADS1100Sensor *obj) { this->sensors_.push_back(obj); }
|
|
||||||
/// Set up the internal sensor array.
|
|
||||||
void setup() override;
|
|
||||||
void dump_config() override;
|
|
||||||
/// HARDWARE_LATE setup priority
|
|
||||||
float get_setup_priority() const override { return setup_priority::DATA; }
|
|
||||||
void set_continuous_mode(bool continuous_mode) { continuous_mode_ = continuous_mode; }
|
|
||||||
|
|
||||||
/// Helper method to request a measurement from a sensor.
|
|
||||||
float request_measurement(ADS1100Sensor *sensor);
|
|
||||||
|
|
||||||
protected:
|
|
||||||
std::vector<ADS1100Sensor *> sensors_;
|
|
||||||
uint16_t prev_config_{0};
|
|
||||||
bool continuous_mode_;
|
|
||||||
};
|
|
||||||
|
|
||||||
/// Internal holder class that is in instance of Sensor so that the hub can create individual sensors.
|
|
||||||
class ADS1100Sensor : public sensor::Sensor, public PollingComponent, public voltage_sampler::VoltageSampler {
|
|
||||||
public:
|
|
||||||
ADS1100Sensor(ADS1100Component *parent) : parent_(parent) {}
|
|
||||||
void update() override;
|
|
||||||
void set_rate(ADS1100Rate rate) { rate_ = rate; }
|
|
||||||
void set_gain(ADS1100Gain gain) { gain_ = gain; }
|
|
||||||
|
|
||||||
float sample() override;
|
|
||||||
uint8_t get_rate() const { return rate_; }
|
|
||||||
uint8_t get_gain() const { return gain_; }
|
|
||||||
|
|
||||||
protected:
|
|
||||||
ADS1100Component *parent_;
|
|
||||||
ADS1100Rate rate_;
|
|
||||||
ADS1100Gain gain_;
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace ads1100
|
|
||||||
} // namespace esphome
|
|
||||||
@@ -1,81 +0,0 @@
|
|||||||
import esphome.codegen as cg
|
|
||||||
import esphome.config_validation as cv
|
|
||||||
from esphome.components import sensor, voltage_sampler
|
|
||||||
from esphome.const import (
|
|
||||||
CONF_GAIN,
|
|
||||||
CONF_MULTIPLEXER,
|
|
||||||
DEVICE_CLASS_VOLTAGE,
|
|
||||||
STATE_CLASS_MEASUREMENT,
|
|
||||||
UNIT_VOLT,
|
|
||||||
CONF_ID,
|
|
||||||
)
|
|
||||||
from . import ads1100_ns, ADS1100Component
|
|
||||||
|
|
||||||
DEPENDENCIES = ["ads1100"]
|
|
||||||
|
|
||||||
ADS1100Multiplexer = ads1100_ns.enum("ADS1100Multiplexer")
|
|
||||||
MUX = {
|
|
||||||
"A0_A1": ADS1100Multiplexer.ADS1100_MULTIPLEXER_P0_N1,
|
|
||||||
"A0_A3": ADS1100Multiplexer.ADS1100_MULTIPLEXER_P0_N3,
|
|
||||||
"A1_A3": ADS1100Multiplexer.ADS1100_MULTIPLEXER_P1_N3,
|
|
||||||
"A2_A3": ADS1100Multiplexer.ADS1100_MULTIPLEXER_P2_N3,
|
|
||||||
"A0_GND": ADS1100Multiplexer.ADS1100_MULTIPLEXER_P0_NG,
|
|
||||||
"A1_GND": ADS1100Multiplexer.ADS1100_MULTIPLEXER_P1_NG,
|
|
||||||
"A2_GND": ADS1100Multiplexer.ADS1100_MULTIPLEXER_P2_NG,
|
|
||||||
"A3_GND": ADS1100Multiplexer.ADS1100_MULTIPLEXER_P3_NG,
|
|
||||||
}
|
|
||||||
|
|
||||||
ADS1100Gain = ads1100_ns.enum("ADS1100Gain")
|
|
||||||
GAIN = {
|
|
||||||
"6.144": ADS1100Gain.ADS1100_GAIN_6P144,
|
|
||||||
"4.096": ADS1100Gain.ADS1100_GAIN_4P096,
|
|
||||||
"2.048": ADS1100Gain.ADS1100_GAIN_2P048,
|
|
||||||
"1.024": ADS1100Gain.ADS1100_GAIN_1P024,
|
|
||||||
"0.512": ADS1100Gain.ADS1100_GAIN_0P512,
|
|
||||||
"0.256": ADS1100Gain.ADS1100_GAIN_0P256,
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
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)
|
|
||||||
|
|
||||||
|
|
||||||
ADS1100Sensor = ads1100_ns.class_(
|
|
||||||
"ADS1100Sensor", sensor.Sensor, cg.PollingComponent, voltage_sampler.VoltageSampler
|
|
||||||
)
|
|
||||||
|
|
||||||
CONF_ADS1100_ID = "ads1100_id"
|
|
||||||
CONFIG_SCHEMA = (
|
|
||||||
sensor.sensor_schema(
|
|
||||||
unit_of_measurement=UNIT_VOLT,
|
|
||||||
accuracy_decimals=3,
|
|
||||||
device_class=DEVICE_CLASS_VOLTAGE,
|
|
||||||
state_class=STATE_CLASS_MEASUREMENT,
|
|
||||||
)
|
|
||||||
.extend(
|
|
||||||
{
|
|
||||||
cv.GenerateID(): cv.declare_id(ADS1100Sensor),
|
|
||||||
cv.GenerateID(CONF_ADS1100_ID): cv.use_id(ADS1100Component),
|
|
||||||
cv.Required(CONF_MULTIPLEXER): cv.enum(MUX, upper=True, space="_"),
|
|
||||||
cv.Required(CONF_GAIN): validate_gain,
|
|
||||||
}
|
|
||||||
)
|
|
||||||
.extend(cv.polling_component_schema("60s"))
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
async def to_code(config):
|
|
||||||
paren = await cg.get_variable(config[CONF_ADS1100_ID])
|
|
||||||
var = cg.new_Pvariable(config[CONF_ID], paren)
|
|
||||||
await sensor.register_sensor(var, config)
|
|
||||||
await cg.register_component(var, config)
|
|
||||||
|
|
||||||
cg.add(var.set_multiplexer(config[CONF_MULTIPLEXER]))
|
|
||||||
cg.add(var.set_gain(config[CONF_GAIN]))
|
|
||||||
|
|
||||||
cg.add(paren.register_sensor(var))
|
|
||||||
@@ -1,531 +0,0 @@
|
|||||||
#include "axp192.h"
|
|
||||||
#include "esphome/core/log.h"
|
|
||||||
|
|
||||||
namespace esphome {
|
|
||||||
namespace axp192 {
|
|
||||||
|
|
||||||
static const char *TAG = "axp192.sensor";
|
|
||||||
|
|
||||||
void AXP192Component::setup()
|
|
||||||
{
|
|
||||||
begin(false, false, false, false, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
void AXP192Component::dump_config() {
|
|
||||||
ESP_LOGCONFIG(TAG, "AXP192:");
|
|
||||||
LOG_I2C_DEVICE(this);
|
|
||||||
LOG_SENSOR(" ", "Battery Level", this->batterylevel_sensor_);
|
|
||||||
}
|
|
||||||
|
|
||||||
float AXP192Component::get_setup_priority() const { return setup_priority::DATA; }
|
|
||||||
|
|
||||||
void AXP192Component::update() {
|
|
||||||
|
|
||||||
if (this->batterylevel_sensor_ != nullptr) {
|
|
||||||
// To be fixed
|
|
||||||
// This is not giving the right value - mostly there to have some sample sensor...
|
|
||||||
float vbat = GetBatVoltage();
|
|
||||||
float batterylevel = 100.0 * ((vbat - 3.0) / (4.1 - 3.0));
|
|
||||||
|
|
||||||
ESP_LOGD(TAG, "Got Battery Level=%f (%f)", batterylevel, vbat);
|
|
||||||
if (batterylevel > 100.) {
|
|
||||||
batterylevel = 100;
|
|
||||||
}
|
|
||||||
this->batterylevel_sensor_->publish_state(batterylevel);
|
|
||||||
}
|
|
||||||
|
|
||||||
UpdateBrightness();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void AXP192Component::begin(bool disableLDO2, bool disableLDO3, bool disableRTC, bool disableDCDC1, bool disableDCDC3)
|
|
||||||
{
|
|
||||||
// Set LDO2 & LDO3(TFT_LED & TFT) 3.0V
|
|
||||||
Write1Byte(0x28, 0xcc);
|
|
||||||
|
|
||||||
// Set ADC sample rate to 200hz
|
|
||||||
Write1Byte(0x84, 0b11110010);
|
|
||||||
|
|
||||||
// Set ADC to All Enable
|
|
||||||
Write1Byte(0x82, 0xff);
|
|
||||||
|
|
||||||
// Bat charge voltage to 4.2, Current 100MA
|
|
||||||
Write1Byte(0x33, 0xc0);
|
|
||||||
|
|
||||||
// Depending on configuration enable LDO2, LDO3, DCDC1, DCDC3.
|
|
||||||
byte buf = (Read8bit(0x12) & 0xef) | 0x4D;
|
|
||||||
if(disableLDO3) buf &= ~(1<<3);
|
|
||||||
if(disableLDO2) buf &= ~(1<<2);
|
|
||||||
if(disableDCDC3) buf &= ~(1<<1);
|
|
||||||
if(disableDCDC1) buf &= ~(1<<0);
|
|
||||||
Write1Byte(0x12, buf);
|
|
||||||
|
|
||||||
// 128ms power on, 4s power off
|
|
||||||
Write1Byte(0x36, 0x0C);
|
|
||||||
|
|
||||||
if(!disableRTC)
|
|
||||||
{
|
|
||||||
// Set RTC voltage to 3.3V
|
|
||||||
Write1Byte(0x91, 0xF0);
|
|
||||||
|
|
||||||
// Set GPIO0 to LDO
|
|
||||||
Write1Byte(0x90, 0x02);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Disable vbus hold limit
|
|
||||||
Write1Byte(0x30, 0x80);
|
|
||||||
|
|
||||||
// Set temperature protection
|
|
||||||
Write1Byte(0x39, 0xfc);
|
|
||||||
|
|
||||||
// Enable RTC BAT charge
|
|
||||||
Write1Byte(0x35, 0xa2 & (disableRTC ? 0x7F : 0xFF));
|
|
||||||
|
|
||||||
// Enable bat detection
|
|
||||||
Write1Byte(0x32, 0x46);
|
|
||||||
}
|
|
||||||
|
|
||||||
void AXP192Component::Write1Byte( uint8_t Addr , uint8_t Data )
|
|
||||||
{
|
|
||||||
this->write_byte(Addr, Data);
|
|
||||||
}
|
|
||||||
|
|
||||||
uint8_t AXP192Component::Read8bit( uint8_t Addr )
|
|
||||||
{
|
|
||||||
uint8_t data;
|
|
||||||
this->read_byte(Addr, &data);
|
|
||||||
return data;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint16_t AXP192Component::Read12Bit( uint8_t Addr)
|
|
||||||
{
|
|
||||||
uint16_t Data = 0;
|
|
||||||
uint8_t buf[2];
|
|
||||||
ReadBuff(Addr,2,buf);
|
|
||||||
Data = ((buf[0] << 4) + buf[1]); //
|
|
||||||
return Data;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint16_t AXP192Component::Read13Bit( uint8_t Addr)
|
|
||||||
{
|
|
||||||
uint16_t Data = 0;
|
|
||||||
uint8_t buf[2];
|
|
||||||
ReadBuff(Addr,2,buf);
|
|
||||||
Data = ((buf[0] << 5) + buf[1]); //
|
|
||||||
return Data;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint16_t AXP192Component::Read16bit( uint8_t Addr )
|
|
||||||
{
|
|
||||||
uint32_t ReData = 0;
|
|
||||||
uint8_t Buff[2];
|
|
||||||
this->read_bytes(Addr, Buff, sizeof(Buff));
|
|
||||||
for( int i = 0 ; i < sizeof(Buff) ; i++ )
|
|
||||||
{
|
|
||||||
ReData <<= 8;
|
|
||||||
ReData |= Buff[i];
|
|
||||||
}
|
|
||||||
return ReData;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32_t AXP192Component::Read24bit( uint8_t Addr )
|
|
||||||
{
|
|
||||||
uint32_t ReData = 0;
|
|
||||||
uint8_t Buff[3];
|
|
||||||
this->read_bytes(Addr, Buff, sizeof(Buff));
|
|
||||||
for( int i = 0 ; i < sizeof(Buff) ; i++ )
|
|
||||||
{
|
|
||||||
ReData <<= 8;
|
|
||||||
ReData |= Buff[i];
|
|
||||||
}
|
|
||||||
return ReData;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32_t AXP192Component::Read32bit( uint8_t Addr )
|
|
||||||
{
|
|
||||||
uint32_t ReData = 0;
|
|
||||||
uint8_t Buff[4];
|
|
||||||
this->read_bytes(Addr, Buff, sizeof(Buff));
|
|
||||||
for( int i = 0 ; i < sizeof(Buff) ; i++ )
|
|
||||||
{
|
|
||||||
ReData <<= 8;
|
|
||||||
ReData |= Buff[i];
|
|
||||||
}
|
|
||||||
return ReData;
|
|
||||||
}
|
|
||||||
|
|
||||||
void AXP192Component::ReadBuff( uint8_t Addr , uint8_t Size , uint8_t *Buff )
|
|
||||||
{
|
|
||||||
this->read_bytes(Addr, Buff, Size);
|
|
||||||
}
|
|
||||||
|
|
||||||
void AXP192Component::UpdateBrightness()
|
|
||||||
{
|
|
||||||
ESP_LOGD(TAG, "Brightness=%f (Curr: %f)", brightness_, curr_brightness_);
|
|
||||||
if (brightness_ == curr_brightness_)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
curr_brightness_ = brightness_;
|
|
||||||
|
|
||||||
const uint8_t c_min = 7;
|
|
||||||
const uint8_t c_max = 12;
|
|
||||||
auto ubri = c_min + static_cast<uint8_t>(brightness_ * (c_max - c_min));
|
|
||||||
|
|
||||||
if (ubri > c_max)
|
|
||||||
{
|
|
||||||
ubri = c_max;
|
|
||||||
}
|
|
||||||
uint8_t buf = Read8bit( 0x28 );
|
|
||||||
Write1Byte( 0x28 , ((buf & 0x0f) | (ubri << 4)) );
|
|
||||||
}
|
|
||||||
|
|
||||||
bool AXP192Component::GetBatState()
|
|
||||||
{
|
|
||||||
if( Read8bit(0x01) | 0x20 )
|
|
||||||
return true;
|
|
||||||
else
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint8_t AXP192Component::GetBatData()
|
|
||||||
{
|
|
||||||
return Read8bit(0x75);
|
|
||||||
}
|
|
||||||
//---------coulombcounter_from_here---------
|
|
||||||
//enable: void EnableCoulombcounter(void);
|
|
||||||
//disable: void DisableCOulombcounter(void);
|
|
||||||
//stop: void StopCoulombcounter(void);
|
|
||||||
//clear: void ClearCoulombcounter(void);
|
|
||||||
//get charge data: uint32_t GetCoulombchargeData(void);
|
|
||||||
//get discharge data: uint32_t GetCoulombdischargeData(void);
|
|
||||||
//get coulomb val affter calculation: float GetCoulombData(void);
|
|
||||||
//------------------------------------------
|
|
||||||
void AXP192Component::EnableCoulombcounter(void)
|
|
||||||
{
|
|
||||||
Write1Byte( 0xB8 , 0x80 );
|
|
||||||
}
|
|
||||||
|
|
||||||
void AXP192Component::DisableCoulombcounter(void)
|
|
||||||
{
|
|
||||||
Write1Byte( 0xB8 , 0x00 );
|
|
||||||
}
|
|
||||||
|
|
||||||
void AXP192Component::StopCoulombcounter(void)
|
|
||||||
{
|
|
||||||
Write1Byte( 0xB8 , 0xC0 );
|
|
||||||
}
|
|
||||||
|
|
||||||
void AXP192Component::ClearCoulombcounter(void)
|
|
||||||
{
|
|
||||||
Write1Byte( 0xB8 , 0xA0 );
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32_t AXP192Component::GetCoulombchargeData(void)
|
|
||||||
{
|
|
||||||
return Read32bit(0xB0);
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32_t AXP192Component::GetCoulombdischargeData(void)
|
|
||||||
{
|
|
||||||
return Read32bit(0xB4);
|
|
||||||
}
|
|
||||||
|
|
||||||
float AXP192Component::GetCoulombData(void)
|
|
||||||
{
|
|
||||||
|
|
||||||
uint32_t coin = 0;
|
|
||||||
uint32_t coout = 0;
|
|
||||||
|
|
||||||
coin = GetCoulombchargeData();
|
|
||||||
coout = GetCoulombdischargeData();
|
|
||||||
|
|
||||||
//c = 65536 * current_LSB * (coin - coout) / 3600 / ADC rate
|
|
||||||
//Adc rate can be read from 84H ,change this variable if you change the ADC reate
|
|
||||||
float ccc = 65536 * 0.5 * (coin - coout) / 3600.0 / 25.0;
|
|
||||||
return ccc;
|
|
||||||
|
|
||||||
}
|
|
||||||
//----------coulomb_end_at_here----------
|
|
||||||
|
|
||||||
uint16_t AXP192Component::GetVbatData(void){
|
|
||||||
|
|
||||||
uint16_t vbat = 0;
|
|
||||||
uint8_t buf[2];
|
|
||||||
ReadBuff(0x78,2,buf);
|
|
||||||
vbat = ((buf[0] << 4) + buf[1]); // V
|
|
||||||
return vbat;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint16_t AXP192Component::GetVinData(void)
|
|
||||||
{
|
|
||||||
uint16_t vin = 0;
|
|
||||||
uint8_t buf[2];
|
|
||||||
ReadBuff(0x56,2,buf);
|
|
||||||
vin = ((buf[0] << 4) + buf[1]); // V
|
|
||||||
return vin;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint16_t AXP192Component::GetIinData(void)
|
|
||||||
{
|
|
||||||
uint16_t iin = 0;
|
|
||||||
uint8_t buf[2];
|
|
||||||
ReadBuff(0x58,2,buf);
|
|
||||||
iin = ((buf[0] << 4) + buf[1]);
|
|
||||||
return iin;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint16_t AXP192Component::GetVusbinData(void)
|
|
||||||
{
|
|
||||||
uint16_t vin = 0;
|
|
||||||
uint8_t buf[2];
|
|
||||||
ReadBuff(0x5a,2,buf);
|
|
||||||
vin = ((buf[0] << 4) + buf[1]); // V
|
|
||||||
return vin;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint16_t AXP192Component::GetIusbinData(void)
|
|
||||||
{
|
|
||||||
uint16_t iin = 0;
|
|
||||||
uint8_t buf[2];
|
|
||||||
ReadBuff(0x5C,2,buf);
|
|
||||||
iin = ((buf[0] << 4) + buf[1]);
|
|
||||||
return iin;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint16_t AXP192Component::GetIchargeData(void)
|
|
||||||
{
|
|
||||||
uint16_t icharge = 0;
|
|
||||||
uint8_t buf[2];
|
|
||||||
ReadBuff(0x7A,2,buf);
|
|
||||||
icharge = ( buf[0] << 5 ) + buf[1] ;
|
|
||||||
return icharge;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint16_t AXP192Component::GetIdischargeData(void)
|
|
||||||
{
|
|
||||||
uint16_t idischarge = 0;
|
|
||||||
uint8_t buf[2];
|
|
||||||
ReadBuff(0x7C,2,buf);
|
|
||||||
idischarge = ( buf[0] << 5 ) + buf[1] ;
|
|
||||||
return idischarge;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint16_t AXP192Component::GetTempData(void)
|
|
||||||
{
|
|
||||||
uint16_t temp = 0;
|
|
||||||
uint8_t buf[2];
|
|
||||||
ReadBuff(0x5e,2,buf);
|
|
||||||
temp = ((buf[0] << 4) + buf[1]);
|
|
||||||
return temp;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32_t AXP192Component::GetPowerbatData(void)
|
|
||||||
{
|
|
||||||
uint32_t power = 0;
|
|
||||||
uint8_t buf[3];
|
|
||||||
ReadBuff(0x70,2,buf);
|
|
||||||
power = (buf[0] << 16) + (buf[1] << 8) + buf[2];
|
|
||||||
return power;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint16_t AXP192Component::GetVapsData(void)
|
|
||||||
{
|
|
||||||
uint16_t vaps = 0;
|
|
||||||
uint8_t buf[2];
|
|
||||||
ReadBuff(0x7e,2,buf);
|
|
||||||
vaps = ((buf[0] << 4) + buf[1]);
|
|
||||||
return vaps;
|
|
||||||
}
|
|
||||||
|
|
||||||
void AXP192Component::SetSleep(void)
|
|
||||||
{
|
|
||||||
Write1Byte(0x31 , Read8bit(0x31) | ( 1 << 3)); // Power off voltag 3.0v
|
|
||||||
Write1Byte(0x90 , Read8bit(0x90) | 0x07); // GPIO1 floating
|
|
||||||
Write1Byte(0x82, 0x00); // Disable ADCs
|
|
||||||
Write1Byte(0x12, Read8bit(0x12) & 0xA1); // Disable all outputs but DCDC1
|
|
||||||
}
|
|
||||||
|
|
||||||
// -- sleep
|
|
||||||
void AXP192Component::DeepSleep(uint64_t time_in_us)
|
|
||||||
{
|
|
||||||
SetSleep();
|
|
||||||
esp_sleep_enable_ext0_wakeup((gpio_num_t)37, LOW);
|
|
||||||
if (time_in_us > 0)
|
|
||||||
{
|
|
||||||
esp_sleep_enable_timer_wakeup(time_in_us);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
esp_sleep_disable_wakeup_source(ESP_SLEEP_WAKEUP_TIMER);
|
|
||||||
}
|
|
||||||
(time_in_us == 0) ? esp_deep_sleep_start() : esp_deep_sleep(time_in_us);
|
|
||||||
}
|
|
||||||
|
|
||||||
void AXP192Component::LightSleep(uint64_t time_in_us)
|
|
||||||
{
|
|
||||||
if (time_in_us > 0)
|
|
||||||
{
|
|
||||||
esp_sleep_enable_timer_wakeup(time_in_us);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
esp_sleep_disable_wakeup_source(ESP_SLEEP_WAKEUP_TIMER);
|
|
||||||
}
|
|
||||||
esp_light_sleep_start();
|
|
||||||
}
|
|
||||||
|
|
||||||
// 0 not press, 0x01 long press, 0x02 press
|
|
||||||
uint8_t AXP192Component::GetBtnPress()
|
|
||||||
{
|
|
||||||
uint8_t state = Read8bit(0x46);
|
|
||||||
if(state)
|
|
||||||
{
|
|
||||||
Write1Byte( 0x46 , 0x03 );
|
|
||||||
}
|
|
||||||
return state;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint8_t AXP192Component::GetWarningLevel(void)
|
|
||||||
{
|
|
||||||
return Read8bit(0x47) & 0x01;
|
|
||||||
}
|
|
||||||
|
|
||||||
float AXP192Component::GetBatVoltage()
|
|
||||||
{
|
|
||||||
float ADCLSB = 1.1 / 1000.0;
|
|
||||||
uint16_t ReData = Read12Bit( 0x78 );
|
|
||||||
return ReData * ADCLSB;
|
|
||||||
}
|
|
||||||
|
|
||||||
float AXP192Component::GetBatCurrent()
|
|
||||||
{
|
|
||||||
float ADCLSB = 0.5;
|
|
||||||
uint16_t CurrentIn = Read13Bit( 0x7A );
|
|
||||||
uint16_t CurrentOut = Read13Bit( 0x7C );
|
|
||||||
return ( CurrentIn - CurrentOut ) * ADCLSB;
|
|
||||||
}
|
|
||||||
|
|
||||||
float AXP192Component::GetVinVoltage()
|
|
||||||
{
|
|
||||||
float ADCLSB = 1.7 / 1000.0;
|
|
||||||
uint16_t ReData = Read12Bit( 0x56 );
|
|
||||||
return ReData * ADCLSB;
|
|
||||||
}
|
|
||||||
|
|
||||||
float AXP192Component::GetVinCurrent()
|
|
||||||
{
|
|
||||||
float ADCLSB = 0.625;
|
|
||||||
uint16_t ReData = Read12Bit( 0x58 );
|
|
||||||
return ReData * ADCLSB;
|
|
||||||
}
|
|
||||||
|
|
||||||
float AXP192Component::GetVBusVoltage()
|
|
||||||
{
|
|
||||||
float ADCLSB = 1.7 / 1000.0;
|
|
||||||
uint16_t ReData = Read12Bit( 0x5A );
|
|
||||||
return ReData * ADCLSB;
|
|
||||||
}
|
|
||||||
|
|
||||||
float AXP192Component::GetVBusCurrent()
|
|
||||||
{
|
|
||||||
float ADCLSB = 0.375;
|
|
||||||
uint16_t ReData = Read12Bit( 0x5C );
|
|
||||||
return ReData * ADCLSB;
|
|
||||||
}
|
|
||||||
|
|
||||||
float AXP192Component::GetTempInAXP192()
|
|
||||||
{
|
|
||||||
float ADCLSB = 0.1;
|
|
||||||
const float OFFSET_DEG_C = -144.7;
|
|
||||||
uint16_t ReData = Read12Bit( 0x5E );
|
|
||||||
return OFFSET_DEG_C + ReData * ADCLSB;
|
|
||||||
}
|
|
||||||
|
|
||||||
float AXP192Component::GetBatPower()
|
|
||||||
{
|
|
||||||
float VoltageLSB = 1.1;
|
|
||||||
float CurrentLCS = 0.5;
|
|
||||||
uint32_t ReData = Read24bit( 0x70 );
|
|
||||||
return VoltageLSB * CurrentLCS * ReData/ 1000.0;
|
|
||||||
}
|
|
||||||
|
|
||||||
float AXP192Component::GetBatChargeCurrent()
|
|
||||||
{
|
|
||||||
float ADCLSB = 0.5;
|
|
||||||
uint16_t ReData = Read13Bit( 0x7A );
|
|
||||||
return ReData * ADCLSB;
|
|
||||||
}
|
|
||||||
|
|
||||||
float AXP192Component::GetAPSVoltage()
|
|
||||||
{
|
|
||||||
float ADCLSB = 1.4 / 1000.0;
|
|
||||||
uint16_t ReData = Read12Bit( 0x7E );
|
|
||||||
return ReData * ADCLSB;
|
|
||||||
}
|
|
||||||
|
|
||||||
float AXP192Component::GetBatCoulombInput()
|
|
||||||
{
|
|
||||||
uint32_t ReData = Read32bit( 0xB0 );
|
|
||||||
return ReData * 65536 * 0.5 / 3600 /25.0;
|
|
||||||
}
|
|
||||||
|
|
||||||
float AXP192Component::GetBatCoulombOut()
|
|
||||||
{
|
|
||||||
uint32_t ReData = Read32bit( 0xB4 );
|
|
||||||
return ReData * 65536 * 0.5 / 3600 /25.0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void AXP192Component::SetCoulombClear()
|
|
||||||
{
|
|
||||||
Write1Byte(0xB8,0x20);
|
|
||||||
}
|
|
||||||
|
|
||||||
void AXP192Component::SetLDO2( bool State )
|
|
||||||
{
|
|
||||||
uint8_t buf = Read8bit(0x12);
|
|
||||||
if( State == true )
|
|
||||||
{
|
|
||||||
buf = (1<<2) | buf;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
buf = ~(1<<2) & buf;
|
|
||||||
}
|
|
||||||
Write1Byte( 0x12 , buf );
|
|
||||||
}
|
|
||||||
|
|
||||||
void AXP192Component::SetLDO3(bool State)
|
|
||||||
{
|
|
||||||
uint8_t buf = Read8bit(0x12);
|
|
||||||
if( State == true )
|
|
||||||
{
|
|
||||||
buf = (1<<3) | buf;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
buf = ~(1<<3) & buf;
|
|
||||||
}
|
|
||||||
Write1Byte( 0x12 , buf );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void AXP192Component::SetChargeCurrent(uint8_t current)
|
|
||||||
{
|
|
||||||
uint8_t buf = Read8bit(0x33);
|
|
||||||
buf = (buf & 0xf0) | (current & 0x07);
|
|
||||||
Write1Byte(0x33, buf);
|
|
||||||
}
|
|
||||||
|
|
||||||
void AXP192Component::PowerOff()
|
|
||||||
{
|
|
||||||
Write1Byte(0x32, Read8bit(0x32) | 0x80);
|
|
||||||
}
|
|
||||||
|
|
||||||
void AXP192Component::SetAdcState(bool state)
|
|
||||||
{
|
|
||||||
Write1Byte(0x82, state ? 0xff : 0x00);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1,116 +0,0 @@
|
|||||||
#ifndef __AXP192_H__
|
|
||||||
#define __AXP192_H__
|
|
||||||
|
|
||||||
#include "esphome/core/component.h"
|
|
||||||
#include "esphome/core/helpers.h"
|
|
||||||
#include "esphome/components/sensor/sensor.h"
|
|
||||||
#include "esphome/components/i2c/i2c.h"
|
|
||||||
|
|
||||||
namespace esphome {
|
|
||||||
namespace axp192 {
|
|
||||||
|
|
||||||
#define SLEEP_MSEC(us) (((uint64_t)us) * 1000L)
|
|
||||||
#define SLEEP_SEC(us) (((uint64_t)us) * 1000000L)
|
|
||||||
#define SLEEP_MIN(us) (((uint64_t)us) * 60L * 1000000L)
|
|
||||||
#define SLEEP_HR(us) (((uint64_t)us) * 60L * 60L * 1000000L)
|
|
||||||
|
|
||||||
#define CURRENT_100MA (0b0000)
|
|
||||||
#define CURRENT_190MA (0b0001)
|
|
||||||
#define CURRENT_280MA (0b0010)
|
|
||||||
#define CURRENT_360MA (0b0011)
|
|
||||||
#define CURRENT_450MA (0b0100)
|
|
||||||
#define CURRENT_550MA (0b0101)
|
|
||||||
#define CURRENT_630MA (0b0110)
|
|
||||||
#define CURRENT_700MA (0b0111)
|
|
||||||
|
|
||||||
class AXP192Component : public PollingComponent, public i2c::I2CDevice {
|
|
||||||
public:
|
|
||||||
void set_batterylevel_sensor(sensor::Sensor *batterylevel_sensor) { batterylevel_sensor_ = batterylevel_sensor; }
|
|
||||||
void set_brightness(float brightness) { brightness_ = brightness; }
|
|
||||||
|
|
||||||
// ========== INTERNAL METHODS ==========
|
|
||||||
// (In most use cases you won't need these)
|
|
||||||
void setup() override;
|
|
||||||
void dump_config() override;
|
|
||||||
float get_setup_priority() const override;
|
|
||||||
void update() override;
|
|
||||||
|
|
||||||
protected:
|
|
||||||
sensor::Sensor *batterylevel_sensor_;
|
|
||||||
float brightness_{1.0f};
|
|
||||||
float curr_brightness_{-1.0f};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* LDO2: Display backlight
|
|
||||||
* LDO3: Display Control
|
|
||||||
* RTC: Don't set GPIO1 as LDO
|
|
||||||
* DCDC1: Main rail. When not set the controller shuts down.
|
|
||||||
* DCDC3: Use unknown
|
|
||||||
*/
|
|
||||||
void begin(bool disableLDO2 = false, bool disableLDO3 = false, bool disableRTC = false, bool disableDCDC1 = false, bool disableDCDC3 = false);
|
|
||||||
void UpdateBrightness();
|
|
||||||
bool GetBatState();
|
|
||||||
uint8_t GetBatData();
|
|
||||||
|
|
||||||
void EnableCoulombcounter(void);
|
|
||||||
void DisableCoulombcounter(void);
|
|
||||||
void StopCoulombcounter(void);
|
|
||||||
void ClearCoulombcounter(void);
|
|
||||||
uint32_t GetCoulombchargeData(void);
|
|
||||||
uint32_t GetCoulombdischargeData(void);
|
|
||||||
float GetCoulombData(void);
|
|
||||||
|
|
||||||
uint16_t GetVbatData(void) __attribute__((deprecated));
|
|
||||||
uint16_t GetIchargeData(void) __attribute__((deprecated));
|
|
||||||
uint16_t GetIdischargeData(void) __attribute__((deprecated));
|
|
||||||
uint16_t GetTempData(void) __attribute__((deprecated));
|
|
||||||
uint32_t GetPowerbatData(void) __attribute__((deprecated));
|
|
||||||
uint16_t GetVinData(void) __attribute__((deprecated));
|
|
||||||
uint16_t GetIinData(void) __attribute__((deprecated));
|
|
||||||
uint16_t GetVusbinData(void) __attribute__((deprecated));
|
|
||||||
uint16_t GetIusbinData(void) __attribute__((deprecated));
|
|
||||||
uint16_t GetVapsData(void) __attribute__((deprecated));
|
|
||||||
uint8_t GetBtnPress(void);
|
|
||||||
|
|
||||||
// -- sleep
|
|
||||||
void SetSleep(void);
|
|
||||||
void DeepSleep(uint64_t time_in_us = 0);
|
|
||||||
void LightSleep(uint64_t time_in_us = 0);
|
|
||||||
|
|
||||||
// void SetChargeVoltage( uint8_t );
|
|
||||||
void SetChargeCurrent( uint8_t );
|
|
||||||
float GetBatVoltage();
|
|
||||||
float GetBatCurrent();
|
|
||||||
float GetVinVoltage();
|
|
||||||
float GetVinCurrent();
|
|
||||||
float GetVBusVoltage();
|
|
||||||
float GetVBusCurrent();
|
|
||||||
float GetTempInAXP192();
|
|
||||||
float GetBatPower();
|
|
||||||
float GetBatChargeCurrent();
|
|
||||||
float GetAPSVoltage();
|
|
||||||
float GetBatCoulombInput();
|
|
||||||
float GetBatCoulombOut();
|
|
||||||
uint8_t GetWarningLevel(void);
|
|
||||||
void SetCoulombClear();
|
|
||||||
void SetLDO2( bool State );
|
|
||||||
void SetLDO3( bool State );
|
|
||||||
void SetAdcState(bool State);
|
|
||||||
|
|
||||||
void PowerOff();
|
|
||||||
|
|
||||||
|
|
||||||
void Write1Byte( uint8_t Addr , uint8_t Data );
|
|
||||||
uint8_t Read8bit( uint8_t Addr );
|
|
||||||
uint16_t Read12Bit( uint8_t Addr);
|
|
||||||
uint16_t Read13Bit( uint8_t Addr);
|
|
||||||
uint16_t Read16bit( uint8_t Addr );
|
|
||||||
uint32_t Read24bit( uint8_t Addr );
|
|
||||||
uint32_t Read32bit( uint8_t Addr );
|
|
||||||
void ReadBuff( uint8_t Addr , uint8_t Size , uint8_t *Buff );
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -1,34 +0,0 @@
|
|||||||
import esphome.codegen as cg
|
|
||||||
import esphome.config_validation as cv
|
|
||||||
from esphome.components import i2c, sensor
|
|
||||||
from esphome.const import CONF_ID,\
|
|
||||||
CONF_BATTERY_LEVEL, CONF_BRIGHTNESS, UNIT_PERCENT, ICON_BATTERY
|
|
||||||
|
|
||||||
DEPENDENCIES = ['i2c']
|
|
||||||
|
|
||||||
axp192_ns = cg.esphome_ns.namespace('axp192')
|
|
||||||
|
|
||||||
AXP192Component = axp192_ns.class_('AXP192Component', cg.PollingComponent, i2c.I2CDevice)
|
|
||||||
|
|
||||||
CONFIG_SCHEMA = cv.Schema({
|
|
||||||
cv.GenerateID(): cv.declare_id(AXP192Component),
|
|
||||||
cv.Optional(CONF_BATTERY_LEVEL):
|
|
||||||
sensor.sensor_schema(UNIT_PERCENT, ICON_BATTERY, 1).extend({
|
|
||||||
}),
|
|
||||||
cv.Optional(CONF_BRIGHTNESS, default=1.0): cv.percentage,
|
|
||||||
}).extend(cv.polling_component_schema('60s')).extend(i2c.i2c_device_schema(0x77))
|
|
||||||
|
|
||||||
|
|
||||||
def to_code(config):
|
|
||||||
var = cg.new_Pvariable(config[CONF_ID])
|
|
||||||
yield cg.register_component(var, config)
|
|
||||||
yield i2c.register_i2c_device(var, config)
|
|
||||||
|
|
||||||
if CONF_BATTERY_LEVEL in config:
|
|
||||||
conf = config[CONF_BATTERY_LEVEL]
|
|
||||||
sens = yield sensor.new_sensor(conf)
|
|
||||||
cg.add(var.set_batterylevel_sensor(sens))
|
|
||||||
|
|
||||||
if CONF_BRIGHTNESS in config:
|
|
||||||
conf = config[CONF_BRIGHTNESS]
|
|
||||||
cg.add(var.set_brightness(conf))
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
# heap space monitor
|
|
||||||
|
|
||||||
A sensor to show the available heap space.
|
|
||||||
|
|
||||||
Example:
|
|
||||||
```yaml
|
|
||||||
sensor:
|
|
||||||
- platform: heapmon
|
|
||||||
id: heapspace
|
|
||||||
name: "Free Space"
|
|
||||||
```
|
|
||||||
|
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
#include "heapmon.h"
|
|
||||||
#include "esphome/core/log.h"
|
|
||||||
|
|
||||||
namespace esphome {
|
|
||||||
namespace debug {
|
|
||||||
|
|
||||||
static const char *TAG = "heapmon";
|
|
||||||
|
|
||||||
void HeapMonitor::update() {
|
|
||||||
uint32_t free_heap = ESP.getFreeHeap();
|
|
||||||
ESP_LOGD(TAG, "Free Heap Size: %u bytes", free_heap);
|
|
||||||
this->publish_state(free_heap);
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace debug
|
|
||||||
} // namespace esphome
|
|
||||||
|
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include "esphome/core/component.h"
|
|
||||||
#include "esphome/components/sensor/sensor.h"
|
|
||||||
|
|
||||||
namespace esphome {
|
|
||||||
namespace debug {
|
|
||||||
|
|
||||||
class HeapMonitor : public sensor::Sensor, public PollingComponent {
|
|
||||||
public:
|
|
||||||
void update() override;
|
|
||||||
float get_setup_priority() const override { return setup_priority::LATE; };
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace debug
|
|
||||||
} // namespace esphome
|
|
||||||
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
import esphome.config_validation as cv
|
|
||||||
import esphome.codegen as cg
|
|
||||||
from esphome.components import sensor
|
|
||||||
from esphome.const import CONF_ID, ICON_GAUGE
|
|
||||||
|
|
||||||
UNIT_BYTE = "B"
|
|
||||||
|
|
||||||
debug_ns = cg.esphome_ns.namespace('debug')
|
|
||||||
HeapMonitor = debug_ns.class_('HeapMonitor', cg.PollingComponent)
|
|
||||||
CONFIG_SCHEMA = sensor.sensor_schema(UNIT_BYTE, ICON_GAUGE, 0).extend({
|
|
||||||
cv.GenerateID(): cv.declare_id(HeapMonitor),
|
|
||||||
}).extend(cv.polling_component_schema('60s'))
|
|
||||||
|
|
||||||
def to_code(config):
|
|
||||||
var = cg.new_Pvariable(config[CONF_ID])
|
|
||||||
yield cg.register_component(var, config)
|
|
||||||
yield sensor.register_sensor(var, config)
|
|
||||||
|
|
||||||
@@ -1,61 +0,0 @@
|
|||||||
import esphome.codegen as cg
|
|
||||||
import esphome.config_validation as cv
|
|
||||||
from esphome import pins
|
|
||||||
from esphome.components import display, spi
|
|
||||||
from esphome.const import CONF_DC_PIN, \
|
|
||||||
CONF_ID, CONF_LAMBDA, CONF_MODEL, CONF_PAGES, CONF_RESET_PIN
|
|
||||||
|
|
||||||
DEPENDENCIES = ['spi']
|
|
||||||
|
|
||||||
CONF_LED_PIN = 'led_pin'
|
|
||||||
|
|
||||||
ili9341_ns = cg.esphome_ns.namespace('ili9341')
|
|
||||||
ili9341 = ili9341_ns.class_('ILI9341Display', cg.PollingComponent, spi.SPIDevice,
|
|
||||||
display.DisplayBuffer)
|
|
||||||
ILI9341M5Stack = ili9341_ns.class_('ILI9341M5Stack', ili9341)
|
|
||||||
ILI9341TFT24 = ili9341_ns.class_('ILI9341TFT24', ili9341)
|
|
||||||
|
|
||||||
ILI9341Model = ili9341_ns.enum('ILI9341Model')
|
|
||||||
|
|
||||||
MODELS = {
|
|
||||||
'M5STACK': ILI9341Model.M5STACK,
|
|
||||||
'TFT_2.4': ILI9341Model.TFT_24,
|
|
||||||
}
|
|
||||||
|
|
||||||
ILI9341_MODEL = cv.enum(MODELS, upper=True, space="_")
|
|
||||||
|
|
||||||
CONFIG_SCHEMA = cv.All(display.FULL_DISPLAY_SCHEMA.extend({
|
|
||||||
cv.GenerateID(): cv.declare_id(ili9341),
|
|
||||||
cv.Required(CONF_MODEL): ILI9341_MODEL,
|
|
||||||
cv.Required(CONF_DC_PIN): pins.gpio_output_pin_schema,
|
|
||||||
cv.Optional(CONF_RESET_PIN): pins.gpio_output_pin_schema,
|
|
||||||
cv.Optional(CONF_LED_PIN): pins.gpio_output_pin_schema,
|
|
||||||
}).extend(cv.polling_component_schema('1s')).extend(spi.spi_device_schema()),
|
|
||||||
cv.has_at_most_one_key(CONF_PAGES, CONF_LAMBDA))
|
|
||||||
|
|
||||||
|
|
||||||
def to_code(config):
|
|
||||||
if config[CONF_MODEL] == 'M5STACK':
|
|
||||||
lcd_type = ILI9341M5Stack
|
|
||||||
if config[CONF_MODEL] == 'TFT_2.4':
|
|
||||||
lcd_type = ILI9341TFT24
|
|
||||||
rhs = lcd_type.new()
|
|
||||||
var = cg.Pvariable(config[CONF_ID], rhs)
|
|
||||||
|
|
||||||
yield cg.register_component(var, config)
|
|
||||||
yield display.register_display(var, config)
|
|
||||||
yield spi.register_spi_device(var, config)
|
|
||||||
cg.add(var.set_model(config[CONF_MODEL]))
|
|
||||||
dc = yield cg.gpio_pin_expression(config[CONF_DC_PIN])
|
|
||||||
cg.add(var.set_dc_pin(dc))
|
|
||||||
|
|
||||||
if CONF_LAMBDA in config:
|
|
||||||
lambda_ = yield cg.process_lambda(config[CONF_LAMBDA], [(display.DisplayBufferRef, 'it')],
|
|
||||||
return_type=cg.void)
|
|
||||||
cg.add(var.set_writer(lambda_))
|
|
||||||
if CONF_RESET_PIN in config:
|
|
||||||
reset = yield cg.gpio_pin_expression(config[CONF_RESET_PIN])
|
|
||||||
cg.add(var.set_reset_pin(reset))
|
|
||||||
if CONF_LED_PIN in config:
|
|
||||||
led_pin = yield cg.gpio_pin_expression(config[CONF_LED_PIN])
|
|
||||||
cg.add(var.set_led_pin(led_pin))
|
|
||||||
@@ -1,83 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
namespace esphome {
|
|
||||||
namespace ili9341 {
|
|
||||||
|
|
||||||
// Color definitions
|
|
||||||
// clang-format off
|
|
||||||
static const uint8_t MADCTL_MY = 0x80; ///< Bit 7 Bottom to top
|
|
||||||
static const uint8_t MADCTL_MX = 0x40; ///< Bit 6 Right to left
|
|
||||||
static const uint8_t MADCTL_MV = 0x20; ///< Bit 5 Reverse Mode
|
|
||||||
static const uint8_t MADCTL_ML = 0x10; ///< Bit 4 LCD refresh Bottom to top
|
|
||||||
static const uint8_t MADCTL_RGB = 0x00; ///< Bit 3 Red-Green-Blue pixel order
|
|
||||||
static const uint8_t MADCTL_BGR = 0x08; ///< Bit 3 Blue-Green-Red pixel order
|
|
||||||
static const uint8_t MADCTL_MH = 0x04; ///< Bit 2 LCD refresh right to left
|
|
||||||
// clang-format on
|
|
||||||
|
|
||||||
static const uint16_t ILI9341_TFTWIDTH = 320; ///< ILI9341 max TFT width
|
|
||||||
static const uint16_t ILI9341_TFTHEIGHT = 240; ///< ILI9341 max TFT height
|
|
||||||
|
|
||||||
// All ILI9341 specific commands some are used by init()
|
|
||||||
static const uint8_t ILI9341_NOP = 0x00;
|
|
||||||
static const uint8_t ILI9341_SWRESET = 0x01;
|
|
||||||
static const uint8_t ILI9341_RDDID = 0x04;
|
|
||||||
static const uint8_t ILI9341_RDDST = 0x09;
|
|
||||||
|
|
||||||
static const uint8_t ILI9341_SLPIN = 0x10;
|
|
||||||
static const uint8_t ILI9341_SLPOUT = 0x11;
|
|
||||||
static const uint8_t ILI9341_PTLON = 0x12;
|
|
||||||
static const uint8_t ILI9341_NORON = 0x13;
|
|
||||||
|
|
||||||
static const uint8_t ILI9341_RDMODE = 0x0A;
|
|
||||||
static const uint8_t ILI9341_RDMADCTL = 0x0B;
|
|
||||||
static const uint8_t ILI9341_RDPIXFMT = 0x0C;
|
|
||||||
static const uint8_t ILI9341_RDIMGFMT = 0x0A;
|
|
||||||
static const uint8_t ILI9341_RDSELFDIAG = 0x0F;
|
|
||||||
|
|
||||||
static const uint8_t ILI9341_INVOFF = 0x20;
|
|
||||||
static const uint8_t ILI9341_INVON = 0x21;
|
|
||||||
static const uint8_t ILI9341_GAMMASET = 0x26;
|
|
||||||
static const uint8_t ILI9341_DISPOFF = 0x28;
|
|
||||||
static const uint8_t ILI9341_DISPON = 0x29;
|
|
||||||
|
|
||||||
static const uint8_t ILI9341_CASET = 0x2A;
|
|
||||||
static const uint8_t ILI9341_PASET = 0x2B;
|
|
||||||
static const uint8_t ILI9341_RAMWR = 0x2C;
|
|
||||||
static const uint8_t ILI9341_RAMRD = 0x2E;
|
|
||||||
|
|
||||||
static const uint8_t ILI9341_PTLAR = 0x30;
|
|
||||||
static const uint8_t ILI9341_VSCRDEF = 0x33;
|
|
||||||
static const uint8_t ILI9341_MADCTL = 0x36;
|
|
||||||
static const uint8_t ILI9341_VSCRSADD = 0x37;
|
|
||||||
static const uint8_t ILI9341_PIXFMT = 0x3A;
|
|
||||||
|
|
||||||
static const uint8_t ILI9341_WRDISBV = 0x51;
|
|
||||||
static const uint8_t ILI9341_RDDISBV = 0x52;
|
|
||||||
static const uint8_t ILI9341_WRCTRLD = 0x53;
|
|
||||||
|
|
||||||
static const uint8_t ILI9341_FRMCTR1 = 0xB1;
|
|
||||||
static const uint8_t ILI9341_FRMCTR2 = 0xB2;
|
|
||||||
static const uint8_t ILI9341_FRMCTR3 = 0xB3;
|
|
||||||
static const uint8_t ILI9341_INVCTR = 0xB4;
|
|
||||||
static const uint8_t ILI9341_DFUNCTR = 0xB6;
|
|
||||||
|
|
||||||
static const uint8_t ILI9341_PWCTR1 = 0xC0;
|
|
||||||
static const uint8_t ILI9341_PWCTR2 = 0xC1;
|
|
||||||
static const uint8_t ILI9341_PWCTR3 = 0xC2;
|
|
||||||
static const uint8_t ILI9341_PWCTR4 = 0xC3;
|
|
||||||
static const uint8_t ILI9341_PWCTR5 = 0xC4;
|
|
||||||
static const uint8_t ILI9341_VMCTR1 = 0xC5;
|
|
||||||
static const uint8_t ILI9341_VMCTR2 = 0xC7;
|
|
||||||
|
|
||||||
static const uint8_t ILI9341_RDID4 = 0xD3;
|
|
||||||
static const uint8_t ILI9341_RDINDEX = 0xD9;
|
|
||||||
static const uint8_t ILI9341_RDID1 = 0xDA;
|
|
||||||
static const uint8_t ILI9341_RDID2 = 0xDB;
|
|
||||||
static const uint8_t ILI9341_RDID3 = 0xDC;
|
|
||||||
static const uint8_t ILI9341_RDIDX = 0xDD; // TBC
|
|
||||||
|
|
||||||
static const uint8_t ILI9341_GMCTRP1 = 0xE0;
|
|
||||||
static const uint8_t ILI9341_GMCTRN1 = 0xE1;
|
|
||||||
|
|
||||||
} // namespace ili9341
|
|
||||||
} // namespace esphome
|
|
||||||
@@ -1,240 +0,0 @@
|
|||||||
#include "ili9341_display.h"
|
|
||||||
#include "esphome/core/log.h"
|
|
||||||
#include "esphome/core/application.h"
|
|
||||||
#include "esphome/core/helpers.h"
|
|
||||||
|
|
||||||
namespace esphome {
|
|
||||||
namespace ili9341 {
|
|
||||||
|
|
||||||
static const char *TAG = "ili9341";
|
|
||||||
|
|
||||||
void ILI9341Display::setup_pins_() {
|
|
||||||
this->init_internal_(this->get_buffer_length_());
|
|
||||||
this->dc_pin_->setup(); // OUTPUT
|
|
||||||
this->dc_pin_->digital_write(false);
|
|
||||||
if (this->reset_pin_ != nullptr) {
|
|
||||||
this->reset_pin_->setup(); // OUTPUT
|
|
||||||
this->reset_pin_->digital_write(true);
|
|
||||||
}
|
|
||||||
if (this->led_pin_ != nullptr) {
|
|
||||||
this->led_pin_->setup();
|
|
||||||
this->led_pin_->digital_write(true);
|
|
||||||
}
|
|
||||||
this->spi_setup();
|
|
||||||
|
|
||||||
this->reset_();
|
|
||||||
}
|
|
||||||
|
|
||||||
void ILI9341Display::dump_config() {
|
|
||||||
LOG_DISPLAY("", "ili9341", this);
|
|
||||||
ESP_LOGCONFIG(TAG, " Width: %d, Height: %d, Rotation: %d", this->width_, this->height_, this->rotation_);
|
|
||||||
LOG_PIN(" Reset Pin: ", this->reset_pin_);
|
|
||||||
LOG_PIN(" DC Pin: ", this->dc_pin_);
|
|
||||||
LOG_PIN(" Busy Pin: ", this->busy_pin_);
|
|
||||||
LOG_PIN(" Backlight Pin: ", this->led_pin_);
|
|
||||||
LOG_UPDATE_INTERVAL(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
float ILI9341Display::get_setup_priority() const { return setup_priority::PROCESSOR; }
|
|
||||||
void ILI9341Display::command(uint8_t value) {
|
|
||||||
this->start_command_();
|
|
||||||
this->write_byte(value);
|
|
||||||
this->end_command_();
|
|
||||||
}
|
|
||||||
|
|
||||||
void ILI9341Display::reset_() {
|
|
||||||
if (this->reset_pin_ != nullptr) {
|
|
||||||
this->reset_pin_->digital_write(false);
|
|
||||||
delay(10);
|
|
||||||
this->reset_pin_->digital_write(true);
|
|
||||||
delay(10);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void ILI9341Display::data(uint8_t value) {
|
|
||||||
this->start_data_();
|
|
||||||
this->write_byte(value);
|
|
||||||
this->end_data_();
|
|
||||||
}
|
|
||||||
|
|
||||||
void ILI9341Display::send_command(uint8_t command_byte, const uint8_t *data_bytes, uint8_t num_data_bytes) {
|
|
||||||
this->command(command_byte); // Send the command byte
|
|
||||||
this->start_data_();
|
|
||||||
this->write_array(data_bytes, num_data_bytes);
|
|
||||||
this->end_data_();
|
|
||||||
}
|
|
||||||
|
|
||||||
uint8_t ILI9341Display::read_command(uint8_t command_byte, uint8_t index) {
|
|
||||||
uint8_t data = 0x10 + index;
|
|
||||||
this->send_command(0xD9, &data, 1); // Set Index Register
|
|
||||||
uint8_t result;
|
|
||||||
this->start_command_();
|
|
||||||
this->write_byte(command_byte);
|
|
||||||
this->start_data_();
|
|
||||||
do {
|
|
||||||
result = this->read_byte();
|
|
||||||
} while (index--);
|
|
||||||
this->end_data_();
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ILI9341Display::update() {
|
|
||||||
this->do_update_();
|
|
||||||
this->display_();
|
|
||||||
}
|
|
||||||
|
|
||||||
void ILI9341Display::display_() {
|
|
||||||
// we will only update the changed window to the display
|
|
||||||
int w = this->x_high_ - this->x_low_ + 1;
|
|
||||||
int h = this->y_high_ - this->y_low_ + 1;
|
|
||||||
|
|
||||||
set_addr_window_(this->x_low_, this->y_low_, w, h);
|
|
||||||
this->start_data_();
|
|
||||||
uint32_t start_pos = ((this->y_low_ * this->width_) + x_low_);
|
|
||||||
for (uint16_t row = 0; row < h; row++) {
|
|
||||||
for (uint16_t col = 0; col < w; col++) {
|
|
||||||
uint32_t pos = start_pos + (row * width_) + col;
|
|
||||||
|
|
||||||
uint16_t color = convert_to_16bit_color_(buffer_[pos]);
|
|
||||||
this->write_byte(color >> 8);
|
|
||||||
this->write_byte(color);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
this->end_data_();
|
|
||||||
|
|
||||||
// invalidate watermarks
|
|
||||||
this->x_low_ = this->width_;
|
|
||||||
this->y_low_ = this->height_;
|
|
||||||
this->x_high_ = 0;
|
|
||||||
this->y_high_ = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint16_t ILI9341Display::convert_to_16bit_color_(uint8_t color_8bit) {
|
|
||||||
int r = color_8bit >> 5;
|
|
||||||
int g = (color_8bit >> 2) & 0x07;
|
|
||||||
int b = color_8bit & 0x03;
|
|
||||||
uint16_t color = (r * 0x04) << 11;
|
|
||||||
color |= (g * 0x09) << 5;
|
|
||||||
color |= (b * 0x0A);
|
|
||||||
|
|
||||||
return color;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint8_t ILI9341Display::convert_to_8bit_color_(uint16_t color_16bit) {
|
|
||||||
// convert 16bit color to 8 bit buffer
|
|
||||||
uint8_t r = color_16bit >> 11;
|
|
||||||
uint8_t g = (color_16bit >> 5) & 0x3F;
|
|
||||||
uint8_t b = color_16bit & 0x1F;
|
|
||||||
|
|
||||||
return ((b / 0x0A) | ((g / 0x09) << 2) | ((r / 0x04) << 5));
|
|
||||||
}
|
|
||||||
|
|
||||||
void ILI9341Display::fill(Color color) {
|
|
||||||
auto color565 = color.to_rgb_565();
|
|
||||||
memset(this->buffer_, convert_to_8bit_color_(color565), this->get_buffer_length_());
|
|
||||||
this->x_low_ = 0;
|
|
||||||
this->y_low_ = 0;
|
|
||||||
this->x_high_ = this->get_width_internal() - 1;
|
|
||||||
this->y_high_ = this->get_height_internal() - 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ILI9341Display::fill_internal_(Color color) {
|
|
||||||
this->set_addr_window_(0, 0, this->get_width_internal(), this->get_height_internal());
|
|
||||||
this->start_data_();
|
|
||||||
|
|
||||||
auto color565 = color.to_rgb_565();
|
|
||||||
for (uint32_t i = 0; i < (this->get_width_internal()) * (this->get_height_internal()); i++) {
|
|
||||||
this->write_byte(color565 >> 8);
|
|
||||||
this->write_byte(color565);
|
|
||||||
buffer_[i] = 0;
|
|
||||||
}
|
|
||||||
this->end_data_();
|
|
||||||
}
|
|
||||||
|
|
||||||
void HOT ILI9341Display::draw_absolute_pixel_internal(int x, int y, Color color) {
|
|
||||||
if (x >= this->get_width_internal() || x < 0 || y >= this->get_height_internal() || y < 0)
|
|
||||||
return;
|
|
||||||
|
|
||||||
// low and high watermark may speed up drawing from buffer
|
|
||||||
this->x_low_ = (x < this->x_low_) ? x : this->x_low_;
|
|
||||||
this->y_low_ = (y < this->y_low_) ? y : this->y_low_;
|
|
||||||
this->x_high_ = (x > this->x_high_) ? x : this->x_high_;
|
|
||||||
this->y_high_ = (y > this->y_high_) ? y : this->y_high_;
|
|
||||||
|
|
||||||
uint32_t pos = (y * width_) + x;
|
|
||||||
auto color565 = color.to_rgb_565();
|
|
||||||
buffer_[pos] = convert_to_8bit_color_(color565);
|
|
||||||
}
|
|
||||||
|
|
||||||
// should return the total size: return this->get_width_internal() * this->get_height_internal() * 2 // 16bit color
|
|
||||||
// values per bit is huge
|
|
||||||
uint32_t ILI9341Display::get_buffer_length_() { return this->get_width_internal() * this->get_height_internal(); }
|
|
||||||
|
|
||||||
void ILI9341Display::start_command_() {
|
|
||||||
this->dc_pin_->digital_write(false);
|
|
||||||
this->enable();
|
|
||||||
}
|
|
||||||
|
|
||||||
void ILI9341Display::end_command_() { this->disable(); }
|
|
||||||
void ILI9341Display::start_data_() {
|
|
||||||
this->dc_pin_->digital_write(true);
|
|
||||||
this->enable();
|
|
||||||
}
|
|
||||||
void ILI9341Display::end_data_() { this->disable(); }
|
|
||||||
|
|
||||||
void ILI9341Display::init_lcd_(const uint8_t *init_cmd) {
|
|
||||||
uint8_t cmd, x, num_args;
|
|
||||||
const uint8_t *addr = init_cmd;
|
|
||||||
while ((cmd = pgm_read_byte(addr++)) > 0) {
|
|
||||||
x = pgm_read_byte(addr++);
|
|
||||||
num_args = x & 0x7F;
|
|
||||||
send_command(cmd, addr, num_args);
|
|
||||||
addr += num_args;
|
|
||||||
if (x & 0x80)
|
|
||||||
delay(150); // NOLINT
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void ILI9341Display::set_addr_window_(uint16_t x1, uint16_t y1, uint16_t w, uint16_t h) {
|
|
||||||
uint16_t x2 = (x1 + w - 1), y2 = (y1 + h - 1);
|
|
||||||
this->command(ILI9341_CASET); // Column address set
|
|
||||||
this->start_data_();
|
|
||||||
this->write_byte(x1 >> 8);
|
|
||||||
this->write_byte(x1);
|
|
||||||
this->write_byte(x2 >> 8);
|
|
||||||
this->write_byte(x2);
|
|
||||||
this->end_data_();
|
|
||||||
this->command(ILI9341_PASET); // Row address set
|
|
||||||
this->start_data_();
|
|
||||||
this->write_byte(y1 >> 8);
|
|
||||||
this->write_byte(y1);
|
|
||||||
this->write_byte(y2 >> 8);
|
|
||||||
this->write_byte(y2);
|
|
||||||
this->end_data_();
|
|
||||||
this->command(ILI9341_RAMWR); // Write to RAM
|
|
||||||
}
|
|
||||||
|
|
||||||
void ILI9341Display::invert_display_(bool invert) { this->command(invert ? ILI9341_INVON : ILI9341_INVOFF); }
|
|
||||||
|
|
||||||
int ILI9341Display::get_width_internal() { return this->width_; }
|
|
||||||
int ILI9341Display::get_height_internal() { return this->height_; }
|
|
||||||
|
|
||||||
// M5Stack display
|
|
||||||
void ILI9341M5Stack::initialize() {
|
|
||||||
this->init_lcd_(INITCMD_M5STACK);
|
|
||||||
this->width_ = 320;
|
|
||||||
this->height_ = 240;
|
|
||||||
this->invert_display_(true);
|
|
||||||
this->fill_internal_(COLOR_BLACK);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 24_TFT display
|
|
||||||
void ILI9341TFT24::initialize() {
|
|
||||||
this->init_lcd_(INITCMD_TFT);
|
|
||||||
this->width_ = 240;
|
|
||||||
this->height_ = 320;
|
|
||||||
this->fill_internal_(COLOR_BLACK);
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace ili9341
|
|
||||||
} // namespace esphome
|
|
||||||
@@ -1,92 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include "esphome/core/component.h"
|
|
||||||
#include "esphome/components/spi/spi.h"
|
|
||||||
#include "esphome/components/display/display_buffer.h"
|
|
||||||
#include "ili9341_defines.h"
|
|
||||||
#include "ili9341_init.h"
|
|
||||||
|
|
||||||
namespace esphome {
|
|
||||||
namespace ili9341 {
|
|
||||||
|
|
||||||
enum ILI9341Model {
|
|
||||||
M5STACK = 0,
|
|
||||||
TFT_24,
|
|
||||||
};
|
|
||||||
|
|
||||||
class ILI9341Display : public PollingComponent,
|
|
||||||
public display::DisplayBuffer,
|
|
||||||
public spi::SPIDevice<spi::BIT_ORDER_MSB_FIRST, spi::CLOCK_POLARITY_LOW,
|
|
||||||
spi::CLOCK_PHASE_LEADING, spi::DATA_RATE_40MHZ> {
|
|
||||||
public:
|
|
||||||
void set_dc_pin(GPIOPin *dc_pin) { dc_pin_ = dc_pin; }
|
|
||||||
float get_setup_priority() const override;
|
|
||||||
void set_reset_pin(GPIOPin *reset) { this->reset_pin_ = reset; }
|
|
||||||
void set_led_pin(GPIOPin *led) { this->led_pin_ = led; }
|
|
||||||
void set_model(ILI9341Model model) { this->model_ = model; }
|
|
||||||
|
|
||||||
void command(uint8_t value);
|
|
||||||
void data(uint8_t value);
|
|
||||||
void send_command(uint8_t command_byte, const uint8_t *data_bytes, uint8_t num_data_bytes);
|
|
||||||
uint8_t read_command(uint8_t command_byte, uint8_t index);
|
|
||||||
virtual void initialize() = 0;
|
|
||||||
|
|
||||||
void update() override;
|
|
||||||
|
|
||||||
void fill(Color color) override;
|
|
||||||
|
|
||||||
void dump_config() override;
|
|
||||||
void setup() override {
|
|
||||||
this->setup_pins_();
|
|
||||||
this->initialize();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected:
|
|
||||||
void draw_absolute_pixel_internal(int x, int y, Color color) override;
|
|
||||||
void setup_pins_();
|
|
||||||
|
|
||||||
void init_lcd_(const uint8_t *init_cmd);
|
|
||||||
void set_addr_window_(uint16_t x, uint16_t y, uint16_t w, uint16_t h);
|
|
||||||
void invert_display_(bool invert);
|
|
||||||
void reset_();
|
|
||||||
void fill_internal_(Color color);
|
|
||||||
void display_();
|
|
||||||
uint16_t convert_to_16bit_color_(uint8_t color_8bit);
|
|
||||||
uint8_t convert_to_8bit_color_(uint16_t color_16bit);
|
|
||||||
|
|
||||||
ILI9341Model model_;
|
|
||||||
int16_t width_{320}; ///< Display width as modified by current rotation
|
|
||||||
int16_t height_{240}; ///< Display height as modified by current rotation
|
|
||||||
uint16_t x_low_{0};
|
|
||||||
uint16_t y_low_{0};
|
|
||||||
uint16_t x_high_{0};
|
|
||||||
uint16_t y_high_{0};
|
|
||||||
|
|
||||||
uint32_t get_buffer_length_();
|
|
||||||
int get_width_internal() override;
|
|
||||||
int get_height_internal() override;
|
|
||||||
|
|
||||||
void start_command_();
|
|
||||||
void end_command_();
|
|
||||||
void start_data_();
|
|
||||||
void end_data_();
|
|
||||||
|
|
||||||
GPIOPin *reset_pin_{nullptr};
|
|
||||||
GPIOPin *led_pin_{nullptr};
|
|
||||||
GPIOPin *dc_pin_;
|
|
||||||
GPIOPin *busy_pin_{nullptr};
|
|
||||||
};
|
|
||||||
|
|
||||||
//----------- M5Stack display --------------
|
|
||||||
class ILI9341M5Stack : public ILI9341Display {
|
|
||||||
public:
|
|
||||||
void initialize() override;
|
|
||||||
};
|
|
||||||
|
|
||||||
//----------- ILI9341_24_TFT display --------------
|
|
||||||
class ILI9341TFT24 : public ILI9341Display {
|
|
||||||
public:
|
|
||||||
void initialize() override;
|
|
||||||
};
|
|
||||||
} // namespace ili9341
|
|
||||||
} // namespace esphome
|
|
||||||
@@ -1,70 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
#include "esphome/core/helpers.h"
|
|
||||||
|
|
||||||
namespace esphome {
|
|
||||||
namespace ili9341 {
|
|
||||||
|
|
||||||
// clang-format off
|
|
||||||
static const uint8_t PROGMEM INITCMD_M5STACK[] = {
|
|
||||||
0xEF, 3, 0x03, 0x80, 0x02,
|
|
||||||
0xCF, 3, 0x00, 0xC1, 0x30,
|
|
||||||
0xED, 4, 0x64, 0x03, 0x12, 0x81,
|
|
||||||
0xE8, 3, 0x85, 0x00, 0x78,
|
|
||||||
0xCB, 5, 0x39, 0x2C, 0x00, 0x34, 0x02,
|
|
||||||
0xF7, 1, 0x20,
|
|
||||||
0xEA, 2, 0x00, 0x00,
|
|
||||||
ILI9341_PWCTR1 , 1, 0x23, // Power control VRH[5:0]
|
|
||||||
ILI9341_PWCTR2 , 1, 0x10, // Power control SAP[2:0];BT[3:0]
|
|
||||||
ILI9341_VMCTR1 , 2, 0x3e, 0x28, // VCM control
|
|
||||||
ILI9341_VMCTR2 , 1, 0x86, // VCM control2
|
|
||||||
ILI9341_MADCTL , 1, MADCTL_BGR, // Memory Access Control
|
|
||||||
ILI9341_VSCRSADD, 1, 0x00, // Vertical scroll zero
|
|
||||||
ILI9341_PIXFMT , 1, 0x55,
|
|
||||||
ILI9341_FRMCTR1 , 2, 0x00, 0x13,
|
|
||||||
ILI9341_DFUNCTR , 3, 0x08, 0x82, 0x27, // Display Function Control
|
|
||||||
0xF2, 1, 0x00, // 3Gamma Function Disable
|
|
||||||
ILI9341_GAMMASET , 1, 0x01, // Gamma curve selected
|
|
||||||
ILI9341_GMCTRP1 , 15, 0x0F, 0x31, 0x2B, 0x0C, 0x0E, 0x08, // Set Gamma
|
|
||||||
0x4E, 0xF1, 0x37, 0x07, 0x10, 0x03,
|
|
||||||
0x0E, 0x09, 0x00,
|
|
||||||
ILI9341_GMCTRN1 , 15, 0x00, 0x0E, 0x14, 0x03, 0x11, 0x07, // Set Gamma
|
|
||||||
0x31, 0xC1, 0x48, 0x08, 0x0F, 0x0C,
|
|
||||||
0x31, 0x36, 0x0F,
|
|
||||||
ILI9341_SLPOUT , 0x80, // Exit Sleep
|
|
||||||
ILI9341_DISPON , 0x80, // Display on
|
|
||||||
0x00 // End of list
|
|
||||||
};
|
|
||||||
|
|
||||||
static const uint8_t PROGMEM INITCMD_TFT[] = {
|
|
||||||
0xEF, 3, 0x03, 0x80, 0x02,
|
|
||||||
0xCF, 3, 0x00, 0xC1, 0x30,
|
|
||||||
0xED, 4, 0x64, 0x03, 0x12, 0x81,
|
|
||||||
0xE8, 3, 0x85, 0x00, 0x78,
|
|
||||||
0xCB, 5, 0x39, 0x2C, 0x00, 0x34, 0x02,
|
|
||||||
0xF7, 1, 0x20,
|
|
||||||
0xEA, 2, 0x00, 0x00,
|
|
||||||
ILI9341_PWCTR1 , 1, 0x23, // Power control VRH[5:0]
|
|
||||||
ILI9341_PWCTR2 , 1, 0x10, // Power control SAP[2:0];BT[3:0]
|
|
||||||
ILI9341_VMCTR1 , 2, 0x3e, 0x28, // VCM control
|
|
||||||
ILI9341_VMCTR2 , 1, 0x86, // VCM control2
|
|
||||||
ILI9341_MADCTL , 1, 0x48, // Memory Access Control
|
|
||||||
ILI9341_VSCRSADD, 1, 0x00, // Vertical scroll zero
|
|
||||||
ILI9341_PIXFMT , 1, 0x55,
|
|
||||||
ILI9341_FRMCTR1 , 2, 0x00, 0x18,
|
|
||||||
ILI9341_DFUNCTR , 3, 0x08, 0x82, 0x27, // Display Function Control
|
|
||||||
0xF2, 1, 0x00, // 3Gamma Function Disable
|
|
||||||
ILI9341_GAMMASET , 1, 0x01, // Gamma curve selected
|
|
||||||
ILI9341_GMCTRP1 , 15, 0x0F, 0x31, 0x2B, 0x0C, 0x0E, 0x08, // Set Gamma
|
|
||||||
0x4E, 0xF1, 0x37, 0x07, 0x10, 0x03,
|
|
||||||
0x0E, 0x09, 0x00,
|
|
||||||
ILI9341_GMCTRN1 , 15, 0x00, 0x0E, 0x14, 0x03, 0x11, 0x07, // Set Gamma
|
|
||||||
0x31, 0xC1, 0x48, 0x08, 0x0F, 0x0C,
|
|
||||||
0x31, 0x36, 0x0F,
|
|
||||||
ILI9341_SLPOUT , 0x80, // Exit Sleep
|
|
||||||
ILI9341_DISPON , 0x80, // Display on
|
|
||||||
0x00 // End of list
|
|
||||||
};
|
|
||||||
|
|
||||||
// clang-format on
|
|
||||||
} // namespace ili9341
|
|
||||||
} // namespace esphome
|
|
||||||
@@ -12,17 +12,9 @@ esphome:
|
|||||||
comment: ${comment}
|
comment: ${comment}
|
||||||
|
|
||||||
esp32:
|
esp32:
|
||||||
board: m5stack-atom
|
variant: esp32
|
||||||
# board: m5stamp-pico
|
|
||||||
framework:
|
framework:
|
||||||
type: esp-idf
|
type: esp-idf
|
||||||
version: 5.3.2
|
|
||||||
platform_version: 53.03.12
|
|
||||||
# version: 5.3.1
|
|
||||||
# platform_version: 6.9.0
|
|
||||||
|
|
||||||
# external_components:
|
|
||||||
# - source: components
|
|
||||||
|
|
||||||
packages:
|
packages:
|
||||||
common: !include common/common.yaml
|
common: !include common/common.yaml
|
||||||
|
|||||||
166
mcu-atoms3.yaml
166
mcu-atoms3.yaml
@@ -9,8 +9,6 @@ esphome:
|
|||||||
friendly_name: ${name}
|
friendly_name: ${name}
|
||||||
area: ${area}
|
area: ${area}
|
||||||
comment: ${comment}
|
comment: ${comment}
|
||||||
platformio_options:
|
|
||||||
board_build.flash_mode: dio
|
|
||||||
# on_boot:
|
# on_boot:
|
||||||
# - priority: 800
|
# - priority: 800
|
||||||
# then:
|
# then:
|
||||||
@@ -20,17 +18,13 @@ esphome:
|
|||||||
# id(display_tft).disable();
|
# id(display_tft).disable();
|
||||||
|
|
||||||
esp32:
|
esp32:
|
||||||
board: esp32-s3-devkitc-1
|
variant: esp32s3
|
||||||
# board: m5stack-atoms3
|
|
||||||
flash_size: 8MB
|
flash_size: 8MB
|
||||||
framework:
|
framework:
|
||||||
type: esp-idf
|
type: esp-idf
|
||||||
# version: dev
|
|
||||||
# version: 5.1.2
|
ota:
|
||||||
# platform_version: 6.6.0
|
- platform: web_server
|
||||||
version: 5.3.3
|
|
||||||
platform_version: 53.03.12
|
|
||||||
# type: arduino
|
|
||||||
|
|
||||||
pcf8574:
|
pcf8574:
|
||||||
- id: 'pcf8574_hub'
|
- id: 'pcf8574_hub'
|
||||||
@@ -55,16 +49,16 @@ web_server:
|
|||||||
port: 80
|
port: 80
|
||||||
version: 3
|
version: 3
|
||||||
|
|
||||||
light:
|
# light:
|
||||||
- platform: esp32_rmt_led_strip
|
# - platform: esp32_rmt_led_strip
|
||||||
name: LED
|
# name: LED
|
||||||
id: neo
|
# id: neo
|
||||||
rgb_order: GRB
|
# rgb_order: GRB
|
||||||
pin: 2
|
# pin: 2
|
||||||
num_leds: 1
|
# num_leds: 1
|
||||||
# rmt_channel: 0
|
# # rmt_channel: 0
|
||||||
chipset: ws2812
|
# chipset: ws2812
|
||||||
restore_mode: ALWAYS_OFF
|
# restore_mode: ALWAYS_OFF
|
||||||
|
|
||||||
text:
|
text:
|
||||||
- platform: template
|
- platform: template
|
||||||
@@ -179,10 +173,10 @@ i2c:
|
|||||||
# strong_pullup: false # enables a strong pullup used to provide the needed current for temperature reading without vcc connected
|
# strong_pullup: false # enables a strong pullup used to provide the needed current for temperature reading without vcc connected
|
||||||
# bus_sleep: true # power down the bus when no transaction is in progres
|
# bus_sleep: true # power down the bus when no transaction is in progres
|
||||||
|
|
||||||
one_wire:
|
# one_wire:
|
||||||
- platform: gpio
|
# - platform: gpio
|
||||||
pin: 1
|
# pin: 1
|
||||||
id: hub_1
|
# id: hub_1
|
||||||
# - platform: gpio
|
# - platform: gpio
|
||||||
# pin: 2
|
# pin: 2
|
||||||
# id: hub_2
|
# id: hub_2
|
||||||
@@ -205,7 +199,37 @@ m5stack_4relay:
|
|||||||
# wifi:
|
# wifi:
|
||||||
# use_address: 10.17.240.52
|
# use_address: 10.17.240.52
|
||||||
|
|
||||||
|
output:
|
||||||
|
- platform: gpio
|
||||||
|
id: motor_in1
|
||||||
|
pin: 1
|
||||||
|
- platform: gpio
|
||||||
|
id: motor_in2
|
||||||
|
pin: 2
|
||||||
|
|
||||||
|
|
||||||
switch:
|
switch:
|
||||||
|
- platform: template
|
||||||
|
name: "Motor Forward"
|
||||||
|
optimistic: true
|
||||||
|
turn_on_action:
|
||||||
|
- output.turn_on: motor_in1
|
||||||
|
- output.turn_off: motor_in2
|
||||||
|
turn_off_action:
|
||||||
|
- output.turn_off: motor_in1
|
||||||
|
- output.turn_off: motor_in2
|
||||||
|
|
||||||
|
- platform: template
|
||||||
|
name: "Motor Back"
|
||||||
|
optimistic: true
|
||||||
|
turn_on_action:
|
||||||
|
- output.turn_off: motor_in1
|
||||||
|
- output.turn_on: motor_in2
|
||||||
|
turn_off_action:
|
||||||
|
- output.turn_off: motor_in1
|
||||||
|
- output.turn_off: motor_in2
|
||||||
|
|
||||||
|
# switch:
|
||||||
- platform: m5stack_4relay
|
- platform: m5stack_4relay
|
||||||
name: Relay 1
|
name: Relay 1
|
||||||
id: relay_1
|
id: relay_1
|
||||||
@@ -221,7 +245,7 @@ switch:
|
|||||||
# interlock_wait_time: 1s
|
# interlock_wait_time: 1s
|
||||||
m5stack_4relay_id: m5stack_relay_1
|
m5stack_4relay_id: m5stack_relay_1
|
||||||
- platform: m5stack_4relay
|
- platform: m5stack_4relay
|
||||||
name: elay 3
|
name: Relay 3
|
||||||
id: relay_3
|
id: relay_3
|
||||||
channel: 3
|
channel: 3
|
||||||
# interlock: &interlock_group_2 [relay_3, relay_4]
|
# interlock: &interlock_group_2 [relay_3, relay_4]
|
||||||
@@ -391,34 +415,34 @@ display:
|
|||||||
# it.rectangle(0, 0, 128, 64);
|
# it.rectangle(0, 0, 128, 64);
|
||||||
|
|
||||||
sensor:
|
sensor:
|
||||||
- platform: sht3xd
|
# - platform: sht3xd
|
||||||
i2c_id: i2c_main
|
# i2c_id: i2c_main
|
||||||
address: 0x44
|
# address: 0x44
|
||||||
temperature:
|
# temperature:
|
||||||
name: TEST Temperature
|
# name: TEST Temperature
|
||||||
humidity:
|
# humidity:
|
||||||
name: TEST Humidity
|
# name: TEST Humidity
|
||||||
update_interval: 10s
|
# update_interval: 10s
|
||||||
- platform: mpu6886
|
# - platform: mpu6886
|
||||||
address: 0x68
|
# address: 0x68
|
||||||
i2c_id: i2c_main
|
# i2c_id: i2c_main
|
||||||
# accel_x:
|
# # accel_x:
|
||||||
# name: "${name} MPU6886 Accel X"
|
# # name: "${name} MPU6886 Accel X"
|
||||||
# accel_y:
|
# # accel_y:
|
||||||
# name: "${name} MPU6886 Accel Y"
|
# # name: "${name} MPU6886 Accel Y"
|
||||||
# accel_z:
|
# # accel_z:
|
||||||
# name: "${name} MPU6886 Accel z"
|
# # name: "${name} MPU6886 Accel z"
|
||||||
# gyro_x:
|
# # gyro_x:
|
||||||
# name: "${name} MPU6886 Gyro X"
|
# # name: "${name} MPU6886 Gyro X"
|
||||||
# gyro_y:
|
# # gyro_y:
|
||||||
# name: "${name} MPU6886 Gyro Y"
|
# # name: "${name} MPU6886 Gyro Y"
|
||||||
# gyro_z:
|
# # gyro_z:
|
||||||
# name: "${name} MPU6886 Gyro z"
|
# # name: "${name} MPU6886 Gyro z"
|
||||||
temperature:
|
# temperature:
|
||||||
name: Temperature
|
# name: Temperature
|
||||||
id: blabla
|
# id: blabla
|
||||||
- platform: homeassistant
|
- platform: homeassistant
|
||||||
id: test_humidity
|
id: test_humidity_ha
|
||||||
entity_id: sensor.humidity_158d0001c2a1d1
|
entity_id: sensor.humidity_158d0001c2a1d1
|
||||||
# - platform: ds248x
|
# - platform: ds248x
|
||||||
# address: 0x8b0516b39804ff28
|
# address: 0x8b0516b39804ff28
|
||||||
@@ -436,25 +460,25 @@ sensor:
|
|||||||
# address: 0x810516b3c69fff28
|
# address: 0x810516b3c69fff28
|
||||||
# name: "${name} Dallas Temp 4"
|
# name: "${name} Dallas Temp 4"
|
||||||
# resolution: 12
|
# resolution: 12
|
||||||
- platform: dallas_temp
|
# - platform: dallas_temp
|
||||||
address: 0xdb041750eae2ff28
|
# address: 0xdb041750eae2ff28
|
||||||
name: Dallas Temp 1
|
# name: Dallas Temp 1
|
||||||
one_wire_id: hub_1
|
# one_wire_id: hub_1
|
||||||
update_interval: 10s
|
# update_interval: 10s
|
||||||
- platform: dallas_temp
|
# - platform: dallas_temp
|
||||||
address: 0xb2041750cf1aff28
|
# address: 0xb2041750cf1aff28
|
||||||
name: Dallas Temp 2
|
# name: Dallas Temp 2
|
||||||
one_wire_id: hub_1
|
# one_wire_id: hub_1
|
||||||
update_interval: 30s
|
# update_interval: 30s
|
||||||
- platform: dallas_temp
|
# - platform: dallas_temp
|
||||||
address: 0xcd01191eb8b07128
|
# address: 0xcd01191eb8b07128
|
||||||
name: Dallas Temp 3
|
# name: Dallas Temp 3
|
||||||
one_wire_id: hub_1
|
# one_wire_id: hub_1
|
||||||
update_interval: 45s
|
# update_interval: 45s
|
||||||
- platform: dallas_temp
|
# - platform: dallas_temp
|
||||||
address: 0x5a01191ef3375b28
|
# address: 0x5a01191ef3375b28
|
||||||
name: Dallas Temp 4
|
# name: Dallas Temp 4
|
||||||
one_wire_id: hub_1
|
# one_wire_id: hub_1
|
||||||
|
|
||||||
time:
|
time:
|
||||||
- !include common/time/homeassistant.yaml
|
- !include common/time/homeassistant.yaml
|
||||||
|
|||||||
@@ -12,11 +12,9 @@ esphome:
|
|||||||
comment: ${comment}
|
comment: ${comment}
|
||||||
|
|
||||||
esp32:
|
esp32:
|
||||||
board: esp32doit-devkit-v1
|
variant: esp32
|
||||||
framework:
|
framework:
|
||||||
type: esp-idf
|
type: esp-idf
|
||||||
version: 5.3.2
|
|
||||||
platform_version: 53.03.11
|
|
||||||
sdkconfig_options:
|
sdkconfig_options:
|
||||||
CONFIG_FREERTOS_UNICORE: y
|
CONFIG_FREERTOS_UNICORE: y
|
||||||
advanced:
|
advanced:
|
||||||
|
|||||||
@@ -12,11 +12,9 @@ esphome:
|
|||||||
comment: ${comment}
|
comment: ${comment}
|
||||||
|
|
||||||
esp32:
|
esp32:
|
||||||
board: esp32doit-devkit-v1
|
variant: esp32
|
||||||
framework:
|
framework:
|
||||||
type: esp-idf
|
type: esp-idf
|
||||||
version: 5.3.2
|
|
||||||
platform_version: 53.03.11
|
|
||||||
sdkconfig_options:
|
sdkconfig_options:
|
||||||
CONFIG_FREERTOS_UNICORE: y
|
CONFIG_FREERTOS_UNICORE: y
|
||||||
advanced:
|
advanced:
|
||||||
|
|||||||
@@ -36,13 +36,12 @@ esphome:
|
|||||||
}
|
}
|
||||||
|
|
||||||
esp32:
|
esp32:
|
||||||
board: esp32-c6-devkitc-1
|
|
||||||
variant: esp32c6
|
variant: esp32c6
|
||||||
flash_size: 16MB
|
flash_size: 16MB
|
||||||
framework:
|
framework:
|
||||||
type: esp-idf
|
type: esp-idf
|
||||||
version: 5.3.2
|
# version: 5.4.2
|
||||||
platform_version: 53.03.11
|
# platform_version: 54.03.21
|
||||||
|
|
||||||
logger:
|
logger:
|
||||||
hardware_uart: USB_SERIAL_JTAG
|
hardware_uart: USB_SERIAL_JTAG
|
||||||
|
|||||||
@@ -36,13 +36,12 @@ esphome:
|
|||||||
}
|
}
|
||||||
|
|
||||||
esp32:
|
esp32:
|
||||||
board: esp32-c6-devkitc-1
|
|
||||||
variant: esp32c6
|
variant: esp32c6
|
||||||
flash_size: 16MB
|
flash_size: 16MB
|
||||||
framework:
|
framework:
|
||||||
type: esp-idf
|
type: esp-idf
|
||||||
version: 5.3.2
|
# version: 5.4.2
|
||||||
platform_version: 53.03.11
|
# platform_version: 54.03.21
|
||||||
|
|
||||||
logger:
|
logger:
|
||||||
hardware_uart: USB_SERIAL_JTAG
|
hardware_uart: USB_SERIAL_JTAG
|
||||||
|
|||||||
@@ -11,30 +11,30 @@ esphome:
|
|||||||
comment: ${comment}
|
comment: ${comment}
|
||||||
|
|
||||||
esp32:
|
esp32:
|
||||||
board: esp32cam
|
# board: esp32cam
|
||||||
|
variant: esp32
|
||||||
framework:
|
framework:
|
||||||
# type: arduino
|
|
||||||
type: esp-idf
|
type: esp-idf
|
||||||
# version: 2.0.14
|
|
||||||
# platform_version: 6.5.0
|
|
||||||
|
|
||||||
packages:
|
packages:
|
||||||
common: !include common/common.yaml
|
common: !include common/common.yaml
|
||||||
|
|
||||||
# external_components:
|
i2c:
|
||||||
# - source:
|
id: i2c_bus
|
||||||
# type: git
|
sda: 26
|
||||||
# url: https://github.com/MichaKersloot/esphome_custom_components
|
scl: 27
|
||||||
# components: [ esp32_camera ]
|
scan: true
|
||||||
|
|
||||||
|
psram:
|
||||||
|
mode: quad
|
||||||
|
speed: 40MHz
|
||||||
|
|
||||||
esp32_camera:
|
esp32_camera:
|
||||||
name: Camera
|
name: Camera
|
||||||
external_clock:
|
external_clock:
|
||||||
pin: 0
|
pin: 0
|
||||||
frequency: 20MHz
|
frequency: 20MHz
|
||||||
i2c_pins:
|
i2c_id: i2c_bus
|
||||||
sda: 26
|
|
||||||
scl: 27
|
|
||||||
data_pins: [5, 18, 19, 21, 36, 39, 34, 35]
|
data_pins: [5, 18, 19, 21, 36, 39, 34, 35]
|
||||||
vsync_pin: 25
|
vsync_pin: 25
|
||||||
href_pin: 23
|
href_pin: 23
|
||||||
@@ -44,7 +44,7 @@ esp32_camera:
|
|||||||
switch:
|
switch:
|
||||||
- platform: gpio
|
- platform: gpio
|
||||||
pin: 32
|
pin: 32
|
||||||
# restore_mode: ALWAYS_ON
|
restore_mode: ALWAYS_ON
|
||||||
# id: "cam_power_down"
|
# id: "cam_power_down"
|
||||||
name: Enable
|
name: Enable
|
||||||
|
|
||||||
|
|||||||
@@ -11,11 +11,11 @@ esphome:
|
|||||||
comment: ${comment}
|
comment: ${comment}
|
||||||
|
|
||||||
esp32:
|
esp32:
|
||||||
board: esp32dev
|
variant: esp32
|
||||||
framework:
|
framework:
|
||||||
type: esp-idf
|
type: esp-idf
|
||||||
# version: 5.3.2
|
# version: 5.4.2
|
||||||
# platform_version: 53.03.11
|
# platform_version: 54.03.21
|
||||||
|
|
||||||
external_components:
|
external_components:
|
||||||
- source: github://mrk-its/esphome-canopen@dev
|
- source: github://mrk-its/esphome-canopen@dev
|
||||||
|
|||||||
@@ -11,11 +11,11 @@ esphome:
|
|||||||
comment: ${comment}
|
comment: ${comment}
|
||||||
|
|
||||||
esp32:
|
esp32:
|
||||||
board: esp32dev
|
variant: esp32
|
||||||
framework:
|
framework:
|
||||||
type: esp-idf
|
type: esp-idf
|
||||||
# version: 5.3.2
|
version: 5.4.2
|
||||||
# platform_version: 53.03.11
|
platform_version: 54.03.21
|
||||||
|
|
||||||
external_components:
|
external_components:
|
||||||
- source: github://mrk-its/esphome-canopen@dev
|
- source: github://mrk-its/esphome-canopen@dev
|
||||||
|
|||||||
@@ -11,19 +11,19 @@ esphome:
|
|||||||
comment: ${comment}
|
comment: ${comment}
|
||||||
|
|
||||||
esp32:
|
esp32:
|
||||||
board: m5stack-atom
|
variant: esp32
|
||||||
framework:
|
framework:
|
||||||
# type: arduino
|
|
||||||
type: esp-idf
|
type: esp-idf
|
||||||
version: 5.3.2
|
|
||||||
platform_version: 53.03.11
|
|
||||||
|
|
||||||
external_components:
|
external_components:
|
||||||
# - source: github://pr#3017
|
# - source: github://pr#3017
|
||||||
# components: [hdmi_cec]
|
# components: [hdmi_cec]
|
||||||
# refresh: 1h
|
# refresh: 1h
|
||||||
- source: github://Palakis/esphome-hdmi-cec
|
# - source: github://Palakis/esphome-hdmi-cec
|
||||||
refresh: 1h
|
# refresh: 1h
|
||||||
|
- source: github://pr#9189
|
||||||
|
components: [hdmi_cec]
|
||||||
|
refresh: 0min
|
||||||
packages:
|
packages:
|
||||||
common: !include common/common.yaml
|
common: !include common/common.yaml
|
||||||
|
|
||||||
@@ -131,6 +131,9 @@ hdmi_cec:
|
|||||||
physical_address: 0x4000
|
physical_address: 0x4000
|
||||||
pin: 26
|
pin: 26
|
||||||
on_message:
|
on_message:
|
||||||
|
- opcode: 0x36 # opcode for "Standby"
|
||||||
|
then:
|
||||||
|
logger.log: "Got Standby command"
|
||||||
- opcode: 0xC3 # Request ARC start
|
- opcode: 0xC3 # Request ARC start
|
||||||
then:
|
then:
|
||||||
- hdmi_cec.send: # Report ARC started
|
- hdmi_cec.send: # Report ARC started
|
||||||
|
|||||||
@@ -13,12 +13,11 @@ esphome:
|
|||||||
board_build.flash_mode: dio
|
board_build.flash_mode: dio
|
||||||
|
|
||||||
esp32:
|
esp32:
|
||||||
board: esp32-c3-devkitm-1
|
|
||||||
variant: esp32c3
|
variant: esp32c3
|
||||||
framework:
|
framework:
|
||||||
type: esp-idf
|
type: esp-idf
|
||||||
version: 5.3.3
|
# version: 5.4.2
|
||||||
platform_version: 53.03.12
|
# platform_version: 54.03.21
|
||||||
|
|
||||||
packages:
|
packages:
|
||||||
common: !include common/common.yaml
|
common: !include common/common.yaml
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
substitutions:
|
substitutions:
|
||||||
device: clock-living-room
|
device: clock-living-room
|
||||||
name: Living room Clock
|
name: Living room Clock
|
||||||
area: Living Room / Kitchen
|
area: Living Room & Kitchen
|
||||||
comment: "${area}: TV Rack Clock"
|
comment: "${area}: TV Rack Clock"
|
||||||
|
|
||||||
esphome:
|
esphome:
|
||||||
@@ -11,11 +11,9 @@ esphome:
|
|||||||
comment: ${comment}
|
comment: ${comment}
|
||||||
|
|
||||||
esp32:
|
esp32:
|
||||||
board: m5stack-atom
|
variant: esp32
|
||||||
framework:
|
framework:
|
||||||
type: esp-idf
|
type: esp-idf
|
||||||
# version: 5.3.2
|
|
||||||
# platform_version: 53.03.12
|
|
||||||
|
|
||||||
external_components:
|
external_components:
|
||||||
- source:
|
- source:
|
||||||
|
|||||||
@@ -11,17 +11,9 @@ esphome:
|
|||||||
comment: ${comment}
|
comment: ${comment}
|
||||||
|
|
||||||
esp32:
|
esp32:
|
||||||
board: m5stack-atom
|
variant: esp32
|
||||||
framework:
|
framework:
|
||||||
type: esp-idf
|
type: esp-idf
|
||||||
version: 5.3.2
|
|
||||||
platform_version: 53.03.11
|
|
||||||
|
|
||||||
# external_components:
|
|
||||||
# - source: github://pr#7958
|
|
||||||
# refresh: 0s
|
|
||||||
# components:
|
|
||||||
# - rotary_encoder
|
|
||||||
|
|
||||||
packages:
|
packages:
|
||||||
common: !include common/common.yaml
|
common: !include common/common.yaml
|
||||||
|
|||||||
@@ -31,24 +31,97 @@ esphome:
|
|||||||
}
|
}
|
||||||
|
|
||||||
esp32:
|
esp32:
|
||||||
board: m5stack-atom
|
variant: esp32
|
||||||
framework:
|
framework:
|
||||||
type: esp-idf
|
type: esp-idf
|
||||||
version: 5.3.2
|
|
||||||
platform_version: 53.03.12
|
|
||||||
|
|
||||||
external_components:
|
|
||||||
- source: github://pr#7072
|
|
||||||
components: ac_dimmer
|
|
||||||
refresh: 0s
|
|
||||||
- source: components
|
|
||||||
|
|
||||||
packages:
|
packages:
|
||||||
common: !include common/common.yaml
|
common: !include common/common.yaml
|
||||||
|
|
||||||
|
# fan:
|
||||||
|
# - platform: speed
|
||||||
|
# output: fan_dimmer1
|
||||||
|
# id: fan1
|
||||||
|
# name: Exercise Room
|
||||||
|
# speed_count: 5
|
||||||
|
# preset_modes:
|
||||||
|
# - 50%
|
||||||
|
# - 60%
|
||||||
|
# - 70%
|
||||||
|
# - 80%
|
||||||
|
# - 90%
|
||||||
|
# - 100%
|
||||||
|
# on_preset_set:
|
||||||
|
# then:
|
||||||
|
# - fan.turn_on:
|
||||||
|
# id: fan1
|
||||||
|
# speed: !lambda |-
|
||||||
|
# return x.c_str();
|
||||||
|
# # default_transition_length: 10s
|
||||||
|
|
||||||
|
button:
|
||||||
|
- platform: template
|
||||||
|
name: Exercise Room Fan 50 %
|
||||||
|
on_press:
|
||||||
|
then:
|
||||||
|
- output.set_level:
|
||||||
|
id: dimmer1
|
||||||
|
level: 50%
|
||||||
|
- platform: template
|
||||||
|
name: Exercise Room Fan 60 %
|
||||||
|
on_press:
|
||||||
|
then:
|
||||||
|
- output.set_level:
|
||||||
|
id: dimmer1
|
||||||
|
level: 60%
|
||||||
|
- platform: template
|
||||||
|
name: Exercise Room Fan 70 %
|
||||||
|
on_press:
|
||||||
|
then:
|
||||||
|
- output.set_level:
|
||||||
|
id: dimmer1
|
||||||
|
level: 70%
|
||||||
|
- platform: template
|
||||||
|
name: Exercise Room Fan 80 %
|
||||||
|
on_press:
|
||||||
|
then:
|
||||||
|
- output.set_level:
|
||||||
|
id: dimmer1
|
||||||
|
level: 80%
|
||||||
|
- platform: template
|
||||||
|
name: Exercise Room Fan 90 %
|
||||||
|
on_press:
|
||||||
|
then:
|
||||||
|
- output.set_level:
|
||||||
|
id: dimmer1
|
||||||
|
level: 90%
|
||||||
|
- platform: template
|
||||||
|
name: Exercise Room Fan 100 %
|
||||||
|
on_press:
|
||||||
|
then:
|
||||||
|
- output.set_level:
|
||||||
|
id: dimmer1
|
||||||
|
level: 100%
|
||||||
|
- platform: template
|
||||||
|
name: Exercise Room Fan +10 %
|
||||||
|
on_press:
|
||||||
|
then:
|
||||||
|
- light.dim_relative:
|
||||||
|
id: fan_dimmer1
|
||||||
|
relative_brightness: 10%
|
||||||
|
- platform: template
|
||||||
|
name: Exercise Room Fan -10 %
|
||||||
|
on_press:
|
||||||
|
then:
|
||||||
|
- light.dim_relative:
|
||||||
|
id: fan_dimmer1
|
||||||
|
relative_brightness: -10%
|
||||||
|
|
||||||
light:
|
light:
|
||||||
- platform: monochromatic
|
- platform: monochromatic
|
||||||
output: dimmer1
|
output: dimmer1
|
||||||
|
id: fan_dimmer1
|
||||||
name: Exercise Room Fan
|
name: Exercise Room Fan
|
||||||
default_transition_length: 10s
|
default_transition_length: 10s
|
||||||
- platform: esp32_rmt_led_strip
|
- platform: esp32_rmt_led_strip
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ esphome:
|
|||||||
comment: ${comment}
|
comment: ${comment}
|
||||||
|
|
||||||
esp32:
|
esp32:
|
||||||
board: m5stack-atom
|
variant: esp32
|
||||||
framework:
|
framework:
|
||||||
type: arduino
|
type: arduino
|
||||||
# version: 2.0.14
|
# version: 2.0.14
|
||||||
@@ -83,7 +83,6 @@ light:
|
|||||||
rgb_order: GRB
|
rgb_order: GRB
|
||||||
pin: 27
|
pin: 27
|
||||||
num_leds: 1
|
num_leds: 1
|
||||||
rmt_channel: 0
|
|
||||||
chipset: ws2812
|
chipset: ws2812
|
||||||
|
|
||||||
# output:
|
# output:
|
||||||
|
|||||||
121
mcu-echo.yaml
121
mcu-echo.yaml
@@ -12,34 +12,22 @@ esphome:
|
|||||||
comment: ${comment}
|
comment: ${comment}
|
||||||
|
|
||||||
esp32:
|
esp32:
|
||||||
board: m5stack-atom
|
variant: esp32
|
||||||
framework:
|
framework:
|
||||||
# type: arduino
|
|
||||||
type: esp-idf
|
type: esp-idf
|
||||||
version: 5.3.2
|
|
||||||
platform_version: 53.03.11
|
|
||||||
|
|
||||||
external_components:
|
|
||||||
- source: components
|
|
||||||
# - source:
|
|
||||||
# type: git
|
|
||||||
# url: https://github.com/gnumpi/esphome_audio
|
|
||||||
# ref: dev-next
|
|
||||||
# components: [ adf_pipeline, i2s_audio ]
|
|
||||||
# refresh: 0s
|
|
||||||
|
|
||||||
packages:
|
packages:
|
||||||
common: !include common/common_esp8266.yaml
|
common: !include common/common.yaml
|
||||||
|
|
||||||
# api:
|
api:
|
||||||
# services:
|
services:
|
||||||
# # https://github.com/granadaxronos/120-SONG_NOKIA_RTTTL_RINGTONE_PLAYER_FOR_ARDUINO_UNO/blob/master/RTTTL_PLAYER/songs.h
|
# https://github.com/granadaxronos/120-SONG_NOKIA_RTTTL_RINGTONE_PLAYER_FOR_ARDUINO_UNO/blob/master/RTTTL_PLAYER/songs.h
|
||||||
# - service: play_rtttl
|
- service: play_rtttl
|
||||||
# variables:
|
variables:
|
||||||
# song: string
|
song: string
|
||||||
# then:
|
then:
|
||||||
# - rtttl.play:
|
- rtttl.play:
|
||||||
# rtttl: !lambda 'return song;'
|
rtttl: !lambda 'return song;'
|
||||||
|
|
||||||
i2c:
|
i2c:
|
||||||
sda: 26
|
sda: 26
|
||||||
@@ -101,19 +89,24 @@ output:
|
|||||||
allow_other_uses: true
|
allow_other_uses: true
|
||||||
|
|
||||||
i2s_audio:
|
i2s_audio:
|
||||||
|
- id: speaker_bus
|
||||||
i2s_lrclk_pin: 33
|
i2s_lrclk_pin: 33
|
||||||
i2s_bclk_pin: 19
|
i2s_bclk_pin: 19
|
||||||
|
|
||||||
speaker:
|
speaker:
|
||||||
- platform: i2s_audio
|
- platform: i2s_audio
|
||||||
id: speaker_id
|
id: speaker_id
|
||||||
|
i2s_audio_id: speaker_bus
|
||||||
dac_type: external
|
dac_type: external
|
||||||
i2s_dout_pin: 22
|
i2s_dout_pin: 22
|
||||||
channel: mono
|
channel: mono
|
||||||
sample_rate: 48000
|
sample_rate: 48000
|
||||||
|
buffer_duration: 100ms # Smaller buffer
|
||||||
- platform: mixer
|
- platform: mixer
|
||||||
id: mixer_speaker_id
|
id: mixer_speaker_id
|
||||||
output_speaker: speaker_id
|
output_speaker: speaker_id
|
||||||
|
num_channels: 1
|
||||||
|
task_stack_in_psram: false
|
||||||
source_speakers:
|
source_speakers:
|
||||||
- id: announcement_spk_mixer_input
|
- id: announcement_spk_mixer_input
|
||||||
- id: media_spk_mixer_input
|
- id: media_spk_mixer_input
|
||||||
@@ -132,10 +125,17 @@ media_player:
|
|||||||
- platform: speaker
|
- platform: speaker
|
||||||
id: media_out
|
id: media_out
|
||||||
name: Player
|
name: Player
|
||||||
|
codec_support_enabled: false
|
||||||
media_pipeline:
|
media_pipeline:
|
||||||
speaker: media_spk_resampling_input
|
speaker: media_spk_resampling_input
|
||||||
|
# format: WAV
|
||||||
|
# num_channels: 1
|
||||||
|
# sample_rate: 8000 # Lower sample rate
|
||||||
announcement_pipeline:
|
announcement_pipeline:
|
||||||
speaker: announcement_spk_resampling_input
|
speaker: announcement_spk_resampling_input
|
||||||
|
# format: WAV
|
||||||
|
# num_channels: 1
|
||||||
|
# sample_rate: 8000 # Lower sample rate
|
||||||
on_play:
|
on_play:
|
||||||
- light.turn_on: led_light
|
- light.turn_on: led_light
|
||||||
on_idle:
|
on_idle:
|
||||||
@@ -145,6 +145,81 @@ rtttl:
|
|||||||
id: my_rtttl
|
id: my_rtttl
|
||||||
speaker: rtttl_spk_resampling_input
|
speaker: rtttl_spk_resampling_input
|
||||||
|
|
||||||
|
button:
|
||||||
|
- platform: template
|
||||||
|
name: "Jump Sound"
|
||||||
|
on_press:
|
||||||
|
- if:
|
||||||
|
condition:
|
||||||
|
lambda: return !id(speaker_id)->is_running();
|
||||||
|
then:
|
||||||
|
- lambda: id(speaker_id)->start();
|
||||||
|
- delay: 50ms
|
||||||
|
- lambda: |-
|
||||||
|
static std::vector<int16_t> buffer;
|
||||||
|
const int duration_ms = 300;
|
||||||
|
const int samples = (16000 * duration_ms) / 1000;
|
||||||
|
buffer.resize(samples);
|
||||||
|
for (int i = 0; i < samples; i++) {
|
||||||
|
float progress = i / (float)samples;
|
||||||
|
float bounce = sin(progress * M_PI * 3) * 0.3;
|
||||||
|
float pitch_freq = 400 + (600 * progress) + (bounce * 200);
|
||||||
|
float envelope = exp(-progress * 4);
|
||||||
|
float phase = (i * pitch_freq * 2 * M_PI) / 16000;
|
||||||
|
buffer[i] = (int16_t)(1024 * sin(phase) * envelope);
|
||||||
|
}
|
||||||
|
id(speaker_id)->play((uint8_t*)buffer.data(), buffer.size() * 2);
|
||||||
|
id(speaker_id)->finish();
|
||||||
|
- platform: template
|
||||||
|
name: "Coin Sound"
|
||||||
|
on_press:
|
||||||
|
- if:
|
||||||
|
condition:
|
||||||
|
lambda: return !id(speaker_id)->is_running();
|
||||||
|
then:
|
||||||
|
- lambda: id(speaker_id)->start();
|
||||||
|
- delay: 50ms
|
||||||
|
- lambda: |-
|
||||||
|
static std::vector<int16_t> buffer;
|
||||||
|
const int duration_ms = 100;
|
||||||
|
const int samples = (16000 * duration_ms) / 1000;
|
||||||
|
buffer.resize(samples);
|
||||||
|
float phase = 0;
|
||||||
|
for (int i = 0; i < samples; i++) {
|
||||||
|
float progress = i / (float)samples;
|
||||||
|
float freq = (progress < 0.5) ? 988 : 1319;
|
||||||
|
float envelope = 1.0 - (progress * 0.7);
|
||||||
|
phase += (freq * 2 * M_PI) / 16000;
|
||||||
|
float square = (sin(phase) > 0) ? 1.0 : -1.0;
|
||||||
|
buffer[i] = (int16_t)(2048 * square * envelope);
|
||||||
|
}
|
||||||
|
id(speaker_id)->play((uint8_t*)buffer.data(), buffer.size() * 2);
|
||||||
|
id(speaker_id)->finish();
|
||||||
|
- platform: template
|
||||||
|
name: "Fireball Sound"
|
||||||
|
on_press:
|
||||||
|
- if:
|
||||||
|
condition:
|
||||||
|
lambda: return !id(speaker_id)->is_running();
|
||||||
|
then:
|
||||||
|
- lambda: id(speaker_id)->start();
|
||||||
|
- delay: 50ms
|
||||||
|
- lambda: |-
|
||||||
|
static std::vector<int16_t> buffer;
|
||||||
|
const int duration_ms = 300;
|
||||||
|
const int samples = (16000 * duration_ms) / 1000;
|
||||||
|
buffer.resize(samples);
|
||||||
|
for (int i = 0; i < samples; i++) {
|
||||||
|
float progress = i / (float)samples;
|
||||||
|
float pitch_freq = 800 * exp(-progress * 3);
|
||||||
|
float noise = (rand() % 100) / 100.0 * 0.3;
|
||||||
|
float envelope = exp(-progress * 2);
|
||||||
|
float phase = (i * pitch_freq * 2 * M_PI) / 16000;
|
||||||
|
buffer[i] = (int16_t)(1024 * (sin(phase) * 0.7 + noise) * envelope);
|
||||||
|
}
|
||||||
|
id(speaker_id)->play((uint8_t*)buffer.data(), buffer.size() * 2);
|
||||||
|
id(speaker_id)->finish();
|
||||||
|
|
||||||
# microphone:
|
# microphone:
|
||||||
# - platform: i2s_audio
|
# - platform: i2s_audio
|
||||||
# i2s_din_pin: 23
|
# i2s_din_pin: 23
|
||||||
|
|||||||
@@ -11,12 +11,9 @@ esphome:
|
|||||||
board_build.flash_mode: dio
|
board_build.flash_mode: dio
|
||||||
|
|
||||||
esp32:
|
esp32:
|
||||||
board: esp32-c3-devkitm-1
|
|
||||||
variant: esp32c3
|
variant: esp32c3
|
||||||
framework:
|
framework:
|
||||||
type: esp-idf
|
type: esp-idf
|
||||||
version: 5.3.2
|
|
||||||
platform_version: 53.03.11
|
|
||||||
|
|
||||||
packages:
|
packages:
|
||||||
common: !include common/common.yaml
|
common: !include common/common.yaml
|
||||||
@@ -142,7 +139,7 @@ binary_sensor:
|
|||||||
mode: INPUT
|
mode: INPUT
|
||||||
inverted: false
|
inverted: false
|
||||||
- platform: gpio
|
- platform: gpio
|
||||||
name: "PCF8574 Pin #15"
|
name: "PCF8574 Pin #16"
|
||||||
pin:
|
pin:
|
||||||
pcf8574: pcf8574_hub
|
pcf8574: pcf8574_hub
|
||||||
number: 14
|
number: 14
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
substitutions:
|
substitutions:
|
||||||
device: fireplace
|
device: fireplace
|
||||||
name: Heating Fireplace
|
name: Heating Fireplace
|
||||||
area: Living Room / Kitchen
|
area: Living Room & Kitchen
|
||||||
comment: "${area}, Fireplace | Fireplace monitoring for heating"
|
comment: "${area}, Fireplace | Fireplace monitoring for heating"
|
||||||
|
|
||||||
esphome:
|
esphome:
|
||||||
@@ -11,15 +11,17 @@ esphome:
|
|||||||
comment: ${comment}
|
comment: ${comment}
|
||||||
|
|
||||||
esp32:
|
esp32:
|
||||||
board: m5stack-atom
|
variant: esp32
|
||||||
framework:
|
framework:
|
||||||
type: esp-idf
|
type: esp-idf
|
||||||
version: 5.3.2
|
|
||||||
platform_version: 53.03.11
|
|
||||||
|
|
||||||
external_components:
|
external_components:
|
||||||
- source: github://mknjc/esphome@ds248x
|
# - source: github://pr#12717
|
||||||
components: ds248x
|
# components: [ds248x]
|
||||||
|
# refresh: 1h
|
||||||
|
- source: github://pr#13534
|
||||||
|
components: [ds2482, ds2484, ds248x_base]
|
||||||
|
refresh: 1h
|
||||||
|
|
||||||
packages:
|
packages:
|
||||||
common: !include common/common.yaml
|
common: !include common/common.yaml
|
||||||
@@ -55,13 +57,32 @@ i2c:
|
|||||||
scl: 21
|
scl: 21
|
||||||
scan: true #false
|
scan: true #false
|
||||||
|
|
||||||
ds248x:
|
# ds248x:
|
||||||
# i2c_id: i2c_main
|
# # i2c_id: i2c_main
|
||||||
address: 0x18 # should be the default
|
# address: 0x18 # should be the default
|
||||||
# sleep_pin: 32 # remove if not needed, if set the ds248x sleeps when no transaction is in progress
|
# # sleep_pin: 32 # remove if not needed, if set the ds248x sleeps when no transaction is in progress
|
||||||
active_pullup: true # adds a active pullup which should improve signal integrity
|
# active_pullup: true # adds a active pullup which should improve signal integrity
|
||||||
strong_pullup: false # enables a strong pullup used to provide the needed current for temperature reading without vcc connected
|
# strong_pullup: false # enables a strong pullup used to provide the needed current for temperature reading without vcc connected
|
||||||
bus_sleep: true # power down the bus when no transaction is in progres
|
# bus_sleep: true # power down the bus when no transaction is in progres
|
||||||
|
|
||||||
|
# one_wire:
|
||||||
|
# id: one_wire_bus
|
||||||
|
# platform: ds2484
|
||||||
|
# active_pullup: true
|
||||||
|
|
||||||
|
# ds248x:
|
||||||
|
# id: ds2484_module
|
||||||
|
# address: 0x18
|
||||||
|
|
||||||
|
# one_wire:
|
||||||
|
# - platform: ds248x
|
||||||
|
# ds248x_id: ds2484_module
|
||||||
|
# id: one_wire_bus
|
||||||
|
|
||||||
|
one_wire:
|
||||||
|
id: one_wire_bus
|
||||||
|
platform: ds2482
|
||||||
|
active_pullup: true
|
||||||
|
|
||||||
pca9554:
|
pca9554:
|
||||||
- id: pca9554_module
|
- id: pca9554_module
|
||||||
@@ -102,7 +123,8 @@ binary_sensor:
|
|||||||
- delayed_off: 300ms
|
- delayed_off: 300ms
|
||||||
|
|
||||||
sensor:
|
sensor:
|
||||||
- platform: ds248x
|
# - platform: ds248x
|
||||||
|
- platform: dallas_temp
|
||||||
address: 0x6203168B32A7FF28
|
address: 0x6203168B32A7FF28
|
||||||
# index: 0
|
# index: 0
|
||||||
name: Temperature
|
name: Temperature
|
||||||
@@ -117,3 +139,6 @@ sensor:
|
|||||||
# id: 'kitchen_humidity'
|
# id: 'kitchen_humidity'
|
||||||
# update_interval: 60s
|
# update_interval: 60s
|
||||||
# model: si7021
|
# model: si7021
|
||||||
|
|
||||||
|
bluetooth_proxy:
|
||||||
|
active: true
|
||||||
|
|||||||
@@ -11,14 +11,9 @@ esphome:
|
|||||||
comment: ${comment}
|
comment: ${comment}
|
||||||
|
|
||||||
esp32:
|
esp32:
|
||||||
board: m5stack-atom
|
variant: esp32
|
||||||
framework:
|
framework:
|
||||||
type: esp-idf
|
type: esp-idf
|
||||||
version: 5.3.2
|
|
||||||
platform_version: 53.03.11
|
|
||||||
|
|
||||||
external_components:
|
|
||||||
- source: components
|
|
||||||
|
|
||||||
packages:
|
packages:
|
||||||
common: !include common/common.yaml
|
common: !include common/common.yaml
|
||||||
|
|||||||
@@ -11,28 +11,18 @@ esphome:
|
|||||||
comment: ${comment}
|
comment: ${comment}
|
||||||
|
|
||||||
esp32:
|
esp32:
|
||||||
board: esp32doit-devkit-v1
|
variant: esp32
|
||||||
framework:
|
framework:
|
||||||
version: 5.3.2
|
|
||||||
platform_version: 53.03.11
|
|
||||||
type: esp-idf
|
type: esp-idf
|
||||||
|
|
||||||
external_components:
|
external_components:
|
||||||
- source: github://pr#8457
|
# Ethernet LLDP 802.1AB transmitter
|
||||||
components: ethernet
|
- source: github://pr#11760
|
||||||
# - source: github://pr#4080
|
components: [ethernet]
|
||||||
# components: [lcd_pcf8574, lcd_base]
|
refresh: 1h
|
||||||
# - source: github://pr#3564
|
- source: github://pr#2112
|
||||||
# refresh: 0s
|
components: ["m5stack_4relay"]
|
||||||
# components:
|
refresh: 1h
|
||||||
# - esp32
|
|
||||||
# - ethernet_info
|
|
||||||
# - ethernet
|
|
||||||
# # - wifi
|
|
||||||
# - source: github://pr#2112
|
|
||||||
# components: ["m5stack_4relay"]
|
|
||||||
# refresh: 1h
|
|
||||||
# - source: components
|
|
||||||
|
|
||||||
packages:
|
packages:
|
||||||
# common: !include common/common.yaml
|
# common: !include common/common.yaml
|
||||||
@@ -59,6 +49,23 @@ i2c:
|
|||||||
scl: 16
|
scl: 16
|
||||||
scan: true
|
scan: true
|
||||||
|
|
||||||
|
ethernet:
|
||||||
|
lldp:
|
||||||
|
# Enable LLDP transmission
|
||||||
|
#enabled: true
|
||||||
|
# Optional: override default port
|
||||||
|
port: "test-port"
|
||||||
|
# Optional: override default system name
|
||||||
|
system_name: "test-system"
|
||||||
|
# Optional: override default system description
|
||||||
|
system_description: "test-description"
|
||||||
|
# Optional: override default "fast mode" burst packet count
|
||||||
|
tx_fast_count: 4
|
||||||
|
# Optional: override default LLDP frame transmission interval
|
||||||
|
tx_interval: 30
|
||||||
|
# Optional: override default hold count, used in conjuction with tx_interval to calculate overall TTL
|
||||||
|
tx_hold: 4
|
||||||
|
|
||||||
# ethernet:
|
# ethernet:
|
||||||
# type: LAN8720
|
# type: LAN8720
|
||||||
# mdc_pin: 23
|
# mdc_pin: 23
|
||||||
@@ -200,6 +207,12 @@ esp32_ble_tracker:
|
|||||||
interval: 1100ms
|
interval: 1100ms
|
||||||
window: 1100ms
|
window: 1100ms
|
||||||
active: true
|
active: true
|
||||||
|
on_ble_advertise:
|
||||||
|
- mac_address:
|
||||||
|
- D5:63:3C:12:E6:07
|
||||||
|
then:
|
||||||
|
- lambda: |-
|
||||||
|
ESP_LOGV("ble_adv", "Detected HPA250B");
|
||||||
|
|
||||||
bluetooth_proxy:
|
bluetooth_proxy:
|
||||||
active: true
|
active: true
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
substitutions:
|
substitutions:
|
||||||
device: heating
|
device: heater
|
||||||
name: Heating
|
name: Heater
|
||||||
name_1: Heater
|
|
||||||
area: Basement
|
area: Basement
|
||||||
comment: "${area} | Hot water and Heating control"
|
comment: "${area} | Hot water and Heating control"
|
||||||
|
|
||||||
@@ -10,17 +9,29 @@ esphome:
|
|||||||
friendly_name: ${name}
|
friendly_name: ${name}
|
||||||
area: ${area}
|
area: ${area}
|
||||||
comment: ${comment}
|
comment: ${comment}
|
||||||
|
areas:
|
||||||
|
- id: local_area
|
||||||
|
name: ${area}
|
||||||
|
devices:
|
||||||
|
- id: heating
|
||||||
|
name: Heating
|
||||||
|
area_id: local_area
|
||||||
|
- id: hot_water
|
||||||
|
name: Hot Water
|
||||||
|
area_id: local_area
|
||||||
|
|
||||||
esp32:
|
esp32:
|
||||||
board: m5stack-atom
|
variant: esp32
|
||||||
framework:
|
framework:
|
||||||
type: esp-idf
|
type: esp-idf
|
||||||
version: 5.3.2
|
|
||||||
platform_version: 53.03.11
|
|
||||||
|
|
||||||
external_components:
|
external_components:
|
||||||
- source: github://mknjc/esphome@ds248x
|
# - source: github://pr#12717
|
||||||
components: ds248x
|
# components: [ds248x]
|
||||||
|
# refresh: 1h
|
||||||
|
- source: github://pr#13534
|
||||||
|
components: [ds2482, ds2484, ds248x_base]
|
||||||
|
refresh: 1h
|
||||||
|
|
||||||
packages:
|
packages:
|
||||||
common: !include common/common.yaml
|
common: !include common/common.yaml
|
||||||
@@ -133,8 +144,9 @@ time:
|
|||||||
climate:
|
climate:
|
||||||
- platform: bang_bang
|
- platform: bang_bang
|
||||||
sensor: hot_water_heater
|
sensor: hot_water_heater
|
||||||
name: Hot Water
|
name: ""
|
||||||
id: hot_water_climate
|
id: hot_water_climate
|
||||||
|
device_id: hot_water
|
||||||
visual:
|
visual:
|
||||||
min_temperature: 40
|
min_temperature: 40
|
||||||
max_temperature: 65
|
max_temperature: 65
|
||||||
@@ -160,13 +172,27 @@ i2c:
|
|||||||
scl: 21
|
scl: 21
|
||||||
scan: true #false
|
scan: true #false
|
||||||
|
|
||||||
ds248x:
|
# one_wire:
|
||||||
|
# id: one_wire_bus
|
||||||
|
# # i2c_id: i2c_main
|
||||||
|
# platform: ds2484
|
||||||
|
# active_pullup: true
|
||||||
|
|
||||||
|
# ds248x:
|
||||||
|
# id: ds2484_module
|
||||||
|
# address: 0x18
|
||||||
|
# active_pullup: true
|
||||||
|
|
||||||
|
# one_wire:
|
||||||
|
# - platform: ds248x
|
||||||
|
# ds248x_id: ds2484_module
|
||||||
|
# id: one_wire_bus
|
||||||
|
|
||||||
|
one_wire:
|
||||||
|
id: one_wire_bus
|
||||||
# i2c_id: i2c_main
|
# i2c_id: i2c_main
|
||||||
address: 0x18 # should be the default
|
platform: ds2482
|
||||||
# sleep_pin: 32 # remove if not needed, if set the ds248x sleeps when no transaction is in progress
|
active_pullup: true
|
||||||
active_pullup: true # adds a active pullup which should improve signal integrity
|
|
||||||
strong_pullup: false # enables a strong pullup used to provide the needed current for temperature reading without vcc connected
|
|
||||||
bus_sleep: true # power down the bus when no transaction is in progres
|
|
||||||
|
|
||||||
modbus:
|
modbus:
|
||||||
uart_id: uart_modbus
|
uart_id: uart_modbus
|
||||||
@@ -185,39 +211,43 @@ pca9554:
|
|||||||
|
|
||||||
switch:
|
switch:
|
||||||
- platform: template
|
- platform: template
|
||||||
name: "Heating Enabled"
|
name: Heating Enabled
|
||||||
id: heating_enabled
|
id: heating_enabled
|
||||||
|
device_id: heating
|
||||||
optimistic: True
|
optimistic: True
|
||||||
- platform: gpio
|
- platform: gpio
|
||||||
name: "Hot Water Demand" # Hot Water Heating Demand (to Heater)
|
name: Demand # Hot Water Heating Demand (to Heater)
|
||||||
id: hot_water_demand
|
id: hot_water_demand
|
||||||
|
device_id: hot_water
|
||||||
pin: 22
|
pin: 22
|
||||||
inverted: true
|
inverted: true
|
||||||
- platform: gpio
|
- platform: gpio
|
||||||
name: "Heating Demand" # Heating Demand (to Heater)
|
name: Demand # Heating Demand (to Heater)
|
||||||
id: heating_demand
|
id: heating_demand
|
||||||
|
device_id: heating
|
||||||
pin: 19
|
pin: 19
|
||||||
inverted: true
|
inverted: true
|
||||||
- platform: gpio
|
- platform: gpio
|
||||||
name: "${name_1} Power Level II"
|
name: Power Level II
|
||||||
id: heating_power_level_2
|
id: heating_power_level_2
|
||||||
pin:
|
pin:
|
||||||
pca9554: pca9554_module
|
pca9554: pca9554_module
|
||||||
number: 4
|
number: 4
|
||||||
- platform: gpio
|
- platform: gpio
|
||||||
name: "${name_1} Power Level III"
|
name: Power Level III
|
||||||
id: heating_power_level_3
|
id: heating_power_level_3
|
||||||
pin:
|
pin:
|
||||||
pca9554: pca9554_module
|
pca9554: pca9554_module
|
||||||
number: 5
|
number: 5
|
||||||
# - platform: uart
|
# - platform: uart
|
||||||
# name: "${name_1} Total Heater Power Reset"
|
# name: Total Heater Power Reset
|
||||||
# uart_id:
|
# uart_id:
|
||||||
# id: reset_total_heater_power
|
# id: reset_total_heater_power
|
||||||
# data: [0x01, 0x42, 0x80, 0x11]
|
# data: [0x01, 0x42, 0x80, 0x11]
|
||||||
|
|
||||||
sensor:
|
sensor:
|
||||||
- platform: ds248x
|
# - platform: ds248x
|
||||||
|
- platform: dallas_temp
|
||||||
# [22:06:25][D][dallas.sensor:082]: 0x1701143E35C5AA28 Feed
|
# [22:06:25][D][dallas.sensor:082]: 0x1701143E35C5AA28 Feed
|
||||||
# [22:06:25][D][dallas.sensor:082]: 0x7301143F7F57AA28 Return
|
# [22:06:25][D][dallas.sensor:082]: 0x7301143F7F57AA28 Return
|
||||||
# [22:06:25][D][dallas.sensor:082]: 0xF701143E397FAA28 Heater Tank
|
# [22:06:25][D][dallas.sensor:082]: 0xF701143E397FAA28 Heater Tank
|
||||||
@@ -228,32 +258,40 @@ sensor:
|
|||||||
# address: 0x320417500A93FF28 # 1. broken
|
# address: 0x320417500A93FF28 # 1. broken
|
||||||
# address: 0x67041750F44CFF28 # 2. broken
|
# address: 0x67041750F44CFF28 # 2. broken
|
||||||
address: 0x960417517301FF28 # Hot Water Tank - TOP (Heater)
|
address: 0x960417517301FF28 # Hot Water Tank - TOP (Heater)
|
||||||
name: "Hot Water - Heater"
|
name: Heater
|
||||||
id: 'hot_water_heater'
|
id: hot_water_heater
|
||||||
- platform: ds248x
|
device_id: hot_water
|
||||||
|
# - platform: ds248x
|
||||||
|
- platform: dallas_temp
|
||||||
address: 0x5A041750B2C8FF28 # Hot Water Tank - Bottom (Solar)
|
address: 0x5A041750B2C8FF28 # Hot Water Tank - Bottom (Solar)
|
||||||
name: "Hot Water - Solar"
|
name: Solar
|
||||||
id: 'hot_water_solar'
|
id: hot_water_solar
|
||||||
- platform: ds248x
|
device_id: hot_water
|
||||||
|
# - platform: ds248x
|
||||||
|
- platform: dallas_temp
|
||||||
address: 0xF701143E397FAA28 # Heater Tank
|
address: 0xF701143E397FAA28 # Heater Tank
|
||||||
name: "Heater"
|
name: Temperature
|
||||||
id: 'heater'
|
id: heater
|
||||||
- platform: ds248x
|
# - platform: ds248x
|
||||||
|
- platform: dallas_temp
|
||||||
address: 0x1701143E35C5AA28 # Heating Water Feed (OUT from Heater, TO System)
|
address: 0x1701143E35C5AA28 # Heating Water Feed (OUT from Heater, TO System)
|
||||||
name: "Heating OUT2"
|
name: OUT2
|
||||||
id: 'heating_out'
|
id: heating_out
|
||||||
- platform: ds248x
|
device_id: heating
|
||||||
|
# - platform: ds248x
|
||||||
|
- platform: dallas_temp
|
||||||
address: 0x7301143F7F57AA28 # Heating Water Return (OUT from System, TO Heater)
|
address: 0x7301143F7F57AA28 # Heating Water Return (OUT from System, TO Heater)
|
||||||
name: "Heating IN2"
|
name: IN2
|
||||||
id: 'heating_in'
|
id: heating_in
|
||||||
- platform: template
|
device_id: heating
|
||||||
name: "Heater Total Daily Energy"
|
# - platform: template
|
||||||
id: heater_daily_energy
|
# name: Total Daily Energy
|
||||||
lambda: |-
|
# id: heater_daily_energy
|
||||||
return (id(heater_l1_total_daily_energy).state + id(heater_l3_total_daily_energy).state + id(heater_l3_total_daily_energy).state);
|
# lambda: |-
|
||||||
|
# return (id(heater_l1_total_daily_energy).state + id(heater_l3_total_daily_energy).state + id(heater_l3_total_daily_energy).state);
|
||||||
update_interval: 60s
|
update_interval: 60s
|
||||||
- platform: template
|
- platform: template
|
||||||
name: 'Heater Daily Energy Price'
|
name: Daily Energy Price
|
||||||
id: heater_energy_price
|
id: heater_energy_price
|
||||||
unit_of_measurement: '€'
|
unit_of_measurement: '€'
|
||||||
lambda: |-
|
lambda: |-
|
||||||
@@ -273,27 +311,27 @@ sensor:
|
|||||||
//# prenos spotreba * (0,00398400+0,01146600+0,00327000+0,00629760+0,01590000) = spotreba * 0,0409176
|
//# prenos spotreba * (0,00398400+0,01146600+0,00327000+0,00629760+0,01590000) = spotreba * 0,0409176
|
||||||
|
|
||||||
// # 1,1 + (VT * 0,1038) + (NT * 0,069) + (75 * 0,1508) + ((VT+NT) * (0,00398400+0,01146600+0,00327000+0,00629760+0,01590000))
|
// # 1,1 + (VT * 0,1038) + (NT * 0,069) + (75 * 0,1508) + ((VT+NT) * (0,00398400+0,01146600+0,00327000+0,00629760+0,01590000))
|
||||||
return (id(heater_daily_energy).state * (0.0409176 + 0.069));
|
return (id(heater_total_daily_energy).state * (0.0409176 + 0.069));
|
||||||
# L1
|
# L1
|
||||||
- platform: pzemac
|
- platform: pzemac
|
||||||
#address: 161
|
#address: 161
|
||||||
current:
|
current:
|
||||||
name: "${name_1} L1 Current"
|
name: L1 Current
|
||||||
voltage:
|
voltage:
|
||||||
name: "${name_1} L1 Voltage"
|
name: L1 Voltage
|
||||||
energy:
|
energy:
|
||||||
name: "${name_1} L1 Energy"
|
name: L1 Energy
|
||||||
id: heater_l1_energy
|
id: heater_l1_energy
|
||||||
power:
|
power:
|
||||||
name: "${name_1} L1 Power"
|
name: L1 Power
|
||||||
id: heater_l1_power
|
id: heater_l1_power
|
||||||
frequency:
|
frequency:
|
||||||
name: "${name_1} L1 Frequency"
|
name: L1 Frequency
|
||||||
power_factor:
|
power_factor:
|
||||||
name: "${name_1} L1 Power Factor"
|
name: L1 Power Factor
|
||||||
update_interval: 20s
|
update_interval: 20s
|
||||||
- platform: total_daily_energy
|
- platform: total_daily_energy
|
||||||
name: "${name_1} L1 Total Daily Energy"
|
name: L1 Total Daily Energy
|
||||||
power_id: heater_l1_power
|
power_id: heater_l1_power
|
||||||
id: heater_l1_total_daily_energy
|
id: heater_l1_total_daily_energy
|
||||||
filters:
|
filters:
|
||||||
@@ -301,7 +339,7 @@ sensor:
|
|||||||
unit_of_measurement: kWh
|
unit_of_measurement: kWh
|
||||||
icon: mdi:counter
|
icon: mdi:counter
|
||||||
- platform: integration
|
- platform: integration
|
||||||
name: "${name_1} L1 Energy Meter"
|
name: L1 Energy Meter"
|
||||||
sensor: heater_l1_power
|
sensor: heater_l1_power
|
||||||
time_unit: h
|
time_unit: h
|
||||||
filters:
|
filters:
|
||||||
@@ -312,22 +350,22 @@ sensor:
|
|||||||
- platform: pzemac
|
- platform: pzemac
|
||||||
address: 162
|
address: 162
|
||||||
current:
|
current:
|
||||||
name: "${name_1} L2 Current"
|
name: L2 Current
|
||||||
voltage:
|
voltage:
|
||||||
name: "${name_1} L2 Voltage"
|
name: L2 Voltage
|
||||||
energy:
|
energy:
|
||||||
name: "${name_1} L2 Energy"
|
name: L2 Energy
|
||||||
id: heater_l2_energy
|
id: heater_l2_energy
|
||||||
power:
|
power:
|
||||||
name: "${name_1} L2 Power"
|
name: L2 Power
|
||||||
id: heater_l2_power
|
id: heater_l2_power
|
||||||
frequency:
|
frequency:
|
||||||
name: "${name_1} L2 Frequency"
|
name: L2 Frequency
|
||||||
power_factor:
|
power_factor:
|
||||||
name: "${name_1} L2 Power Factor"
|
name: L2 Power Factor
|
||||||
update_interval: 20s
|
update_interval: 20s
|
||||||
- platform: total_daily_energy
|
- platform: total_daily_energy
|
||||||
name: "${name_1} L2 Total Daily Energy"
|
name: L2 Total Daily Energy
|
||||||
id: heater_l2_total_daily_energy
|
id: heater_l2_total_daily_energy
|
||||||
power_id: heater_l2_power
|
power_id: heater_l2_power
|
||||||
filters:
|
filters:
|
||||||
@@ -335,7 +373,7 @@ sensor:
|
|||||||
unit_of_measurement: kWh
|
unit_of_measurement: kWh
|
||||||
icon: mdi:counter
|
icon: mdi:counter
|
||||||
- platform: integration
|
- platform: integration
|
||||||
name: "${name_1} L2 Energy Meter"
|
name: L2 Energy Meter
|
||||||
sensor: heater_l2_power
|
sensor: heater_l2_power
|
||||||
time_unit: h
|
time_unit: h
|
||||||
filters:
|
filters:
|
||||||
@@ -346,22 +384,22 @@ sensor:
|
|||||||
- platform: pzemac
|
- platform: pzemac
|
||||||
address: 163
|
address: 163
|
||||||
current:
|
current:
|
||||||
name: "${name_1} L3 Current"
|
name: L3 Current
|
||||||
voltage:
|
voltage:
|
||||||
name: "${name_1} L3 Voltage"
|
name: L3 Voltage
|
||||||
energy:
|
energy:
|
||||||
name: "${name_1} L3 Energy"
|
name: L3 Energy
|
||||||
id: heater_l3_energy
|
id: heater_l3_energy
|
||||||
power:
|
power:
|
||||||
name: "${name_1} L3 Power"
|
name: L3 Power
|
||||||
id: heater_l3_power
|
id: heater_l3_power
|
||||||
frequency:
|
frequency:
|
||||||
name: "${name_1} L3 Frequency"
|
name: L3 Frequency
|
||||||
power_factor:
|
power_factor:
|
||||||
name: "${name_1} L3 Power Factor"
|
name: L3 Power Factor
|
||||||
update_interval: 20s
|
update_interval: 20s
|
||||||
- platform: total_daily_energy
|
- platform: total_daily_energy
|
||||||
name: "${name_1} L3 Total Daily Energy"
|
name: L3 Total Daily Energy
|
||||||
power_id: heater_l3_power
|
power_id: heater_l3_power
|
||||||
id: heater_l3_total_daily_energy
|
id: heater_l3_total_daily_energy
|
||||||
filters:
|
filters:
|
||||||
@@ -369,7 +407,7 @@ sensor:
|
|||||||
unit_of_measurement: kWh
|
unit_of_measurement: kWh
|
||||||
icon: mdi:counter
|
icon: mdi:counter
|
||||||
- platform: integration
|
- platform: integration
|
||||||
name: "${name_1} L3 Energy Meter"
|
name: L3 Energy Meter
|
||||||
sensor: heater_l3_power
|
sensor: heater_l3_power
|
||||||
time_unit: h
|
time_unit: h
|
||||||
filters:
|
filters:
|
||||||
@@ -378,8 +416,8 @@ sensor:
|
|||||||
icon: mdi:counter
|
icon: mdi:counter
|
||||||
# TOTAL: L1+L2+L3
|
# TOTAL: L1+L2+L3
|
||||||
- platform: template
|
- platform: template
|
||||||
name: "${name_1} Power"
|
name: Power
|
||||||
id: "total_heater_power"
|
id: total_heater_power
|
||||||
device_class: power
|
device_class: power
|
||||||
state_class: measurement
|
state_class: measurement
|
||||||
unit_of_measurement: W
|
unit_of_measurement: W
|
||||||
@@ -387,8 +425,8 @@ sensor:
|
|||||||
lambda: |-
|
lambda: |-
|
||||||
return id(heater_l1_power).state + id(heater_l2_power).state + id(heater_l3_power).state ;
|
return id(heater_l1_power).state + id(heater_l2_power).state + id(heater_l3_power).state ;
|
||||||
- platform: template
|
- platform: template
|
||||||
name: "${name_1} Total Daily Energy"
|
name: Total Daily Energy
|
||||||
id: "heater_total_daily_energy"
|
id: heater_total_daily_energy
|
||||||
icon: mdi:counter
|
icon: mdi:counter
|
||||||
device_class: energy
|
device_class: energy
|
||||||
# state_class: measurement
|
# state_class: measurement
|
||||||
@@ -398,7 +436,7 @@ sensor:
|
|||||||
lambda: |-
|
lambda: |-
|
||||||
return id(heater_l1_total_daily_energy).state + id(heater_l2_total_daily_energy).state + id(heater_l3_total_daily_energy).state ;
|
return id(heater_l1_total_daily_energy).state + id(heater_l2_total_daily_energy).state + id(heater_l3_total_daily_energy).state ;
|
||||||
- platform: template
|
- platform: template
|
||||||
name: "${name_1} Energy"
|
name: Energy
|
||||||
icon: mdi:counter
|
icon: mdi:counter
|
||||||
device_class: energy
|
device_class: energy
|
||||||
state_class: total_increasing
|
state_class: total_increasing
|
||||||
@@ -411,7 +449,7 @@ sensor:
|
|||||||
|
|
||||||
binary_sensor:
|
binary_sensor:
|
||||||
- platform: gpio
|
- platform: gpio
|
||||||
name: "${name} Off Peak" # Off Peak (HDO)
|
name: Off Peak # Off Peak (HDO)
|
||||||
id: off_peak_status
|
id: off_peak_status
|
||||||
pin:
|
pin:
|
||||||
pca9554: pca9554_module
|
pca9554: pca9554_module
|
||||||
@@ -420,7 +458,7 @@ binary_sensor:
|
|||||||
- delayed_on: 300ms
|
- delayed_on: 300ms
|
||||||
- delayed_off: 300ms
|
- delayed_off: 300ms
|
||||||
- platform: gpio
|
- platform: gpio
|
||||||
name: "${name} ON" # Heater ON
|
name: "ON" # Heater ON
|
||||||
id: heater_on
|
id: heater_on
|
||||||
pin:
|
pin:
|
||||||
pca9554: pca9554_module
|
pca9554: pca9554_module
|
||||||
@@ -429,7 +467,7 @@ binary_sensor:
|
|||||||
- delayed_on: 300ms
|
- delayed_on: 300ms
|
||||||
- delayed_off: 300ms
|
- delayed_off: 300ms
|
||||||
- platform: gpio
|
- platform: gpio
|
||||||
name: "${name} Error"
|
name: Error
|
||||||
id: heating_error
|
id: heating_error
|
||||||
pin:
|
pin:
|
||||||
pca9554: pca9554_module
|
pca9554: pca9554_module
|
||||||
@@ -439,7 +477,7 @@ binary_sensor:
|
|||||||
- delayed_off: 300ms
|
- delayed_off: 300ms
|
||||||
- platform: template
|
- platform: template
|
||||||
id: heater_alarm
|
id: heater_alarm
|
||||||
name: "Heater Alarm"
|
name: Alarm
|
||||||
lambda: |-
|
lambda: |-
|
||||||
if (id(off_peak_status).state && (id(heating_demand).state || id(heating_power_level_2).state) && !id(heater_on).state) {
|
if (id(off_peak_status).state && (id(heating_demand).state || id(heating_power_level_2).state) && !id(heater_on).state) {
|
||||||
return true;
|
return true;
|
||||||
@@ -449,12 +487,15 @@ binary_sensor:
|
|||||||
- platform: homeassistant
|
- platform: homeassistant
|
||||||
id: trv_heating_demand
|
id: trv_heating_demand
|
||||||
entity_id: binary_sensor.trv_heating_demand
|
entity_id: binary_sensor.trv_heating_demand
|
||||||
|
device_id: heating
|
||||||
- platform: homeassistant
|
- platform: homeassistant
|
||||||
id: heating_fireplace_fire
|
id: heating_fireplace_fire
|
||||||
entity_id: binary_sensor.heating_fireplace_fire
|
entity_id: binary_sensor.heating_fireplace_fire
|
||||||
|
device_id: heating
|
||||||
- platform: template
|
- platform: template
|
||||||
id: request_heating_demand
|
id: request_heating_demand
|
||||||
name: "Request Heating Demand"
|
name: Request Demand
|
||||||
|
device_id: heating
|
||||||
lambda: |-
|
lambda: |-
|
||||||
if (id(trv_heating_demand).state && id(heating_enabled).state && !id(heating_fireplace_fire).state) {
|
if (id(trv_heating_demand).state && id(heating_enabled).state && !id(heating_fireplace_fire).state) {
|
||||||
return true;
|
return true;
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
substitutions:
|
substitutions:
|
||||||
device: kitchen
|
device: kitchen
|
||||||
name: Kitchen
|
name: Kitchen
|
||||||
area: Living Room / Kitchen
|
area: Living Room & Kitchen
|
||||||
comment: "${area} | Kitchen Worktop and Stove Lights"
|
comment: "${area} | Kitchen Worktop and Stove Lights"
|
||||||
|
|
||||||
esphome:
|
esphome:
|
||||||
@@ -29,11 +29,9 @@ esphome:
|
|||||||
|
|
||||||
|
|
||||||
esp32:
|
esp32:
|
||||||
board: m5stack-atom
|
variant: esp32
|
||||||
framework:
|
framework:
|
||||||
type: esp-idf
|
type: esp-idf
|
||||||
version: 5.3.2
|
|
||||||
platform_version: 53.03.11
|
|
||||||
|
|
||||||
packages:
|
packages:
|
||||||
common: !include common/common.yaml
|
common: !include common/common.yaml
|
||||||
@@ -124,8 +122,8 @@ light:
|
|||||||
id: light_3
|
id: light_3
|
||||||
default_transition_length: 200ms
|
default_transition_length: 200ms
|
||||||
restore_mode: ALWAYS_ON
|
restore_mode: ALWAYS_ON
|
||||||
cold_white: pwm_ww_3
|
cold_white: pwm_cw_3
|
||||||
warm_white: pwm_cw_3
|
warm_white: pwm_ww_3
|
||||||
cold_white_color_temperature: 6536 K
|
cold_white_color_temperature: 6536 K
|
||||||
warm_white_color_temperature: 2000 K
|
warm_white_color_temperature: 2000 K
|
||||||
# - platform: cwww
|
# - platform: cwww
|
||||||
@@ -205,3 +203,6 @@ power_supply:
|
|||||||
# name: "${name} Relay Spare"
|
# name: "${name} Relay Spare"
|
||||||
# id: relay_2
|
# id: relay_2
|
||||||
# pin: 19
|
# pin: 19
|
||||||
|
|
||||||
|
bluetooth_proxy:
|
||||||
|
active: true
|
||||||
|
|||||||
@@ -12,12 +12,9 @@ esphome:
|
|||||||
comment: ${comment}
|
comment: ${comment}
|
||||||
|
|
||||||
esp32:
|
esp32:
|
||||||
board: m5stack-atom
|
variant: esp32
|
||||||
# board: m5stamp-pico
|
|
||||||
framework:
|
framework:
|
||||||
type: esp-idf
|
type: esp-idf
|
||||||
version: 5.3.1
|
|
||||||
platform_version: 6.9.0
|
|
||||||
|
|
||||||
external_components:
|
external_components:
|
||||||
- source: components
|
- source: components
|
||||||
|
|||||||
@@ -9,36 +9,17 @@ esphome:
|
|||||||
friendly_name: ${name}
|
friendly_name: ${name}
|
||||||
area: ${area}
|
area: ${area}
|
||||||
comment: ${comment}
|
comment: ${comment}
|
||||||
platformio_options:
|
|
||||||
upload_speed: 921600
|
|
||||||
build_unflags: -Werror=all
|
|
||||||
board_build.flash_mode: dio
|
|
||||||
board_build.f_flash: 80000000L
|
|
||||||
board_build.f_cpu: 240000000L
|
|
||||||
|
|
||||||
esp32:
|
esp32:
|
||||||
board: esp32-s3-devkitc-1
|
variant: esp32s3
|
||||||
flash_size: 16MB
|
flash_size: 16MB
|
||||||
framework:
|
framework:
|
||||||
type: esp-idf
|
type: esp-idf
|
||||||
version: 5.3.2
|
|
||||||
platform_version: 53.03.11
|
|
||||||
sdkconfig_options:
|
|
||||||
CONFIG_ESP32S3_DEFAULT_CPU_FREQ_240: y
|
|
||||||
CONFIG_ESP32S3_DATA_CACHE_64KB: y
|
|
||||||
CONFIG_ESP32S3_DATA_CACHE_LINE_64B: y
|
|
||||||
CONFIG_SPIRAM_FETCH_INSTRUCTIONS: y
|
|
||||||
CONFIG_SPIRAM_RODATA: y
|
|
||||||
|
|
||||||
packages:
|
packages:
|
||||||
common: !include common/common.yaml
|
common: !include common/common.yaml
|
||||||
|
|
||||||
external_components:
|
# external_components:
|
||||||
#- source: github://buglloc/esphome-components
|
|
||||||
#- source: github://Garag/esphome-components
|
|
||||||
- source: github://clowrey/esphome-components
|
|
||||||
components: [axs15231]
|
|
||||||
refresh: 10min
|
|
||||||
|
|
||||||
i2c:
|
i2c:
|
||||||
sda: 4
|
sda: 4
|
||||||
@@ -116,8 +97,14 @@ globals:
|
|||||||
type: Color
|
type: Color
|
||||||
initial_value: "Color::random_color()"
|
initial_value: "Color::random_color()"
|
||||||
|
|
||||||
|
power_supply:
|
||||||
|
id: main_backlight
|
||||||
|
pin: 1
|
||||||
|
enable_on_boot: true
|
||||||
|
|
||||||
display:
|
display:
|
||||||
- platform: axs15231
|
- platform: qspi_dbi
|
||||||
|
model: axs15231
|
||||||
data_rate: 40MHz #20mhz is default
|
data_rate: 40MHz #20mhz is default
|
||||||
#spi_mode: MODE2
|
#spi_mode: MODE2
|
||||||
id: main_display
|
id: main_display
|
||||||
@@ -126,10 +113,7 @@ display:
|
|||||||
height: 480
|
height: 480
|
||||||
width: 320
|
width: 320
|
||||||
cs_pin: 45
|
cs_pin: 45
|
||||||
backlight_pin: 1
|
|
||||||
brightness: 50
|
brightness: 50
|
||||||
transform:
|
|
||||||
swap_xy: false
|
|
||||||
rotation: 90
|
rotation: 90
|
||||||
auto_clear_enabled: false
|
auto_clear_enabled: false
|
||||||
show_test_card: true
|
show_test_card: true
|
||||||
|
|||||||
289
mcu-lvgl-trainer.yaml
Normal file
289
mcu-lvgl-trainer.yaml
Normal file
@@ -0,0 +1,289 @@
|
|||||||
|
substitutions:
|
||||||
|
device: lvgl-trainer
|
||||||
|
name: Trainer Display
|
||||||
|
area: Basement
|
||||||
|
comment: "${area} | Pain Cave"
|
||||||
|
|
||||||
|
esphome:
|
||||||
|
name: mcu-${device}
|
||||||
|
friendly_name: ${name}
|
||||||
|
area: ${area}
|
||||||
|
comment: ${comment}
|
||||||
|
|
||||||
|
esp32:
|
||||||
|
variant: esp32s3
|
||||||
|
flash_size: 16MB
|
||||||
|
framework:
|
||||||
|
type: esp-idf
|
||||||
|
|
||||||
|
|
||||||
|
packages:
|
||||||
|
common: !include common/common.yaml
|
||||||
|
|
||||||
|
i2c:
|
||||||
|
- id: touchscreen_bus
|
||||||
|
sda: 4
|
||||||
|
scl: 8
|
||||||
|
|
||||||
|
psram:
|
||||||
|
mode: octal
|
||||||
|
speed: 80MHz
|
||||||
|
|
||||||
|
spi:
|
||||||
|
id: display_qspi
|
||||||
|
type: quad
|
||||||
|
clk_pin: 47
|
||||||
|
data_pins: [21, 48, 40, 39]
|
||||||
|
|
||||||
|
color:
|
||||||
|
- id: my_red
|
||||||
|
red: 100%
|
||||||
|
green: 0%
|
||||||
|
blue: 0%
|
||||||
|
- id: my_orange
|
||||||
|
red: 100%
|
||||||
|
green: 50%
|
||||||
|
blue: 0%
|
||||||
|
- id: my_yellow
|
||||||
|
red: 100%
|
||||||
|
green: 100%
|
||||||
|
blue: 0%
|
||||||
|
- id: my_green
|
||||||
|
red: 0%
|
||||||
|
green: 100%
|
||||||
|
blue: 0%
|
||||||
|
- id: my_blue
|
||||||
|
red: 0%
|
||||||
|
green: 0%
|
||||||
|
blue: 100%
|
||||||
|
- id: my_teal
|
||||||
|
red: 0%
|
||||||
|
green: 100%
|
||||||
|
blue: 100%
|
||||||
|
- id: my_gray
|
||||||
|
red: 70%
|
||||||
|
green: 70%
|
||||||
|
blue: 70%
|
||||||
|
- id: my_white
|
||||||
|
red: 100%
|
||||||
|
green: 100%
|
||||||
|
blue: 100%
|
||||||
|
|
||||||
|
font:
|
||||||
|
- file: "gfonts://Roboto"
|
||||||
|
id: Roboto_48
|
||||||
|
size: 48
|
||||||
|
- file: "gfonts://Roboto"
|
||||||
|
id: Roboto_36
|
||||||
|
size: 36
|
||||||
|
- file: "gfonts://Roboto"
|
||||||
|
id: Roboto_24
|
||||||
|
size: 24
|
||||||
|
- file: "gfonts://Roboto"
|
||||||
|
id: Roboto_12
|
||||||
|
size: 12
|
||||||
|
- file: "gfonts://Roboto"
|
||||||
|
id: font_std
|
||||||
|
size: 40
|
||||||
|
glyphs: "!\"%()+=,-_.:°0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz/\\[]|&@#'"
|
||||||
|
- file: "gfonts://Roboto@700"
|
||||||
|
id: font_title
|
||||||
|
size: 40
|
||||||
|
glyphs: "!\"%()+=,-_.:°0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz/\\[]|&@#'"
|
||||||
|
|
||||||
|
globals:
|
||||||
|
- id: bgcolor
|
||||||
|
type: Color
|
||||||
|
initial_value: "Color::random_color()"
|
||||||
|
|
||||||
|
# power_supply:
|
||||||
|
# id: main_backlight
|
||||||
|
# pin: 1
|
||||||
|
# enable_on_boot: true
|
||||||
|
|
||||||
|
output:
|
||||||
|
- platform: ledc
|
||||||
|
id: gpio_backlight_pwm
|
||||||
|
pin: 1
|
||||||
|
|
||||||
|
light:
|
||||||
|
- id: display_backlight
|
||||||
|
name: Backlight
|
||||||
|
platform: monochromatic
|
||||||
|
output: gpio_backlight_pwm
|
||||||
|
restore_mode: ALWAYS_ON
|
||||||
|
default_transition_length: 500ms
|
||||||
|
|
||||||
|
display:
|
||||||
|
- platform: qspi_dbi
|
||||||
|
model: axs15231
|
||||||
|
data_rate: 40MHz #20mhz is default
|
||||||
|
#spi_mode: MODE2
|
||||||
|
id: main_display
|
||||||
|
spi_id: display_qspi
|
||||||
|
dimensions:
|
||||||
|
height: 480
|
||||||
|
width: 320
|
||||||
|
cs_pin: 45
|
||||||
|
brightness: 50
|
||||||
|
rotation: 90
|
||||||
|
auto_clear_enabled: false
|
||||||
|
# show_test_card: true
|
||||||
|
# lambda: |-
|
||||||
|
# it.fill(id(bgcolor));
|
||||||
|
# it.print(it.get_width()/2, it.get_height()/2-20, id(font_title), TextAlign::CENTER, "ESPHome");
|
||||||
|
# it.print(it.get_width()/2, it.get_height()/2+20, id(font_std), TextAlign::CENTER, "@UTBDK");
|
||||||
|
|
||||||
|
touchscreen:
|
||||||
|
- platform: axs15231
|
||||||
|
id: main_touch
|
||||||
|
display: main_display
|
||||||
|
i2c_id: touchscreen_bus
|
||||||
|
update_interval: 100ms
|
||||||
|
# interrupt_pin:
|
||||||
|
# number: 3
|
||||||
|
# ignore_strapping_warning: true
|
||||||
|
calibration:
|
||||||
|
x_min: 0
|
||||||
|
x_max: 479
|
||||||
|
y_min: 0
|
||||||
|
y_max: 319
|
||||||
|
transform:
|
||||||
|
swap_xy: true
|
||||||
|
mirror_x: false
|
||||||
|
mirror_y: true
|
||||||
|
# on_touch:
|
||||||
|
# - lambda: |-
|
||||||
|
# Color newColor;
|
||||||
|
# do { newColor = Color::random_color(); } while (newColor == id(bgcolor));
|
||||||
|
# id(bgcolor) = newColor;
|
||||||
|
|
||||||
|
# ESP_LOGI("cal", "x=%d, y=%d, x_raw=%d, y_raw=%0d",
|
||||||
|
# touch.x,
|
||||||
|
# touch.y,
|
||||||
|
# touch.x_raw,
|
||||||
|
# touch.y_raw
|
||||||
|
# );
|
||||||
|
on_release:
|
||||||
|
- if:
|
||||||
|
condition: lvgl.is_paused
|
||||||
|
then:
|
||||||
|
- lvgl.resume:
|
||||||
|
- lvgl.widget.redraw:
|
||||||
|
- light.turn_on:
|
||||||
|
id: display_backlight
|
||||||
|
transition_length: 300ms
|
||||||
|
|
||||||
|
uart:
|
||||||
|
- id: ext_uart
|
||||||
|
tx_pin: 43
|
||||||
|
rx_pin: 44
|
||||||
|
baud_rate: 115200
|
||||||
|
stop_bits: 1
|
||||||
|
parity: NONE
|
||||||
|
|
||||||
|
binary_sensor:
|
||||||
|
- platform: homeassistant
|
||||||
|
id: exercise_room_light
|
||||||
|
entity_id: light.exercise_room
|
||||||
|
publish_initial_state: true
|
||||||
|
on_state:
|
||||||
|
then:
|
||||||
|
lvgl.widget.update:
|
||||||
|
id: exercise_room_light_btn
|
||||||
|
state:
|
||||||
|
checked: !lambda return x;
|
||||||
|
- platform: homeassistant
|
||||||
|
id: exercise_room_fan
|
||||||
|
entity_id: light.mcu_dimmer_exercise_room_fan
|
||||||
|
publish_initial_state: true
|
||||||
|
on_state:
|
||||||
|
then:
|
||||||
|
lvgl.widget.update:
|
||||||
|
id: exercise_room_fan_btn
|
||||||
|
state:
|
||||||
|
checked: !lambda return x;
|
||||||
|
|
||||||
|
lvgl:
|
||||||
|
buffer_size: 100%
|
||||||
|
log_level: WARN
|
||||||
|
color_depth: 16
|
||||||
|
default_font: montserrat_18
|
||||||
|
# on_idle:
|
||||||
|
# - timeout: !lambda "return (id(display_timeout).state * 1000);"
|
||||||
|
# then:
|
||||||
|
# - logger.log: "LVGL is idle"
|
||||||
|
# - light.turn_off:
|
||||||
|
# id: display_backlight
|
||||||
|
# transition_length: 2500ms
|
||||||
|
# - lvgl.pause:
|
||||||
|
top_layer:
|
||||||
|
widgets:
|
||||||
|
- buttonmatrix:
|
||||||
|
align: bottom_mid
|
||||||
|
# styles: header_footer
|
||||||
|
pad_all: 0
|
||||||
|
outline_width: 0
|
||||||
|
id: top_layer
|
||||||
|
# items:
|
||||||
|
# styles: header_footer
|
||||||
|
rows:
|
||||||
|
- buttons:
|
||||||
|
- id: page_prev
|
||||||
|
text: "\uF053"
|
||||||
|
on_press:
|
||||||
|
then:
|
||||||
|
lvgl.page.previous:
|
||||||
|
- id: page_home
|
||||||
|
text: "\uF015"
|
||||||
|
on_press:
|
||||||
|
then:
|
||||||
|
lvgl.page.show: main_page
|
||||||
|
- id: page_next
|
||||||
|
text: "\uF054"
|
||||||
|
on_press:
|
||||||
|
then:
|
||||||
|
lvgl.page.next:
|
||||||
|
pages:
|
||||||
|
- id: main_page
|
||||||
|
widgets:
|
||||||
|
- label:
|
||||||
|
text: "ESPHome LVGL Display"
|
||||||
|
align: CENTER
|
||||||
|
text_align: CENTER
|
||||||
|
text_color: 0xFFFFFF
|
||||||
|
- id: excercise_page
|
||||||
|
widgets:
|
||||||
|
- label:
|
||||||
|
align: CENTER
|
||||||
|
text: 'Hello World!'
|
||||||
|
- button:
|
||||||
|
id: exercise_room_light_btn
|
||||||
|
align: TOP_LEFT
|
||||||
|
width: 100
|
||||||
|
height: 70
|
||||||
|
checkable: true
|
||||||
|
widgets:
|
||||||
|
- label:
|
||||||
|
align: CENTER
|
||||||
|
text: 'Light'
|
||||||
|
on_click:
|
||||||
|
- homeassistant.action:
|
||||||
|
action: light.toggle
|
||||||
|
data:
|
||||||
|
entity_id: light.exercise_room
|
||||||
|
- button:
|
||||||
|
id: exercise_room_fan_btn
|
||||||
|
align: TOP_RIGHT
|
||||||
|
width: 100
|
||||||
|
height: 70
|
||||||
|
checkable: true
|
||||||
|
widgets:
|
||||||
|
- label:
|
||||||
|
align: CENTER
|
||||||
|
text: 'Fan'
|
||||||
|
on_click:
|
||||||
|
- homeassistant.action:
|
||||||
|
action: light.toggle
|
||||||
|
data:
|
||||||
|
entity_id: light.mcu_dimmer_exercise_room_fan
|
||||||
@@ -14,13 +14,10 @@ esphome:
|
|||||||
includes: ota.h
|
includes: ota.h
|
||||||
|
|
||||||
esp32:
|
esp32:
|
||||||
board: esp32-s3-devkitc-1
|
|
||||||
variant: esp32s3
|
variant: esp32s3
|
||||||
flash_size: 16MB
|
flash_size: 16MB
|
||||||
framework:
|
framework:
|
||||||
type: esp-idf
|
type: esp-idf
|
||||||
version: 5.3.2
|
|
||||||
platform_version: 53.03.11
|
|
||||||
# Required to achieve sufficient PSRAM bandwidth
|
# Required to achieve sufficient PSRAM bandwidth
|
||||||
sdkconfig_options:
|
sdkconfig_options:
|
||||||
CONFIG_ESP32S3_DEFAULT_CPU_FREQ_240: y
|
CONFIG_ESP32S3_DEFAULT_CPU_FREQ_240: y
|
||||||
|
|||||||
@@ -6,38 +6,19 @@ substitutions:
|
|||||||
|
|
||||||
esphome:
|
esphome:
|
||||||
name: mcu-${device}
|
name: mcu-${device}
|
||||||
|
friendly_name: ${name}
|
||||||
area: ${area}
|
area: ${area}
|
||||||
comment: ${comment}
|
comment: ${comment}
|
||||||
|
|
||||||
esp32:
|
esp32:
|
||||||
board: m5stack-core2
|
variant: esp32
|
||||||
framework:
|
framework:
|
||||||
# type: arduino
|
|
||||||
type: esp-idf
|
type: esp-idf
|
||||||
|
|
||||||
psram:
|
psram:
|
||||||
|
|
||||||
external_components:
|
external_components:
|
||||||
# - source: github://pr#4027
|
- source: github://Passific/m5paper_esphome
|
||||||
# refresh: 0s
|
|
||||||
# components:
|
|
||||||
# # - bm8563
|
|
||||||
# - gt911
|
|
||||||
# - it8951e
|
|
||||||
# - m5paper
|
|
||||||
# - spi
|
|
||||||
- source:
|
|
||||||
type: git
|
|
||||||
url: https://github.com/Passific/m5paper_esphome
|
|
||||||
ref: main
|
|
||||||
components:
|
|
||||||
- bm8563
|
|
||||||
- gt911
|
|
||||||
- it8951e
|
|
||||||
- m5paper
|
|
||||||
- spi
|
|
||||||
# external_components:
|
|
||||||
# - source: components
|
|
||||||
|
|
||||||
packages:
|
packages:
|
||||||
common: !include common/common.yaml
|
common: !include common/common.yaml
|
||||||
@@ -55,9 +36,9 @@ time:
|
|||||||
m5paper:
|
m5paper:
|
||||||
battery_power_pin: GPIO5
|
battery_power_pin: GPIO5
|
||||||
main_power_pin: GPIO2
|
main_power_pin: GPIO2
|
||||||
update_interval: 10s
|
# update_interval: 10s
|
||||||
battery_voltage:
|
# battery_voltage:
|
||||||
name: "${name} Battery"
|
# name: "${name} Battery"
|
||||||
|
|
||||||
# 0x44 SHT30
|
# 0x44 SHT30
|
||||||
# 0x50
|
# 0x50
|
||||||
@@ -142,7 +123,7 @@ font:
|
|||||||
display:
|
display:
|
||||||
- platform: it8951e
|
- platform: it8951e
|
||||||
id: m5paper_display
|
id: m5paper_display
|
||||||
display_cs_pin: GPIO15
|
cs_pin: GPIO15
|
||||||
reset_pin: GPIO23
|
reset_pin: GPIO23
|
||||||
busy_pin: GPIO27
|
busy_pin: GPIO27
|
||||||
rotation: 90
|
rotation: 90
|
||||||
@@ -169,10 +150,10 @@ touchscreen:
|
|||||||
sensor:
|
sensor:
|
||||||
- platform: sht3xd
|
- platform: sht3xd
|
||||||
temperature:
|
temperature:
|
||||||
name: "${name} Temperature"
|
name: Temperature
|
||||||
id: current_temperature
|
id: current_temperature
|
||||||
humidity:
|
humidity:
|
||||||
name: "${name} Humidity"
|
name: Humidity
|
||||||
address: 0x44
|
address: 0x44
|
||||||
update_interval: 60s
|
update_interval: 60s
|
||||||
|
|
||||||
|
|||||||
@@ -1,21 +1,26 @@
|
|||||||
substitutions:
|
substitutions:
|
||||||
device: mains-power
|
device: mains-power
|
||||||
name: Mains Power
|
name: Mains Power
|
||||||
name_1: Mains
|
|
||||||
area: Room
|
area: Room
|
||||||
comment: "${area} | Mains Power Monitoring"
|
comment: "${area} | Mains Power Monitoring"
|
||||||
|
|
||||||
esphome:
|
esphome:
|
||||||
name: mcu-${device}
|
name: mcu-${device}
|
||||||
|
friendly_name: ${name}
|
||||||
area: ${area}
|
area: ${area}
|
||||||
comment: ${comment}
|
comment: ${comment}
|
||||||
|
areas:
|
||||||
|
- id: local_area
|
||||||
|
name: ${area}
|
||||||
|
devices:
|
||||||
|
- id: mains
|
||||||
|
name: Mains
|
||||||
|
area_id: local_area
|
||||||
|
|
||||||
esp32:
|
esp32:
|
||||||
board: m5stack-atom
|
variant: esp32
|
||||||
framework:
|
framework:
|
||||||
type: esp-idf
|
type: esp-idf
|
||||||
version: 5.3.2
|
|
||||||
platform_version: 53.03.11
|
|
||||||
|
|
||||||
packages:
|
packages:
|
||||||
common: !include common/common.yaml
|
common: !include common/common.yaml
|
||||||
@@ -48,7 +53,7 @@ uart:
|
|||||||
|
|
||||||
sensor:
|
sensor:
|
||||||
# - platform: template
|
# - platform: template
|
||||||
# name: "${name_1} Total Daily Energy"
|
# name: Total Daily Energy
|
||||||
# id: mains_daily_energy
|
# id: mains_daily_energy
|
||||||
# lambda: |-
|
# lambda: |-
|
||||||
# return (id(mains_l1_total_daily_energy).state + id(mains_l3_total_daily_energy).state + id(mains_l3_total_daily_energy).state);
|
# return (id(mains_l1_total_daily_energy).state + id(mains_l3_total_daily_energy).state + id(mains_l3_total_daily_energy).state);
|
||||||
@@ -58,22 +63,28 @@ sensor:
|
|||||||
address: 10
|
address: 10
|
||||||
id: pzemac_l1
|
id: pzemac_l1
|
||||||
current:
|
current:
|
||||||
name: "${name_1} L1 Current"
|
name: L1 Current
|
||||||
|
device_id: mains
|
||||||
voltage:
|
voltage:
|
||||||
name: "${name_1} L1 Voltage"
|
name: L1 Voltage
|
||||||
|
device_id: mains
|
||||||
energy:
|
energy:
|
||||||
name: "${name_1} L1 Energy"
|
name: L1 Energy
|
||||||
id: mains_l1_energy
|
id: mains_l1_energy
|
||||||
|
device_id: mains
|
||||||
power:
|
power:
|
||||||
name: "${name_1} L1 Power"
|
name: L1 Power
|
||||||
id: mains_l1_power
|
id: mains_l1_power
|
||||||
|
device_id: mains
|
||||||
frequency:
|
frequency:
|
||||||
name: "${name_1} L1 Frequency"
|
name: L1 Frequency
|
||||||
|
device_id: mains
|
||||||
power_factor:
|
power_factor:
|
||||||
name: "${name_1} L1 Power Factor"
|
name: L1 Power Factor
|
||||||
|
device_id: mains
|
||||||
update_interval: 20s
|
update_interval: 20s
|
||||||
# - platform: total_daily_energy
|
# - platform: total_daily_energy
|
||||||
# name: "${name_1} L1 Total Daily Energy"
|
# name: L1 Total Daily Energy
|
||||||
# power_id: mains_l1_power
|
# power_id: mains_l1_power
|
||||||
# id: mains_l1_total_daily_energy
|
# id: mains_l1_total_daily_energy
|
||||||
# filters:
|
# filters:
|
||||||
@@ -81,7 +92,7 @@ sensor:
|
|||||||
# unit_of_measurement: kWh
|
# unit_of_measurement: kWh
|
||||||
# icon: mdi:counter
|
# icon: mdi:counter
|
||||||
# - platform: integration
|
# - platform: integration
|
||||||
# name: "${name_1} L1 Energy Meter"
|
# name: L1 Energy Meter
|
||||||
# sensor: mains_l1_power
|
# sensor: mains_l1_power
|
||||||
# time_unit: h
|
# time_unit: h
|
||||||
# filters:
|
# filters:
|
||||||
@@ -93,22 +104,28 @@ sensor:
|
|||||||
address: 11
|
address: 11
|
||||||
id: pzemac_l2
|
id: pzemac_l2
|
||||||
current:
|
current:
|
||||||
name: "${name_1} L2 Current"
|
name: L2 Current
|
||||||
|
device_id: mains
|
||||||
voltage:
|
voltage:
|
||||||
name: "${name_1} L2 Voltage"
|
name: L2 Voltage
|
||||||
|
device_id: mains
|
||||||
energy:
|
energy:
|
||||||
name: "${name_1} L2 Energy"
|
name: L2 Energy
|
||||||
id: mains_l2_energy
|
id: mains_l2_energy
|
||||||
|
device_id: mains
|
||||||
power:
|
power:
|
||||||
name: "${name_1} L2 Power"
|
name: L2 Power
|
||||||
id: mains_l2_power
|
id: mains_l2_power
|
||||||
|
device_id: mains
|
||||||
frequency:
|
frequency:
|
||||||
name: "${name_1} L2 Frequency"
|
name: L2 Frequency
|
||||||
|
device_id: mains
|
||||||
power_factor:
|
power_factor:
|
||||||
name: "${name_1} L2 Power Factor"
|
name: L2 Power Factor
|
||||||
|
device_id: mains
|
||||||
update_interval: 20s
|
update_interval: 20s
|
||||||
# - platform: total_daily_energy
|
# - platform: total_daily_energy
|
||||||
# name: "${name_1} L2 Total Daily Energy"
|
# name: L2 Total Daily Energy
|
||||||
# id: mains_l2_total_daily_energy
|
# id: mains_l2_total_daily_energy
|
||||||
# power_id: mains_l2_power
|
# power_id: mains_l2_power
|
||||||
# filters:
|
# filters:
|
||||||
@@ -116,7 +133,7 @@ sensor:
|
|||||||
# unit_of_measurement: kWh
|
# unit_of_measurement: kWh
|
||||||
# icon: mdi:counter
|
# icon: mdi:counter
|
||||||
# - platform: integration
|
# - platform: integration
|
||||||
# name: "${name_1} L2 Energy Meter"
|
# name: L2 Energy Meter
|
||||||
# sensor: mains_l2_power
|
# sensor: mains_l2_power
|
||||||
# time_unit: h
|
# time_unit: h
|
||||||
# filters:
|
# filters:
|
||||||
@@ -128,22 +145,28 @@ sensor:
|
|||||||
address: 12
|
address: 12
|
||||||
id: pzemac_l3
|
id: pzemac_l3
|
||||||
current:
|
current:
|
||||||
name: "${name_1} L3 Current"
|
name: L3 Current
|
||||||
|
device_id: mains
|
||||||
voltage:
|
voltage:
|
||||||
name: "${name_1} L3 Voltage"
|
name: L3 Voltage
|
||||||
|
device_id: mains
|
||||||
energy:
|
energy:
|
||||||
name: "${name_1} L3 Energy"
|
name: L3 Energy
|
||||||
id: mains_l3_energy
|
id: mains_l3_energy
|
||||||
|
device_id: mains
|
||||||
power:
|
power:
|
||||||
name: "${name_1} L3 Power"
|
name: L3 Power
|
||||||
id: mains_l3_power
|
id: mains_l3_power
|
||||||
|
device_id: mains
|
||||||
frequency:
|
frequency:
|
||||||
name: "${name_1} L3 Frequency"
|
name: L3 Frequency
|
||||||
|
device_id: mains
|
||||||
power_factor:
|
power_factor:
|
||||||
name: "${name_1} L3 Power Factor"
|
name: L3 Power Factor
|
||||||
|
device_id: mains
|
||||||
update_interval: 20s
|
update_interval: 20s
|
||||||
# - platform: total_daily_energy
|
# - platform: total_daily_energy
|
||||||
# name: "${name_1} L3 Total Daily Energy"
|
# name: L3 Total Daily Energy
|
||||||
# power_id: mains_l3_power
|
# power_id: mains_l3_power
|
||||||
# id: mains_l3_total_daily_energy
|
# id: mains_l3_total_daily_energy
|
||||||
# filters:
|
# filters:
|
||||||
@@ -151,7 +174,7 @@ sensor:
|
|||||||
# unit_of_measurement: kWh
|
# unit_of_measurement: kWh
|
||||||
# icon: mdi:counter
|
# icon: mdi:counter
|
||||||
# - platform: integration
|
# - platform: integration
|
||||||
# name: "${name_1} L3 Energy Meter"
|
# name: L3 Energy Meter"
|
||||||
# sensor: mains_l3_power
|
# sensor: mains_l3_power
|
||||||
# time_unit: h
|
# time_unit: h
|
||||||
# filters:
|
# filters:
|
||||||
@@ -160,8 +183,9 @@ sensor:
|
|||||||
# icon: mdi:counter
|
# icon: mdi:counter
|
||||||
# TOTAL: L1+L2+L3
|
# TOTAL: L1+L2+L3
|
||||||
- platform: template
|
- platform: template
|
||||||
name: "${name_1} Power"
|
name: Power
|
||||||
id: "total_mains_power"
|
id: total_mains_power
|
||||||
|
device_id: mains
|
||||||
device_class: power
|
device_class: power
|
||||||
state_class: measurement
|
state_class: measurement
|
||||||
unit_of_measurement: W
|
unit_of_measurement: W
|
||||||
@@ -169,8 +193,8 @@ sensor:
|
|||||||
lambda: |-
|
lambda: |-
|
||||||
return id(mains_l1_power).state + id(mains_l2_power).state + id(mains_l3_power).state ;
|
return id(mains_l1_power).state + id(mains_l2_power).state + id(mains_l3_power).state ;
|
||||||
# - platform: template
|
# - platform: template
|
||||||
# name: "${name_1} Total Daily Energy"
|
# name: Total Daily Energy
|
||||||
# id: "mains_total_daily_energy"
|
# id: mains_total_daily_energy
|
||||||
# icon: mdi:counter
|
# icon: mdi:counter
|
||||||
# device_class: energy
|
# device_class: energy
|
||||||
# # state_class: measurement
|
# # state_class: measurement
|
||||||
@@ -180,7 +204,8 @@ sensor:
|
|||||||
# lambda: |-
|
# lambda: |-
|
||||||
# return id(mains_l1_total_daily_energy).state + id(mains_l2_total_daily_energy).state + id(mains_l3_total_daily_energy).state ;
|
# return id(mains_l1_total_daily_energy).state + id(mains_l2_total_daily_energy).state + id(mains_l3_total_daily_energy).state ;
|
||||||
- platform: template
|
- platform: template
|
||||||
name: "${name_1} Energy"
|
name: Energy
|
||||||
|
device_id: mains
|
||||||
icon: mdi:counter
|
icon: mdi:counter
|
||||||
device_class: energy
|
device_class: energy
|
||||||
state_class: total_increasing
|
state_class: total_increasing
|
||||||
@@ -193,7 +218,8 @@ sensor:
|
|||||||
|
|
||||||
button:
|
button:
|
||||||
- platform: template
|
- platform: template
|
||||||
name: "${name_1} Energy Zero"
|
name: Energy Zero
|
||||||
|
device_id: mains
|
||||||
on_press:
|
on_press:
|
||||||
- pzemac.reset_energy: pzemac_l1
|
- pzemac.reset_energy: pzemac_l1
|
||||||
- pzemac.reset_energy: pzemac_l2
|
- pzemac.reset_energy: pzemac_l2
|
||||||
|
|||||||
@@ -21,9 +21,11 @@ esphome:
|
|||||||
- switch.turn_on: screen_power
|
- switch.turn_on: screen_power
|
||||||
|
|
||||||
esp32:
|
esp32:
|
||||||
board: nodemcu-32s
|
variant: esp32
|
||||||
framework:
|
framework:
|
||||||
type: esp-idf
|
type: esp-idf
|
||||||
|
advanced:
|
||||||
|
minimum_chip_revision: "3.0"
|
||||||
|
|
||||||
external_components:
|
external_components:
|
||||||
- source:
|
- source:
|
||||||
@@ -31,10 +33,6 @@ external_components:
|
|||||||
url: https://github.com/sairon/esphome-nspanel-lovelace-ui
|
url: https://github.com/sairon/esphome-nspanel-lovelace-ui
|
||||||
ref: dev
|
ref: dev
|
||||||
components: [nspanel_lovelace]
|
components: [nspanel_lovelace]
|
||||||
- source: github://pr#7942
|
|
||||||
components: adc
|
|
||||||
refresh: 0s
|
|
||||||
- source: components
|
|
||||||
|
|
||||||
packages:
|
packages:
|
||||||
common: !include common/common.yaml
|
common: !include common/common.yaml
|
||||||
|
|||||||
@@ -31,11 +31,11 @@ esphome:
|
|||||||
# entity_id: automation.nspanel_send_weather_to_nspanel
|
# entity_id: automation.nspanel_send_weather_to_nspanel
|
||||||
|
|
||||||
esp32:
|
esp32:
|
||||||
board: nodemcu-32s
|
variant: esp32
|
||||||
framework:
|
framework:
|
||||||
type: esp-idf
|
type: esp-idf
|
||||||
version: 5.3.2
|
advanced:
|
||||||
platform_version: 53.03.11
|
minimum_chip_revision: "3.0"
|
||||||
|
|
||||||
external_components:
|
external_components:
|
||||||
# - source:
|
# - source:
|
||||||
@@ -48,12 +48,9 @@ external_components:
|
|||||||
type: git
|
type: git
|
||||||
url: https://github.com/olicooper/esphome-nspanel-lovelace-native
|
url: https://github.com/olicooper/esphome-nspanel-lovelace-native
|
||||||
ref: dev
|
ref: dev
|
||||||
refresh: 3h
|
|
||||||
components: [nspanel_lovelace]
|
|
||||||
- source: github://pr#7942
|
|
||||||
components: adc
|
|
||||||
refresh: 0s
|
refresh: 0s
|
||||||
- source: components
|
components: [nspanel_lovelace]
|
||||||
|
# - source: components
|
||||||
|
|
||||||
packages:
|
packages:
|
||||||
common: !include common/common.yaml
|
common: !include common/common.yaml
|
||||||
@@ -64,6 +61,8 @@ packages:
|
|||||||
# local: true
|
# local: true
|
||||||
|
|
||||||
api:
|
api:
|
||||||
|
homeassistant_services: true
|
||||||
|
homeassistant_states: true
|
||||||
services:
|
services:
|
||||||
# https://github.com/granadaxronos/120-SONG_NOKIA_RTTTL_RINGTONE_PLAYER_FOR_ARDUINO_UNO/blob/master/RTTTL_PLAYER/songs.h
|
# https://github.com/granadaxronos/120-SONG_NOKIA_RTTTL_RINGTONE_PLAYER_FOR_ARDUINO_UNO/blob/master/RTTTL_PLAYER/songs.h
|
||||||
- service: play_rtttl
|
- service: play_rtttl
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
substitutions:
|
substitutions:
|
||||||
device: nspanel-fireplace
|
device: nspanel-fireplace
|
||||||
name: Fireplace NSPanel
|
name: Fireplace NSPanel
|
||||||
area: Living Room / Kitchen
|
area: Living Room & Kitchen
|
||||||
comment: "${area}, Fireplace | NSPanel"
|
comment: "${area}, Fireplace | NSPanel"
|
||||||
panel_recv_topic: "tele/${device}/RESULT"
|
panel_recv_topic: "tele/${device}/RESULT"
|
||||||
panel_send_topic: "cmnd/${device}/CustomSend"
|
panel_send_topic: "cmnd/${device}/CustomSend"
|
||||||
@@ -19,9 +19,11 @@ esphome:
|
|||||||
- switch.turn_on: screen_power
|
- switch.turn_on: screen_power
|
||||||
|
|
||||||
esp32:
|
esp32:
|
||||||
board: nodemcu-32s
|
variant: esp32
|
||||||
framework:
|
framework:
|
||||||
type: esp-idf
|
type: esp-idf
|
||||||
|
advanced:
|
||||||
|
minimum_chip_revision: "3.0"
|
||||||
|
|
||||||
external_components:
|
external_components:
|
||||||
- source:
|
- source:
|
||||||
@@ -29,10 +31,6 @@ external_components:
|
|||||||
url: https://github.com/sairon/esphome-nspanel-lovelace-ui
|
url: https://github.com/sairon/esphome-nspanel-lovelace-ui
|
||||||
ref: dev
|
ref: dev
|
||||||
components: [nspanel_lovelace]
|
components: [nspanel_lovelace]
|
||||||
- source: github://pr#7942
|
|
||||||
components: adc
|
|
||||||
refresh: 0s
|
|
||||||
- source: components
|
|
||||||
|
|
||||||
packages:
|
packages:
|
||||||
common: !include common/common.yaml
|
common: !include common/common.yaml
|
||||||
@@ -190,6 +188,9 @@ binary_sensor:
|
|||||||
inverted: true
|
inverted: true
|
||||||
on_click:
|
on_click:
|
||||||
# - switch.toggle: relay_1
|
# - switch.toggle: relay_1
|
||||||
|
- min_length: 50ms
|
||||||
|
max_length: 350ms
|
||||||
|
then:
|
||||||
- homeassistant.service:
|
- homeassistant.service:
|
||||||
service: light.toggle
|
service: light.toggle
|
||||||
data:
|
data:
|
||||||
@@ -198,6 +199,17 @@ binary_sensor:
|
|||||||
topic: $panel_recv_topic
|
topic: $panel_recv_topic
|
||||||
payload: |-
|
payload: |-
|
||||||
root["CustomRecv"] = "event,buttonPress2,navigate.cardGrid_main,button";
|
root["CustomRecv"] = "event,buttonPress2,navigate.cardGrid_main,button";
|
||||||
|
- min_length: 500ms
|
||||||
|
max_length: 2000ms
|
||||||
|
then:
|
||||||
|
- homeassistant.service:
|
||||||
|
service: light.toggle
|
||||||
|
data:
|
||||||
|
entity_id: light.worktop_lights
|
||||||
|
- mqtt.publish_json:
|
||||||
|
topic: $panel_recv_topic
|
||||||
|
payload: |-
|
||||||
|
root["CustomRecv"] = "event,buttonPress2,navigate.cardGrid_kitchen,button";
|
||||||
|
|
||||||
- platform: gpio
|
- platform: gpio
|
||||||
name: Right Button
|
name: Right Button
|
||||||
@@ -206,6 +218,9 @@ binary_sensor:
|
|||||||
inverted: true
|
inverted: true
|
||||||
on_click:
|
on_click:
|
||||||
# - switch.toggle: relay_2
|
# - switch.toggle: relay_2
|
||||||
|
- min_length: 50ms
|
||||||
|
max_length: 350ms
|
||||||
|
then:
|
||||||
- homeassistant.service:
|
- homeassistant.service:
|
||||||
service: light.toggle
|
service: light.toggle
|
||||||
data:
|
data:
|
||||||
@@ -214,7 +229,17 @@ binary_sensor:
|
|||||||
topic: $panel_recv_topic
|
topic: $panel_recv_topic
|
||||||
payload: |-
|
payload: |-
|
||||||
root["CustomRecv"] = "event,buttonPress2,navigate.cardGrid_main,button";
|
root["CustomRecv"] = "event,buttonPress2,navigate.cardGrid_main,button";
|
||||||
|
- min_length: 500ms
|
||||||
|
max_length: 2000ms
|
||||||
|
then:
|
||||||
|
- homeassistant.service:
|
||||||
|
service: light.toggle
|
||||||
|
data:
|
||||||
|
entity_id: light.mcu_kitchen_stove
|
||||||
|
- mqtt.publish_json:
|
||||||
|
topic: $panel_recv_topic
|
||||||
|
payload: |-
|
||||||
|
root["CustomRecv"] = "event,buttonPress2,navigate.cardGrid_kitchen,button";
|
||||||
output:
|
output:
|
||||||
- platform: ledc
|
- platform: ledc
|
||||||
id: buzzer_out
|
id: buzzer_out
|
||||||
|
|||||||
@@ -20,9 +20,11 @@ esphome:
|
|||||||
- switch.turn_on: screen_power
|
- switch.turn_on: screen_power
|
||||||
|
|
||||||
esp32:
|
esp32:
|
||||||
board: nodemcu-32s
|
variant: esp32
|
||||||
framework:
|
framework:
|
||||||
type: esp-idf
|
type: esp-idf
|
||||||
|
advanced:
|
||||||
|
minimum_chip_revision: "3.0"
|
||||||
|
|
||||||
external_components:
|
external_components:
|
||||||
- source:
|
- source:
|
||||||
@@ -30,10 +32,6 @@ external_components:
|
|||||||
url: https://github.com/sairon/esphome-nspanel-lovelace-ui
|
url: https://github.com/sairon/esphome-nspanel-lovelace-ui
|
||||||
ref: dev
|
ref: dev
|
||||||
components: [nspanel_lovelace]
|
components: [nspanel_lovelace]
|
||||||
- source: github://pr#7942
|
|
||||||
components: adc
|
|
||||||
refresh: 0s
|
|
||||||
- source: components
|
|
||||||
|
|
||||||
packages:
|
packages:
|
||||||
common: !include common/common.yaml
|
common: !include common/common.yaml
|
||||||
@@ -255,6 +253,7 @@ light:
|
|||||||
name: Light
|
name: Light
|
||||||
id: light_1
|
id: light_1
|
||||||
output: relay_1
|
output: relay_1
|
||||||
|
restore_mode: RESTORE_DEFAULT_OFF
|
||||||
# # - platform: binary
|
# # - platform: binary
|
||||||
# # name: Relay 2
|
# # name: Relay 2
|
||||||
# # output: relay_2
|
# # output: relay_2
|
||||||
|
|||||||
@@ -20,11 +20,12 @@ esphome:
|
|||||||
- switch.turn_on: screen_power
|
- switch.turn_on: screen_power
|
||||||
|
|
||||||
esp32:
|
esp32:
|
||||||
board: nodemcu-32s
|
variant: esp32
|
||||||
framework:
|
framework:
|
||||||
type: esp-idf
|
type: esp-idf
|
||||||
wifi:
|
advanced:
|
||||||
use_address: 10.17.241.212
|
enable_lwip_mdns_queries: true
|
||||||
|
minimum_chip_revision: "3.0"
|
||||||
|
|
||||||
external_components:
|
external_components:
|
||||||
- source:
|
- source:
|
||||||
@@ -32,17 +33,27 @@ external_components:
|
|||||||
url: https://github.com/sairon/esphome-nspanel-lovelace-ui
|
url: https://github.com/sairon/esphome-nspanel-lovelace-ui
|
||||||
ref: dev
|
ref: dev
|
||||||
components: [nspanel_lovelace]
|
components: [nspanel_lovelace]
|
||||||
- source: github://pr#7942
|
|
||||||
components: adc
|
|
||||||
refresh: 0s
|
|
||||||
- source: github://pr#8325
|
|
||||||
components: mqtt
|
|
||||||
refresh: 0s
|
|
||||||
- source: components
|
|
||||||
|
|
||||||
packages:
|
packages:
|
||||||
common: !include common/common.yaml
|
common: !include common/common.yaml
|
||||||
|
|
||||||
|
script:
|
||||||
|
- id: geiger_click
|
||||||
|
mode: restart
|
||||||
|
then:
|
||||||
|
- output.turn_on: buzzer_out
|
||||||
|
- output.ledc.set_frequency:
|
||||||
|
id: buzzer_out
|
||||||
|
frequency: 4000Hz
|
||||||
|
- output.set_level:
|
||||||
|
id: buzzer_out
|
||||||
|
level: 50%
|
||||||
|
- delay: 1ms
|
||||||
|
- output.turn_off: buzzer_out
|
||||||
|
- delay: !lambda |-
|
||||||
|
return esphome::random_uint32() % 450 + 50;
|
||||||
|
- script.execute: geiger_click
|
||||||
|
|
||||||
api:
|
api:
|
||||||
# https://github.com/granadaxronos/120-SONG_NOKIA_RTTTL_RINGTONE_PLAYER_FOR_ARDUINO_UNO/blob/master/RTTTL_PLAYER/songs.h
|
# https://github.com/granadaxronos/120-SONG_NOKIA_RTTTL_RINGTONE_PLAYER_FOR_ARDUINO_UNO/blob/master/RTTTL_PLAYER/songs.h
|
||||||
#
|
#
|
||||||
@@ -72,6 +83,7 @@ api:
|
|||||||
|
|
||||||
- service: update_tft
|
- service: update_tft
|
||||||
then:
|
then:
|
||||||
|
- logger.log: "tft updating from: ${tft_url}"
|
||||||
- lambda: |-
|
- lambda: |-
|
||||||
id(nspanel_id).upload_tft("${tft_url}");
|
id(nspanel_id).upload_tft("${tft_url}");
|
||||||
|
|
||||||
@@ -281,6 +293,7 @@ light:
|
|||||||
name: Light
|
name: Light
|
||||||
id: light_1
|
id: light_1
|
||||||
output: relay_1
|
output: relay_1
|
||||||
|
restore_mode: RESTORE_DEFAULT_OFF
|
||||||
# # - platform: binary
|
# # - platform: binary
|
||||||
# # name: Relay 2
|
# # name: Relay 2
|
||||||
# # output: relay_2
|
# # output: relay_2
|
||||||
@@ -304,6 +317,13 @@ switch:
|
|||||||
number: 4
|
number: 4
|
||||||
inverted: true
|
inverted: true
|
||||||
restore_mode: ALWAYS_ON
|
restore_mode: ALWAYS_ON
|
||||||
|
- platform: template
|
||||||
|
name: "Geiger Counter"
|
||||||
|
optimistic: True
|
||||||
|
turn_on_action:
|
||||||
|
- script.execute: geiger_click
|
||||||
|
turn_off_action:
|
||||||
|
- script.stop: geiger_click
|
||||||
|
|
||||||
rtttl:
|
rtttl:
|
||||||
id: buzzer
|
id: buzzer
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
substitutions:
|
substitutions:
|
||||||
device: nspanel-patio
|
device: nspanel-patio
|
||||||
name: Patio NSPanel
|
name: Patio NSPanel
|
||||||
area: Living Room / Kitchen
|
area: Living Room & Kitchen
|
||||||
comment: "${area}, Patio | NSPanel"
|
comment: "${area}, Patio | NSPanel"
|
||||||
panel_recv_topic: "tele/${device}/RESULT"
|
panel_recv_topic: "tele/${device}/RESULT"
|
||||||
panel_send_topic: "cmnd/${device}/CustomSend"
|
panel_send_topic: "cmnd/${device}/CustomSend"
|
||||||
@@ -19,9 +19,11 @@ esphome:
|
|||||||
- switch.turn_on: screen_power
|
- switch.turn_on: screen_power
|
||||||
|
|
||||||
esp32:
|
esp32:
|
||||||
board: nodemcu-32s
|
variant: esp32
|
||||||
framework:
|
framework:
|
||||||
type: esp-idf
|
type: esp-idf
|
||||||
|
advanced:
|
||||||
|
minimum_chip_revision: "3.0"
|
||||||
|
|
||||||
external_components:
|
external_components:
|
||||||
- source:
|
- source:
|
||||||
@@ -29,9 +31,6 @@ external_components:
|
|||||||
url: https://github.com/sairon/esphome-nspanel-lovelace-ui
|
url: https://github.com/sairon/esphome-nspanel-lovelace-ui
|
||||||
ref: dev
|
ref: dev
|
||||||
components: [nspanel_lovelace]
|
components: [nspanel_lovelace]
|
||||||
- source: github://pr#7942
|
|
||||||
components: adc
|
|
||||||
refresh: 0s
|
|
||||||
- source: components
|
- source: components
|
||||||
|
|
||||||
packages:
|
packages:
|
||||||
|
|||||||
@@ -14,12 +14,9 @@ esphome:
|
|||||||
|
|
||||||
|
|
||||||
esp32:
|
esp32:
|
||||||
board: esp32-c3-devkitm-1
|
|
||||||
variant: esp32c3
|
variant: esp32c3
|
||||||
framework:
|
framework:
|
||||||
type: esp-idf
|
type: esp-idf
|
||||||
version: 5.3.2
|
|
||||||
platform_version: 53.03.11
|
|
||||||
|
|
||||||
packages:
|
packages:
|
||||||
common: !include common/common.yaml
|
common: !include common/common.yaml
|
||||||
|
|||||||
@@ -29,11 +29,9 @@ esphome:
|
|||||||
|
|
||||||
|
|
||||||
esp32:
|
esp32:
|
||||||
board: m5stack-atom
|
variant: esp32
|
||||||
framework:
|
framework:
|
||||||
type: esp-idf
|
type: esp-idf
|
||||||
version: 5.3.1
|
|
||||||
platform_version: 6.9.0
|
|
||||||
|
|
||||||
packages:
|
packages:
|
||||||
common: !include common/common.yaml
|
common: !include common/common.yaml
|
||||||
|
|||||||
@@ -1,28 +1,20 @@
|
|||||||
substitutions:
|
substitutions:
|
||||||
device: pow-2
|
device: pow-dishwasher
|
||||||
name: POW 2
|
name: Dishwasher POW
|
||||||
comment: "DEV"
|
comment: Living Room & Kitchen
|
||||||
update_interval: 10s
|
update_interval: 10s
|
||||||
|
|
||||||
esphome:
|
esphome:
|
||||||
name: mcu-${device}
|
name: mcu-${device}
|
||||||
friendly_name: ${name}
|
friendly_name: ${name}
|
||||||
comment: ${comment}
|
comment: ${comment}
|
||||||
on_boot: # Set the initial state of the template switch to the actual relay state. This will NOT change the state.
|
|
||||||
priority: 250.0 # Wait until WiFi is connected to allow the sensor some time to settle
|
|
||||||
then:
|
|
||||||
- if:
|
|
||||||
condition:
|
|
||||||
lambda: 'return id(v_sensor).state > 10;'
|
|
||||||
then:
|
|
||||||
- switch.turn_on: relay_1
|
|
||||||
else:
|
|
||||||
- switch.turn_off: relay_1
|
|
||||||
|
|
||||||
esp32:
|
esp32:
|
||||||
board: nodemcu-32s
|
variant: esp32
|
||||||
framework:
|
framework:
|
||||||
type: esp-idf
|
type: esp-idf
|
||||||
|
advanced:
|
||||||
|
minimum_chip_revision: "3.1"
|
||||||
|
|
||||||
interval:
|
interval:
|
||||||
- interval: 30s
|
- interval: 30s
|
||||||
@@ -79,7 +71,7 @@ binary_sensor:
|
|||||||
lambda: |-
|
lambda: |-
|
||||||
if (isnan(id(w_sensor).state)) {
|
if (isnan(id(w_sensor).state)) {
|
||||||
return {};
|
return {};
|
||||||
} else if (id(w_sensor).state > 4) {
|
} else if (id(w_sensor).state > 2) {
|
||||||
// Running
|
// Running
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
@@ -173,21 +165,13 @@ switch:
|
|||||||
- platform: template
|
- platform: template
|
||||||
name: Relay
|
name: Relay
|
||||||
optimistic: true
|
optimistic: true
|
||||||
|
restore_mode: ALWAYS_ON
|
||||||
id: relay_1
|
id: relay_1
|
||||||
turn_off_action:
|
|
||||||
- switch.turn_on: relay_off
|
|
||||||
turn_on_action:
|
turn_on_action:
|
||||||
- switch.turn_on: relay_on
|
- switch.turn_on: relay_on
|
||||||
- platform: gpio
|
turn_off_action:
|
||||||
restore_mode: ALWAYS_OFF
|
- switch.turn_on: relay_off
|
||||||
internal: true
|
|
||||||
id: relay_off
|
|
||||||
pin: 4
|
|
||||||
on_turn_on:
|
|
||||||
- delay: 500ms
|
|
||||||
- switch.turn_off: relay_off # bi-stable relay so no need to keep on
|
|
||||||
- light.turn_off: switch_led
|
|
||||||
interlock: [relay_on]
|
|
||||||
- platform: gpio
|
- platform: gpio
|
||||||
restore_mode: ALWAYS_OFF
|
restore_mode: ALWAYS_OFF
|
||||||
internal: true
|
internal: true
|
||||||
@@ -199,7 +183,16 @@ switch:
|
|||||||
- light.turn_on: switch_led
|
- light.turn_on: switch_led
|
||||||
interlock: [relay_off]
|
interlock: [relay_off]
|
||||||
|
|
||||||
|
- platform: gpio
|
||||||
|
restore_mode: ALWAYS_OFF
|
||||||
|
internal: true
|
||||||
|
id: relay_off
|
||||||
|
pin: 4
|
||||||
|
on_turn_on:
|
||||||
|
- delay: 500ms
|
||||||
|
- switch.turn_off: relay_off # bi-stable relay so no need to keep on
|
||||||
|
- light.turn_off: switch_led
|
||||||
|
interlock: [relay_on]
|
||||||
|
|
||||||
time:
|
time:
|
||||||
- platform: homeassistant
|
- !include common/time/homeassistant.yaml
|
||||||
id: ha_time
|
|
||||||
timezone: Europe/Bratislava
|
|
||||||
@@ -1,28 +1,20 @@
|
|||||||
substitutions:
|
substitutions:
|
||||||
device: pow-1
|
device: pow-washer
|
||||||
name: POW 1
|
name: Washer POW
|
||||||
comment: "DEV"
|
comment: Washroom
|
||||||
update_interval: 10s
|
update_interval: 10s
|
||||||
|
|
||||||
esphome:
|
esphome:
|
||||||
name: mcu-${device}
|
name: mcu-${device}
|
||||||
friendly_name: ${name}
|
friendly_name: ${name}
|
||||||
comment: ${comment}
|
comment: ${comment}
|
||||||
on_boot: # Set the initial state of the template switch to the actual relay state. This will NOT change the state.
|
|
||||||
priority: 250.0 # Wait until WiFi is connected to allow the sensor some time to settle
|
|
||||||
then:
|
|
||||||
- if:
|
|
||||||
condition:
|
|
||||||
lambda: 'return id(v_sensor).state > 10;'
|
|
||||||
then:
|
|
||||||
- switch.turn_on: relay_1
|
|
||||||
else:
|
|
||||||
- switch.turn_off: relay_1
|
|
||||||
|
|
||||||
esp32:
|
esp32:
|
||||||
board: nodemcu-32s
|
variant: esp32
|
||||||
framework:
|
framework:
|
||||||
type: esp-idf
|
type: esp-idf
|
||||||
|
advanced:
|
||||||
|
minimum_chip_revision: "3.1"
|
||||||
|
|
||||||
interval:
|
interval:
|
||||||
- interval: 30s
|
- interval: 30s
|
||||||
@@ -173,21 +165,13 @@ switch:
|
|||||||
- platform: template
|
- platform: template
|
||||||
name: Relay
|
name: Relay
|
||||||
optimistic: true
|
optimistic: true
|
||||||
|
restore_mode: ALWAYS_ON
|
||||||
id: relay_1
|
id: relay_1
|
||||||
turn_off_action:
|
|
||||||
- switch.turn_on: relay_off
|
|
||||||
turn_on_action:
|
turn_on_action:
|
||||||
- switch.turn_on: relay_on
|
- switch.turn_on: relay_on
|
||||||
- platform: gpio
|
turn_off_action:
|
||||||
restore_mode: ALWAYS_OFF
|
- switch.turn_on: relay_off
|
||||||
internal: true
|
|
||||||
id: relay_off
|
|
||||||
pin: 4
|
|
||||||
on_turn_on:
|
|
||||||
- delay: 500ms
|
|
||||||
- switch.turn_off: relay_off # bi-stable relay so no need to keep on
|
|
||||||
- light.turn_off: switch_led
|
|
||||||
interlock: [relay_on]
|
|
||||||
- platform: gpio
|
- platform: gpio
|
||||||
restore_mode: ALWAYS_OFF
|
restore_mode: ALWAYS_OFF
|
||||||
internal: true
|
internal: true
|
||||||
@@ -199,7 +183,16 @@ switch:
|
|||||||
- light.turn_on: switch_led
|
- light.turn_on: switch_led
|
||||||
interlock: [relay_off]
|
interlock: [relay_off]
|
||||||
|
|
||||||
|
- platform: gpio
|
||||||
|
restore_mode: ALWAYS_OFF
|
||||||
|
internal: true
|
||||||
|
id: relay_off
|
||||||
|
pin: 4
|
||||||
|
on_turn_on:
|
||||||
|
- delay: 500ms
|
||||||
|
- switch.turn_off: relay_off # bi-stable relay so no need to keep on
|
||||||
|
- light.turn_off: switch_led
|
||||||
|
interlock: [relay_on]
|
||||||
|
|
||||||
time:
|
time:
|
||||||
- platform: homeassistant
|
- !include common/time/homeassistant.yaml
|
||||||
id: ha_time
|
|
||||||
timezone: Europe/Bratislava
|
|
||||||
386
mcu-rfid-reader.yaml
Normal file
386
mcu-rfid-reader.yaml
Normal file
@@ -0,0 +1,386 @@
|
|||||||
|
substitutions:
|
||||||
|
device: rfid-reader
|
||||||
|
name: RFID Reader
|
||||||
|
area: DEV
|
||||||
|
comment: "${area} | RFID Reader"
|
||||||
|
|
||||||
|
esphome:
|
||||||
|
name: mcu-${device}
|
||||||
|
friendly_name: ${name}
|
||||||
|
area: ${area}
|
||||||
|
comment: ${comment}
|
||||||
|
# on_boot:
|
||||||
|
# priority: -10
|
||||||
|
# then:
|
||||||
|
# - wait_until:
|
||||||
|
# api.connected:
|
||||||
|
# - logger.log: API is connected!
|
||||||
|
# - rtttl.play: "success:d=24,o=5,b=100:c,g,b"
|
||||||
|
# - light.turn_on:
|
||||||
|
# id: notify_led
|
||||||
|
# brightness: 100%
|
||||||
|
# red: 0%
|
||||||
|
# green: 0%
|
||||||
|
# blue: 100%
|
||||||
|
# flash_length: 500ms
|
||||||
|
# - switch.turn_on: buzzer_enabled
|
||||||
|
# - switch.turn_on: led_enabled
|
||||||
|
|
||||||
|
esp32:
|
||||||
|
variant: esp32s3
|
||||||
|
framework:
|
||||||
|
type: esp-idf
|
||||||
|
|
||||||
|
# external_components:
|
||||||
|
# - source: github://pr#13021
|
||||||
|
# components: [esphome]
|
||||||
|
# refresh: 1min
|
||||||
|
|
||||||
|
packages:
|
||||||
|
common: !include common/common.yaml
|
||||||
|
|
||||||
|
# logger:
|
||||||
|
# hardware_uart: UART0
|
||||||
|
|
||||||
|
# GPIO20 U+
|
||||||
|
# GPIO19 U-
|
||||||
|
# GPIO0 Button
|
||||||
|
# GPIO1 I2C SDA
|
||||||
|
# GPIO2 I2C SDA
|
||||||
|
# GPIO2 Notify LED
|
||||||
|
# GPIO4 Buzzer
|
||||||
|
# GPIO21 RGB
|
||||||
|
|
||||||
|
api:
|
||||||
|
services:
|
||||||
|
- service: rfidreader_tag_ok
|
||||||
|
then:
|
||||||
|
- rtttl.play: "beep:d=16,o=5,b=100:b"
|
||||||
|
|
||||||
|
- service: rfidreader_tag_ko
|
||||||
|
then:
|
||||||
|
- rtttl.play: "beep:d=8,o=5,b=100:b"
|
||||||
|
|
||||||
|
- service: play_rtttl
|
||||||
|
variables:
|
||||||
|
song_str: string
|
||||||
|
then:
|
||||||
|
- rtttl.play: !lambda 'return song_str;'
|
||||||
|
|
||||||
|
- service: write_tag_id
|
||||||
|
variables:
|
||||||
|
tag_id: string
|
||||||
|
then:
|
||||||
|
- light.turn_on:
|
||||||
|
id: notify_led
|
||||||
|
brightness: 100%
|
||||||
|
red: 100%
|
||||||
|
green: 0%
|
||||||
|
blue: 0%
|
||||||
|
- lambda: |-
|
||||||
|
auto message = new nfc::NdefMessage();
|
||||||
|
std::string uri = "https://www.home-assistant.io/tag/";
|
||||||
|
uri += tag_id;
|
||||||
|
message->add_uri_record(uri);
|
||||||
|
id(pn532_module).write_mode(message);
|
||||||
|
- rtttl.play: "write:d=24,o=5,b=100:b"
|
||||||
|
- wait_until:
|
||||||
|
not:
|
||||||
|
pn532.is_writing:
|
||||||
|
- light.turn_off:
|
||||||
|
id: notify_led
|
||||||
|
- rtttl.play: "write:d=24,o=5,b=100:b,b"
|
||||||
|
|
||||||
|
- service: write_music_tag
|
||||||
|
variables:
|
||||||
|
music_url: string
|
||||||
|
music_info: string
|
||||||
|
then:
|
||||||
|
- light.turn_on:
|
||||||
|
id: notify_led
|
||||||
|
brightness: 100%
|
||||||
|
red: 100%
|
||||||
|
green: 0%
|
||||||
|
blue: 0%
|
||||||
|
- lambda: |-
|
||||||
|
auto message = new nfc::NdefMessage();
|
||||||
|
std::string uri = "";
|
||||||
|
std::string text = "";
|
||||||
|
uri += music_url;
|
||||||
|
text += music_info;
|
||||||
|
if ( music_url != "" ) {
|
||||||
|
message->add_uri_record(uri);
|
||||||
|
}
|
||||||
|
if ( music_info != "" ) {
|
||||||
|
message->add_text_record(text);
|
||||||
|
}
|
||||||
|
id(pn532_module).write_mode(message);
|
||||||
|
- rtttl.play: "write:d=24,o=5,b=100:b"
|
||||||
|
- wait_until:
|
||||||
|
not:
|
||||||
|
pn532.is_writing:
|
||||||
|
- light.turn_off:
|
||||||
|
id: notify_led
|
||||||
|
- rtttl.play: "write:d=24,o=5,b=100:b,b"
|
||||||
|
|
||||||
|
globals:
|
||||||
|
- id: source
|
||||||
|
type: std::string
|
||||||
|
- id: url
|
||||||
|
type: std::string
|
||||||
|
- id: info
|
||||||
|
type: std::string
|
||||||
|
|
||||||
|
i2c:
|
||||||
|
- id: i2c_rfid
|
||||||
|
sda: 1
|
||||||
|
scl: 2
|
||||||
|
frequency: 400kHz
|
||||||
|
|
||||||
|
pn532_i2c:
|
||||||
|
id: pn532_module
|
||||||
|
i2c_id: i2c_rfid
|
||||||
|
update_interval: 1s
|
||||||
|
on_tag:
|
||||||
|
then:
|
||||||
|
- if:
|
||||||
|
condition:
|
||||||
|
switch.is_on: led_enabled
|
||||||
|
then:
|
||||||
|
- light.turn_on:
|
||||||
|
id: notify_led
|
||||||
|
brightness: 100%
|
||||||
|
red: 0%
|
||||||
|
green: 100%
|
||||||
|
blue: 0%
|
||||||
|
flash_length: 500ms
|
||||||
|
|
||||||
|
- delay: 0.15s #to fix slow component
|
||||||
|
|
||||||
|
- lambda: |-
|
||||||
|
id(source)="";
|
||||||
|
id(url)="";
|
||||||
|
id(info)="";
|
||||||
|
if (tag.has_ndef_message()) {
|
||||||
|
auto message = tag.get_ndef_message();
|
||||||
|
auto records = message->get_records();
|
||||||
|
for (auto &record : records) {
|
||||||
|
std::string payload = record->get_payload();
|
||||||
|
std::string type = record->get_type();
|
||||||
|
size_t hass = payload.find("https://www.home-assistant.io/tag/");
|
||||||
|
size_t applemusic = payload.find("https://music.apple.com");
|
||||||
|
size_t spotify = payload.find("https://open.spotify.com");
|
||||||
|
size_t sonos = payload.find("sonos-2://");
|
||||||
|
|
||||||
|
size_t mass_deezer = payload.find("deezer://");
|
||||||
|
size_t mass_filesystem_local = payload.find("filesystem_local://");
|
||||||
|
size_t mass_filesystem_smb = payload.find("filesystem_smb://");
|
||||||
|
size_t mass_plex = payload.find("plex://");
|
||||||
|
size_t mass_qobuz = payload.find("qobuz://");
|
||||||
|
size_t mass_radiobrowser = payload.find("radiobrowser://");
|
||||||
|
size_t mass_soundcloud = payload.find("soundcloud://");
|
||||||
|
size_t mass_spotify = payload.find("spotify://");
|
||||||
|
size_t mass_tidal = payload.find("tidal://");
|
||||||
|
size_t mass_tunein = payload.find("tunein://");
|
||||||
|
size_t mass_ytmusic = payload.find("ytmusic://");
|
||||||
|
|
||||||
|
if (type == "U" and hass != std::string::npos ) {
|
||||||
|
ESP_LOGD("tagreader", "Found Home Assistant tag NDEF");
|
||||||
|
id(source)="hass";
|
||||||
|
id(url)=payload;
|
||||||
|
id(info)=payload.substr(hass + 34);
|
||||||
|
}
|
||||||
|
else if (type == "U" and applemusic != std::string::npos ) {
|
||||||
|
ESP_LOGD("tagreader", "Found Apple Music tag NDEF");
|
||||||
|
id(source)="amusic";
|
||||||
|
id(url)=payload;
|
||||||
|
}
|
||||||
|
else if (type == "U" and spotify != std::string::npos ) {
|
||||||
|
ESP_LOGD("tagreader", "Found Spotify tag NDEF");
|
||||||
|
id(source)="spotify";
|
||||||
|
id(url)=payload;
|
||||||
|
}
|
||||||
|
else if (type == "U" and sonos != std::string::npos ) {
|
||||||
|
ESP_LOGD("tagreader", "Found Sonos app tag NDEF");
|
||||||
|
id(source)="sonos";
|
||||||
|
id(url)=payload;
|
||||||
|
}
|
||||||
|
else if (type == "U" && (mass_deezer != std::string::npos ||
|
||||||
|
mass_filesystem_local != std::string::npos ||
|
||||||
|
mass_filesystem_smb != std::string::npos ||
|
||||||
|
mass_plex != std::string::npos ||
|
||||||
|
mass_qobuz != std::string::npos ||
|
||||||
|
mass_radiobrowser != std::string::npos ||
|
||||||
|
mass_soundcloud != std::string::npos ||
|
||||||
|
mass_spotify != std::string::npos ||
|
||||||
|
mass_tidal != std::string::npos ||
|
||||||
|
mass_tunein != std::string::npos ||
|
||||||
|
mass_ytmusic != std::string::npos)) {
|
||||||
|
ESP_LOGD("tagreader", "Found Music Assistant tag NDEF");
|
||||||
|
id(source) = "mass";
|
||||||
|
id(url) = payload;
|
||||||
|
}
|
||||||
|
else if (type == "T" ) {
|
||||||
|
ESP_LOGD("tagreader", "Found music info tag NDEF");
|
||||||
|
id(info)=payload;
|
||||||
|
}
|
||||||
|
else if ( id(source)=="" ) {
|
||||||
|
id(source)="uid";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
id(source)="uid";
|
||||||
|
}
|
||||||
|
|
||||||
|
- if:
|
||||||
|
condition:
|
||||||
|
lambda: 'return ( id(source)=="uid" );'
|
||||||
|
then:
|
||||||
|
- homeassistant.tag_scanned: !lambda |-
|
||||||
|
ESP_LOGD("tagreader", "No HA NDEF, using UID");
|
||||||
|
return x;
|
||||||
|
else:
|
||||||
|
- if:
|
||||||
|
condition:
|
||||||
|
lambda: 'return ( id(source)=="hass" );'
|
||||||
|
then:
|
||||||
|
- homeassistant.tag_scanned: !lambda 'return id(info);'
|
||||||
|
else:
|
||||||
|
- homeassistant.event:
|
||||||
|
event: esphome.music_tag
|
||||||
|
data:
|
||||||
|
reader: !lambda |-
|
||||||
|
return App.get_name().c_str();
|
||||||
|
source: !lambda |-
|
||||||
|
return id(source);
|
||||||
|
url: !lambda |-
|
||||||
|
return id(url);
|
||||||
|
info: !lambda |-
|
||||||
|
return id(info);
|
||||||
|
|
||||||
|
- if:
|
||||||
|
condition:
|
||||||
|
switch.is_on: buzzer_enabled
|
||||||
|
then:
|
||||||
|
- rtttl.play: "success:d=24,o=5,b=100:c,g,b"
|
||||||
|
on_tag_removed:
|
||||||
|
then:
|
||||||
|
- homeassistant.event:
|
||||||
|
event: esphome.tag_removed
|
||||||
|
|
||||||
|
# binary_sensor:
|
||||||
|
# - platform: rc522
|
||||||
|
# uid: 74-10-37-94
|
||||||
|
# name: "RC522 RFID Tag"
|
||||||
|
|
||||||
|
button:
|
||||||
|
- platform: template
|
||||||
|
name: Write Tag Random
|
||||||
|
id: write_tag_random
|
||||||
|
# Optional variables:
|
||||||
|
icon: "mdi:pencil-box"
|
||||||
|
on_press:
|
||||||
|
then:
|
||||||
|
- light.turn_on:
|
||||||
|
id: notify_led
|
||||||
|
brightness: 100%
|
||||||
|
red: 100%
|
||||||
|
green: 0%
|
||||||
|
blue: 100%
|
||||||
|
- lambda: |-
|
||||||
|
static const char alphanum[] = "0123456789abcdef";
|
||||||
|
std::string uri = "https://www.home-assistant.io/tag/";
|
||||||
|
for (int i = 0; i < 8; i++)
|
||||||
|
uri += alphanum[random_uint32() % (sizeof(alphanum) - 1)];
|
||||||
|
uri += "-";
|
||||||
|
for (int j = 0; j < 3; j++) {
|
||||||
|
for (int i = 0; i < 4; i++)
|
||||||
|
uri += alphanum[random_uint32() % (sizeof(alphanum) - 1)];
|
||||||
|
uri += "-";
|
||||||
|
}
|
||||||
|
for (int i = 0; i < 12; i++)
|
||||||
|
uri += alphanum[random_uint32() % (sizeof(alphanum) - 1)];
|
||||||
|
auto message = new nfc::NdefMessage();
|
||||||
|
message->add_uri_record(uri);
|
||||||
|
ESP_LOGD("tagreader", "Writing payload: %s", uri.c_str());
|
||||||
|
id(pn532_module).write_mode(message);
|
||||||
|
- rtttl.play: "write:d=24,o=5,b=100:b"
|
||||||
|
- wait_until:
|
||||||
|
not:
|
||||||
|
pn532.is_writing:
|
||||||
|
- light.turn_off:
|
||||||
|
id: notify_led
|
||||||
|
- rtttl.play: "write:d=24,o=5,b=100:b,b"
|
||||||
|
- platform: template
|
||||||
|
name: Clean Tag
|
||||||
|
id: clean_tag
|
||||||
|
icon: "mdi:nfc-variant-off"
|
||||||
|
on_press:
|
||||||
|
then:
|
||||||
|
- light.turn_on:
|
||||||
|
id: notify_led
|
||||||
|
brightness: 100%
|
||||||
|
red: 100%
|
||||||
|
green: 64.7%
|
||||||
|
blue: 0%
|
||||||
|
- lambda: 'id(pn532_module).clean_mode();'
|
||||||
|
- rtttl.play: "write:d=24,o=5,b=100:b"
|
||||||
|
- wait_until:
|
||||||
|
not:
|
||||||
|
pn532.is_writing:
|
||||||
|
- light.turn_off:
|
||||||
|
id: notify_led
|
||||||
|
- rtttl.play: "write:d=24,o=5,b=100:b,b"
|
||||||
|
- platform: template
|
||||||
|
name: Cancel writing
|
||||||
|
id: cancel_writing
|
||||||
|
icon: "mdi:pencil-off"
|
||||||
|
on_press:
|
||||||
|
then:
|
||||||
|
- lambda: 'id(pn532_module).read_mode();'
|
||||||
|
- light.turn_off:
|
||||||
|
id: notify_led
|
||||||
|
- rtttl.play: "write:d=24,o=5,b=100:b,b"
|
||||||
|
|
||||||
|
light:
|
||||||
|
- platform: esp32_rmt_led_strip
|
||||||
|
id: notify_led
|
||||||
|
rgb_order: GRB
|
||||||
|
pin: 3
|
||||||
|
num_leds: 1
|
||||||
|
chipset: ws2812
|
||||||
|
restore_mode: ALWAYS_OFF
|
||||||
|
rmt_symbols: 96
|
||||||
|
- platform: esp32_rmt_led_strip
|
||||||
|
id: status_led
|
||||||
|
rgb_order: GRB
|
||||||
|
pin: 21
|
||||||
|
num_leds: 1
|
||||||
|
chipset: ws2812
|
||||||
|
restore_mode: ALWAYS_OFF
|
||||||
|
rmt_symbols: 96
|
||||||
|
|
||||||
|
output:
|
||||||
|
- platform: ledc
|
||||||
|
pin: 4
|
||||||
|
id: buzzer
|
||||||
|
|
||||||
|
rtttl:
|
||||||
|
output: buzzer
|
||||||
|
|
||||||
|
switch:
|
||||||
|
- platform: template
|
||||||
|
name: Buzzer Enabled
|
||||||
|
id: buzzer_enabled
|
||||||
|
icon: mdi:volume-high
|
||||||
|
optimistic: true
|
||||||
|
restore_mode: RESTORE_DEFAULT_ON
|
||||||
|
entity_category: config
|
||||||
|
- platform: template
|
||||||
|
name: LED enabled
|
||||||
|
id: led_enabled
|
||||||
|
icon: mdi:alarm-light-outline
|
||||||
|
optimistic: true
|
||||||
|
restore_mode: RESTORE_DEFAULT_ON
|
||||||
|
entity_category: config
|
||||||
@@ -11,11 +11,11 @@ esphome:
|
|||||||
comment: ${comment}
|
comment: ${comment}
|
||||||
|
|
||||||
esp32:
|
esp32:
|
||||||
board: m5stack-atom
|
variant: esp32
|
||||||
framework:
|
framework:
|
||||||
type: esp-idf
|
type: esp-idf
|
||||||
version: 5.3.2
|
# version: 5.4.2
|
||||||
platform_version: 53.03.11
|
# platform_version: 54.03.21
|
||||||
|
|
||||||
packages:
|
packages:
|
||||||
common: !include common/common.yaml
|
common: !include common/common.yaml
|
||||||
|
|||||||
@@ -14,8 +14,7 @@ esphome:
|
|||||||
|
|
||||||
|
|
||||||
esp32:
|
esp32:
|
||||||
board: esp32-c3-devkitm-1
|
variant: esp32c3
|
||||||
variant: ESP32C3
|
|
||||||
framework:
|
framework:
|
||||||
type: esp-idf
|
type: esp-idf
|
||||||
version: 5.3.2
|
version: 5.3.2
|
||||||
|
|||||||
@@ -81,15 +81,11 @@ esphome:
|
|||||||
# state: ON
|
# state: ON
|
||||||
|
|
||||||
esp32:
|
esp32:
|
||||||
board: esp32dev
|
variant: esp32
|
||||||
# framework:
|
|
||||||
# type: arduino
|
|
||||||
# version: 2.0.14
|
|
||||||
# platform_version: 6.5.0
|
|
||||||
framework:
|
framework:
|
||||||
type: esp-idf
|
type: esp-idf
|
||||||
version: 5.3.2
|
# version: 5.3.2
|
||||||
platform_version: 53.03.11
|
# platform_version: 53.03.11
|
||||||
|
|
||||||
## TESTING
|
## TESTING
|
||||||
|
|
||||||
@@ -101,6 +97,8 @@ external_components:
|
|||||||
components: [ axp192 ]
|
components: [ axp192 ]
|
||||||
- source: github://pr#6721
|
- source: github://pr#6721
|
||||||
components: [ network, modem ]
|
components: [ network, modem ]
|
||||||
|
- source: github://pr#9802
|
||||||
|
components: [ modem ]
|
||||||
- source: components
|
- source: components
|
||||||
|
|
||||||
# packages:
|
# packages:
|
||||||
@@ -159,6 +157,17 @@ binary_sensor:
|
|||||||
# name: Cellular Ready
|
# name: Cellular Ready
|
||||||
|
|
||||||
sensor:
|
sensor:
|
||||||
|
- platform: modem
|
||||||
|
rssi:
|
||||||
|
name: rssi
|
||||||
|
ber:
|
||||||
|
name: ber
|
||||||
|
latitude:
|
||||||
|
name: Latitude
|
||||||
|
longitude:
|
||||||
|
name: Longitude
|
||||||
|
altitude:
|
||||||
|
name: Altitude
|
||||||
|
|
||||||
switch:
|
switch:
|
||||||
- platform: gpio
|
- platform: gpio
|
||||||
@@ -179,8 +188,17 @@ switch:
|
|||||||
id: gnss_enable
|
id: gnss_enable
|
||||||
# name: GNSS Enable
|
# name: GNSS Enable
|
||||||
port: LDO3
|
port: LDO3
|
||||||
|
- platform: modem
|
||||||
|
gnss:
|
||||||
|
name: GNSS
|
||||||
|
restore_mode: ALWAYS_ON
|
||||||
|
|
||||||
text_sensor:
|
text_sensor:
|
||||||
|
- platform: modem
|
||||||
|
network_type:
|
||||||
|
name: network type
|
||||||
|
signal_strength:
|
||||||
|
name: Signal strength
|
||||||
# - platform: template
|
# - platform: template
|
||||||
# name: "cgpaddr"
|
# name: "cgpaddr"
|
||||||
# update_interval: 25s
|
# update_interval: 25s
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ esphome:
|
|||||||
}
|
}
|
||||||
|
|
||||||
esp32:
|
esp32:
|
||||||
board: m5stack-atom
|
variant: esp32
|
||||||
framework:
|
framework:
|
||||||
type: esp-idf
|
type: esp-idf
|
||||||
|
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ esphome:
|
|||||||
}
|
}
|
||||||
|
|
||||||
esp32:
|
esp32:
|
||||||
board: m5stack-atom
|
variant: esp32
|
||||||
framework:
|
framework:
|
||||||
type: esp-idf
|
type: esp-idf
|
||||||
|
|
||||||
|
|||||||
@@ -9,6 +9,13 @@ esphome:
|
|||||||
friendly_name: ${name}
|
friendly_name: ${name}
|
||||||
area: ${area}
|
area: ${area}
|
||||||
comment: ${comment}
|
comment: ${comment}
|
||||||
|
on_boot:
|
||||||
|
then:
|
||||||
|
- if:
|
||||||
|
condition:
|
||||||
|
- binary_sensor.is_off: button
|
||||||
|
then:
|
||||||
|
- wifi.disable:
|
||||||
on_loop:
|
on_loop:
|
||||||
then:
|
then:
|
||||||
lambda: |-
|
lambda: |-
|
||||||
@@ -34,27 +41,27 @@ esphome:
|
|||||||
}
|
}
|
||||||
|
|
||||||
esp32:
|
esp32:
|
||||||
board: m5stack-atom
|
variant: esp32
|
||||||
framework:
|
framework:
|
||||||
type: esp-idf
|
type: esp-idf
|
||||||
version: 5.3.2
|
# version: 5.3.2
|
||||||
platform_version: 53.03.11
|
# platform_version: 53.03.11
|
||||||
|
|
||||||
external_components:
|
external_components:
|
||||||
- source: components
|
- source: components
|
||||||
|
|
||||||
packages:
|
packages:
|
||||||
# wifi: !include common/wifi.yaml
|
wifi: !include common/wifi.yaml
|
||||||
logger: !include common/logger.yaml
|
logger: !include common/logger.yaml
|
||||||
# api: !include common/api.yaml
|
# api: !include common/api.yaml
|
||||||
# ota: !include common/ota.yaml
|
ota: !include common/ota.yaml
|
||||||
# common: !include common/common.yaml
|
# common: !include common/common.yaml
|
||||||
|
|
||||||
# api:
|
# api:
|
||||||
# reboot_timeout: 0s
|
# reboot_timeout: 0s
|
||||||
|
|
||||||
# wifi:
|
# wifi:
|
||||||
# reboot_timeout: 0s
|
# enable_on_boot: false
|
||||||
|
|
||||||
# debug:
|
# debug:
|
||||||
|
|
||||||
@@ -73,6 +80,13 @@ packages:
|
|||||||
# 1-WIRE G22
|
# 1-WIRE G22
|
||||||
# NC G19
|
# NC G19
|
||||||
|
|
||||||
|
binary_sensor:
|
||||||
|
- platform: gpio
|
||||||
|
id: button
|
||||||
|
filters:
|
||||||
|
- invert:
|
||||||
|
pin: 39
|
||||||
|
|
||||||
esp32_ble_beacon:
|
esp32_ble_beacon:
|
||||||
type: iBeacon
|
type: iBeacon
|
||||||
uuid: !secret ble_beacon_toyota_auris_uuid
|
uuid: !secret ble_beacon_toyota_auris_uuid
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ esphome:
|
|||||||
}
|
}
|
||||||
|
|
||||||
esp32:
|
esp32:
|
||||||
board: m5stack-atom
|
variant: esp32
|
||||||
framework:
|
framework:
|
||||||
type: esp-idf
|
type: esp-idf
|
||||||
|
|
||||||
|
|||||||
@@ -24,11 +24,9 @@ esphome:
|
|||||||
# - switch.turn_off: irrigation_relay_5
|
# - switch.turn_off: irrigation_relay_5
|
||||||
|
|
||||||
esp32:
|
esp32:
|
||||||
board: m5stack-atom
|
variant: esp32
|
||||||
framework:
|
framework:
|
||||||
type: esp-idf
|
type: esp-idf
|
||||||
version: 5.3.2
|
|
||||||
platform_version: 53.03.11
|
|
||||||
|
|
||||||
packages:
|
packages:
|
||||||
common: !include common/common.yaml
|
common: !include common/common.yaml
|
||||||
@@ -38,20 +36,20 @@ api:
|
|||||||
- service: irrigation_morning
|
- service: irrigation_morning
|
||||||
then:
|
then:
|
||||||
- switch.turn_on: irrigation_relay_1
|
- switch.turn_on: irrigation_relay_1
|
||||||
- delay: 10minutes
|
- delay: 4minutes
|
||||||
|
- switch.turn_off: irrigation_relay_1
|
||||||
|
- delay: 2minutes
|
||||||
|
- switch.turn_on: irrigation_relay_1
|
||||||
|
- delay: 4minutes
|
||||||
- switch.turn_off: irrigation_relay_1
|
- switch.turn_off: irrigation_relay_1
|
||||||
- delay: 2minutes
|
- delay: 2minutes
|
||||||
- switch.turn_on: irrigation_relay_2
|
- switch.turn_on: irrigation_relay_2
|
||||||
- delay: 10minutes
|
- delay: 4minutes
|
||||||
- switch.turn_off: irrigation_relay_2
|
- switch.turn_off: irrigation_relay_2
|
||||||
- delay: 2minutes
|
- delay: 2minutes
|
||||||
- switch.turn_on: irrigation_relay_3
|
- switch.turn_on: irrigation_relay_2
|
||||||
- delay: 3minutes
|
- delay: 4minutes
|
||||||
- switch.turn_off: irrigation_relay_3
|
- switch.turn_off: irrigation_relay_2
|
||||||
- delay: 2minutes
|
|
||||||
- switch.turn_on: irrigation_relay_3
|
|
||||||
- delay: 3minutes
|
|
||||||
- switch.turn_off: irrigation_relay_3
|
|
||||||
# - switch.turn_on: irrigation_relay_4
|
# - switch.turn_on: irrigation_relay_4
|
||||||
# - delay: 40minutes
|
# - delay: 40minutes
|
||||||
# - switch.turn_off: irrigation_relay_4
|
# - switch.turn_off: irrigation_relay_4
|
||||||
|
|||||||
Reference in New Issue
Block a user