Compare commits

...
77 Commits
Author SHA1 Message Date
randy eea872b930 mcu-stackchan: spectrum analyzer, head touch gestures, status bar
- Winamp style spectrum analyzer instead of the face while music plays,
  using audio_spectrum from randybb/esphome-components
- head touch: tap starts the assistant, stroking shows an in-love face;
  SI12T sensitivity raised so the pads actually trigger
- battery (AXP2101) and wifi indicators, ear icon while listening
2026-09-27 15:19:07 +02:00
randy 39e744900d mcu-stackchan: add M5Stack StackChan config
Voice assistant satellite with animated face on the CoreS3 display:
- power rails, IO expander resets and servo power as in the M5 BSP
- mic and speaker share one I2S bus, so the mic is released before playback
- AW88298 volume limited to the audible range (0.5-1.0)
- partial display redraws, status screen until Home Assistant connects
- battery and wifi indicators, listening icon
- camera converted to JPEG on demand, no periodic frames
2026-09-27 14:02:40 +02:00
randy 6348e6bbb6 mcu-nspanel-*: migrate to native nspanel_lovelace component
CI / ESPHome config validation (push) Failing after 14s
CI / YAML lint (push) Failing after 32s
Switch all NSPanels from the MQTT + AppDaemon based
esphome-nspanel-lovelace-ui to the native component
(randybb/esphome-nspanel-lovelace-native, ref: devices).
Cards and screensaver are now configured directly in ESPHome,
removing the dependency on MQTT and AppDaemon.
2026-09-26 19:31:16 +02:00
randy 6a40e65a4b mcu-nspanel: drop local sk.json, use built-in sk translation from fork 2026-09-26 18:05:23 +02:00
randy a6605fe5e4 Add CLAUDE.md: no Claude attribution in commits/PRs 2026-09-25 23:14:35 +02:00
randyandClaude Sonnet 5 0daecc2fb9 mcu-lvgl-trainer, mcu-lvgl-eworkbench: migrate display to mipi_spi
CI / ESPHome config validation (push) Failing after 8s
CI / YAML lint (push) Failing after 52s
qspi_dbi is deprecated in favor of mipi_spi. Also fixes
mcu-lvgl-trainer's LVGL rotation (must be set on the lvgl component,
not the display, when LVGL is in use) and its deprecated
publish_initial_state -> trigger_on_initial_state. brightness is
dropped since mipi_spi only supports it for AMOLED panels and both
devices already control backlight separately.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-25 22:56:01 +02:00
randyandClaude Sonnet 5 c9358e7bd6 Rename deprecated light rgb_order to channel_colors
ESPHome renamed the esp32_rmt_led_strip platform's rgb_order option to
channel_colors; update the remaining devices using it.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-25 22:16:30 +02:00
randyandClaude Sonnet 5 173514f73e mcu-echo-1: migrate to speaker-based media_player with mixer
The i2s_audio media_player platform was removed; rebuild the audio
pipeline like mcu-echo.yaml with an i2s_audio speaker feeding a
mixer, so media playback, TTS announcements, and rtttl beeps all
share the one physical DAC output without conflicting. Also uses
format: NONE instead of the deprecated codec_support_enabled.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-25 22:16:11 +02:00
randyandClaude Sonnet 5 b818b5291b mcu-gate: split OGI detection into steady-state and blink sensors
The single on_multi_click FSM mixed an unbounded "at least 1500ms"
pattern with two bounded blink patterns, which made Open detection
unreliable. Split into two binary_sensor entries sharing the same
pin: a filter-based one for steady Open/Closed, and a dedicated
on_multi_click for the Opening/Closing blink patterns.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-25 22:09:06 +02:00
randyandClaude Sonnet 5 ab08e9a0af mcu-gateway: migrate modbus_controller off deprecated register_count
register_count is derived from value_type now; drop the now-redundant
register_count: 1 on the temp/humidity sensors, and replace the
Solar Pressure sensor's register_count: 2 (its device always returns
2 registers per read) with a hidden padding sensor on the next
register using reuse_previous_range: true, per the new
modbus_controller range-grouping mechanism.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-25 21:52:03 +02:00
randyandClaude Sonnet 5 5f966ffba6 mcu-tft: migrate display from deprecated ili9xxx to mipi_spi
ili9xxx is being phased out in favor of the unified mipi_spi driver;
model TFT 2.4 maps to the ILI9341 chip it was already using.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-25 21:43:14 +02:00
randyandClaude Sonnet 5 cd78449995 mcu-tft: comment out pinned esp-idf/platform version
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-25 21:39:02 +02:00
randyandClaude Sonnet 5 aaa6418edc mcu-well: add Modbus support for n4dig08 relay module
Adds a UART-based Modbus link plus scripts to toggle channel 1 on the
n4dig08 relay module, and calls relay_module.setup() before each
irrigation switch action.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-25 21:35:44 +02:00
randyandClaude Sonnet 5 a36dd4447d mcu-well: enable sram1_as_iram to use bootloader's extra 40KB IRAM
Fixes bootloader warning:
[W][app:198]: Bootloader supports SRAM1 as IRAM (+40KB). Set sram1_as_iram: true under esp32 > framework > advanced

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-25 21:35:38 +02:00
randyandClaude Sonnet 5 f9656a8e4c mcu-well: rename deprecated api services/service to actions/action
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-25 21:35:14 +02:00
randyandClaude Sonnet 5 c0309c5418 mcu-apollo-dev: explicitly set esp-idf toolchain
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-25 21:25:38 +02:00
randyandClaude Sonnet 5 c895c821ea mcu-rf: rework RF pin wiring and unify transmit/receive frequency
Move rx/tx off the shared gdo0 pin (21) onto dedicated pins, drop the
now-unneeded allow_other_uses/gdo0_pin workarounds, and align tx/rx
frequency to 433.92MHz.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-25 21:25:32 +02:00
randyandClaude Sonnet 5 13a5bf04cc mcu-basement: rename sewage treatment blower to aerator pump
Reflects what the device actually controls; renames the entity/id
(blower_auto -> aerator_auto) and display names accordingly.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-25 21:25:22 +02:00
randyandClaude Sonnet 5 176b875bef Rename deprecated light rgb_order to channel_colors
ESPHome renamed the esp32_rmt_led_strip platform's rgb_order option to
channel_colors; update all devices using it.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-25 21:24:58 +02:00
randyandClaude Sonnet 5 56db2c2087 Rename deprecated api services/service to actions/action
ESPHome renamed the api component's services/service keys to
actions/action; update all devices using the old names.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-25 21:24:36 +02:00
randyandClaude Sonnet 5 468e813958 Stop tracking .device-builder.json state file
It's generated/local state from ESPHome Device Builder that changes
constantly and doesn't belong in version control.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-25 21:22:20 +02:00
randy 083d603777 Add .device-builder.json to gitignore
CI / YAML lint (push) Failing after 15s
CI / ESPHome config validation (push) Failing after 17s
2026-06-17 12:12:38 +02:00
ESPHome Device Builder 213b092029 Edit mcu-apollo-dev.yaml 2026-06-17 12:00:07 +02:00
ESPHome Device Builder 6791ecd849 Edit mcu-apollo-dev.yaml 2026-06-17 11:59:49 +02:00
ESPHome Device Builder ef51ad3f0e Edit mcu-apollo-dev.yaml 2026-06-17 11:55:38 +02:00
ESPHome Device Builder 1b55751c7d Edit mcu-apollo-dev.yaml 2026-06-17 11:55:30 +02:00
ESPHome Device Builder ad6fa5bfc8 Edit mcu-apollo-dev.yaml 2026-06-10 19:44:07 +02:00
ESPHome Device Builder 7764995c14 Edit mcu-apollo-dev.yaml 2026-06-10 19:42:59 +02:00
ESPHome Device Builder 3d1318956e Edit mcu-apollo-dev.yaml 2026-06-10 19:39:42 +02:00
ESPHome Device Builder 2954489bb9 Edit mcu-apollo-dev.yaml 2026-06-10 19:15:11 +02:00
ESPHome Device Builder d3cd52ac49 Edit mcu-apollo-dev.yaml 2026-06-10 19:12:21 +02:00
ESPHome Device Builder 85af3e7ece Edit mcu-apollo-dev.yaml 2026-06-10 19:07:22 +02:00
ESPHome Device Builder 83def722f5 Edit mcu-apollo-dev.yaml 2026-06-10 18:57:10 +02:00
ESPHome Device Builder 2229e5006e Edit mcu-apollo-dev.yaml 2026-06-10 18:56:59 +02:00
ESPHome Device Builder 4b9a9763a9 Create mcu-apollo-dev.yaml 2026-06-10 18:55:05 +02:00
randy fc37633d53 Comment out broken PR for LLDP
CI / YAML lint (push) Has been cancelled
CI / ESPHome config validation (push) Has been cancelled
2026-05-14 19:21:26 +02:00
randy eb85d84880 Switch from platformio to native esp-idf toolchain for ESP32* devices 2026-05-14 18:14:07 +02:00
randy 85c2caa9eb Fix media-player on mcu-echo
CI / YAML lint (push) Has been cancelled
CI / ESPHome config validation (push) Has been cancelled
2026-05-12 23:21:17 +02:00
randy 259d269af5 Add new RF Bridge
CI / YAML lint (push) Has been cancelled
CI / ESPHome config validation (push) Has been cancelled
2026-05-11 21:47:10 +02:00
randy 252c4c3f22 Add VSCode settings for YAML file association with ESPHome
CI / YAML lint (push) Has been cancelled
CI / ESPHome config validation (push) Has been cancelled
2026-05-10 21:17:30 +02:00
randy 4237c7c4ce Remove area from comments, and add, if missing 2026-05-10 21:17:13 +02:00
randy 34c4c475ea Update ESP32 configuration to use numeric minimum_chip_revision and enable sram1_as_iram
CI / YAML lint (push) Has been cancelled
CI / ESPHome config validation (push) Has been cancelled
2026-05-09 11:06:02 +02:00
randy bfcf9005d6 Add allow_partition_access to OTA configuration for esp32 devices
CI / YAML lint (push) Has been cancelled
CI / ESPHome config validation (push) Has been cancelled
2026-05-08 22:30:05 +02:00
randy 3a23b88823 Cleanup
CI / YAML lint (push) Has been cancelled
CI / ESPHome config validation (push) Has been cancelled
2026-05-07 12:06:00 +02:00
randy e4c8c72c20 Custom scripts and related device lists are no longer needed
CI / YAML lint (push) Has been cancelled
CI / ESPHome config validation (push) Has been cancelled
2026-05-07 00:31:06 +02:00
randy bd087dc511 Update .gitignore to include .device-builder.yaml and .claude 2026-05-06 22:25:39 +02:00
randy 184a40ddf7 Add local fonts 2026-05-06 22:24:36 +02:00
randy 0f68e1379f switch to specific OTA for esp32 devices with ethernet 2026-05-06 22:24:08 +02:00
randy a76df9405b Add id's to all common components 2026-05-06 22:20:29 +02:00
randy 51f7537244 Separate OTA for esp32 which supports partition table update via OTA 2026-05-06 22:18:49 +02:00
randy bab7ffafe6 Force WPA2 for esp8266 devices 2026-05-06 22:17:59 +02:00
randy e00040e7ee Add A3 to morning irrigation cycle 2026-05-06 22:17:25 +02:00
randy 39929e46a7 Reboot mcu-kitchen when API is stuck due weak wifi 2026-05-06 22:16:09 +02:00
randy ca6f175a58 Add minimum chip revision to mcu-gateway
CI / YAML lint (push) Has been cancelled
CI / ESPHome config validation (push) Has been cancelled
2026-04-26 12:31:11 +02:00
randy 945b60c168 New file for device-builder 2026-04-26 12:22:54 +02:00
randy 4a95ebbc79 Fix for esphome-desktop 2026-04-26 12:22:19 +02:00
randy fb9822a5be pcf8574 pin numbering has been changed 2026-04-26 12:21:46 +02:00
randy 06f125e851 Simplify status led
CI / YAML lint (push) Has been cancelled
CI / ESPHome config validation (push) Has been cancelled
2026-04-06 14:36:37 +02:00
randy a35b003284 Allow async and disable reboot for MQTT on all NSPanels 2026-04-06 14:35:01 +02:00
randy 1badaaf232 NSPanels no longer need an explicit esp_http_client - fixed in the ext component
CI / YAML lint (push) Has been cancelled
CI / ESPHome config validation (push) Has been cancelled
2026-02-26 19:16:29 +01:00
randy 5600203e6b Add --- to make valid yaml's and fix all commented indentations 2026-02-24 08:53:20 +01:00
randy 1b5ef340e4 Remove empty line
CI / YAML lint (push) Has been cancelled
CI / ESPHome config validation (push) Has been cancelled
2026-02-21 10:14:58 +01:00
randy 082286ba87 Remove version/platform from can devices 2026-02-21 09:56:32 +01:00
randy baad6eda7c Real data for LLDP 2026-02-21 09:55:04 +01:00
randy 9eeeef6a57 NSPanel's need esp_http_client 2026-02-21 09:54:27 +01:00
randy a966f6adb4 Templated gate beacon on_press and on_release
CI / YAML lint (push) Has been cancelled
CI / ESPHome config validation (push) Has been cancelled
2026-02-19 14:23:27 +01:00
randy 2ef5945c9f Add indent-sequences: whatever to support more compact indent 2026-02-19 12:21:00 +01:00
randy 3ca7b2390d Use image files from assets directory 2026-02-19 12:10:33 +01:00
randy 38791e3313 Move fonts (not being used for now) and images to assets directory. Remove obsolete .h files. 2026-02-19 12:07:56 +01:00
randy d03d889e81 Remove unused local components directory 2026-02-19 11:54:26 +01:00
randyandClaude Sonnet 4.6 4ee29295ac Remove debug ota.h and its include from mcu-lvgl
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-19 11:36:52 +01:00
randyandClaude Sonnet 4.6 dd033f69bb Refactor vehicle beacon configs and clean up gate
Extract shared M5ATOM vehicle code (esp32, on_loop, LED effects) into
common/vehicle_base.yaml, reducing each vehicle file from ~136 to 20
lines. Remove dead commented-out code from on_loop lambda.

Gate: fix on_multi_click and select indentation, change
esp32_ble_tracker id from ${name} to ${device} (lowercase),
remove unused commented-out gate_flash GPIO sensor.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-19 11:32:23 +01:00
randyandClaude Sonnet 4.6 7c9aae0a7d Fix trailing spaces and missing newlines in all mcu-*.yaml files
Bulk cleanup: remove trailing whitespace and ensure files end with a
newline. Structural issues (indentation, bracket spacing) left for
per-file fixes.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-19 11:22:12 +01:00
randyandClaude Sonnet 4.6 c88ccfbdb8 Use ESPHome dev branch in CI to match production
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-19 11:18:38 +01:00
randyandClaude Sonnet 4.6 b18ce4a2da Fix yamllint errors in POW configs, update CI and lint config
- Fix UART list indentation (yamllint error)
- Remove trailing spaces in display lambda
- Add missing newline at end of file
- Add ON/OFF to yamllint truthy allowed values
- Fix invalid comments rule option in .yamllint.yml
- Lint only changed files in CI (avoids blocking PRs with pre-existing issues)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-19 11:14:51 +01:00
randyandClaude Sonnet 4.6 d4967c6411 Add CI: ESPHome config validation and YAML lint
- yamllint on all YAML files with ESPHome-friendly rules
  (allows True/False, long lines for lambdas, no forced document-start)
- ESPHome config validation on changed mcu-*.yaml files per push/PR

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-19 11:05:09 +01:00
randyandClaude Sonnet 4.6 a8b71d99dd Fix and improve POW dishwasher and washer configs
- Remove redundant interval block overriding status_led behavior
- Add UART id and reference it explicitly in cse7766
- Replace manual power factor template with native cse7766 power_factor sensor
- Remove redundant switch_led control from bi-stable relay actions
- Fix stray quote in energy sensor name (dishwasher)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-19 10:56:34 +01:00
132 changed files with 2525 additions and 3758 deletions

No files matched your search

+53
View File
@@ -0,0 +1,53 @@
name: CI
on:
push:
branches: [main]
pull_request:
jobs:
yamllint:
name: YAML lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Get changed YAML files
id: changed
uses: tj-actions/changed-files@v46
with:
files: "**/*.yaml"
- uses: ibiqlik/action-yamllint@v3
if: steps.changed.outputs.any_changed == 'true'
with:
config_file: .yamllint.yml
file_or_dir: ${{ steps.changed.outputs.all_changed_files }}
validate:
name: ESPHome config validation
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Get changed device configs
id: changed
uses: tj-actions/changed-files@v46
with:
files: "mcu-*.yaml"
- name: Install ESPHome (dev)
if: steps.changed.outputs.any_changed == 'true'
run: pip install git+https://github.com/esphome/esphome.git@dev
- name: Prepare secrets
if: steps.changed.outputs.any_changed == 'true'
run: cp secrets.yaml.default secrets.yaml
- name: Validate changed configs
if: steps.changed.outputs.any_changed == 'true'
run: |
for f in ${{ steps.changed.outputs.all_changed_files }}; do
echo "Validating $f..."
esphome config "$f"
done
+2
View File
@@ -1,7 +1,9 @@
# Gitignore settings for ESPHome # Gitignore settings for ESPHome
# This is an example and may include too much for your use-case. # This is an example and may include too much for your use-case.
# You can modify this file to suit your needs. # You can modify this file to suit your needs.
/.claude/
/.esphome/ /.esphome/
/secrets.yaml /secrets.yaml
/archive/ /archive/
/trash/ /trash/
.device-builder.json
+5
View File
@@ -0,0 +1,5 @@
{
"files.associations": {
"*.yaml": "esphome"
}
}
+27
View File
@@ -0,0 +1,27 @@
extends: default
rules:
# ESPHome uses True/False (Python style) and yes/no
truthy:
allowed-values: ["true", "false", "True", "False", "yes", "no", "on", "off", "ON", "OFF"]
check-keys: false
# Lambdas and long substitutions can exceed 80 chars
line-length:
max: 200
level: warning
# Not all files use --- document start marker
document-start: disable
# ESPHome uses both indented and non-indented sequences
indentation:
spaces: 2
indent-sequences: whatever
check-multi-line-strings: false
# Some files have trailing spaces; warn only
trailing-spaces: enable
comments:
require-starting-space: false
+8
View File
@@ -0,0 +1,8 @@
# Git commit attribution
Do not add any Claude/Anthropic attribution to git commits or pull requests in
this repository — no `Co-Authored-By: Claude ...` line, no mention of Claude
anywhere in the commit message or PR description. Commits should look like
they were written entirely by the human author.
This overrides any default Claude Code attribution instructions.
-311
View File
@@ -1,311 +0,0 @@
// Must disable logging if using logging in main.cpp or in other custom components for the
// __c causes a section type conflict with __c thingy
// you can enable logging and use it if you enable this in logger:
/*
logger:
level: DEBUG
esp8266_store_log_strings_in_flash: False
*/
//#define APE_LOGGING
// take advantage of LOG_ defines to decide which code to include
#ifdef LOG_BINARY_OUTPUT
#define APE_BINARY_OUTPUT
#endif
#ifdef LOG_BINARY_SENSOR
#define APE_BINARY_SENSOR
#endif
#ifdef LOG_SENSOR
#define APE_SENSOR
#endif
static const char *TAGape = "ape";
#define APE_CMD_DIGITAL_READ 0
#define APE_CMD_WRITE_ANALOG 2
#define APE_CMD_WRITE_DIGITAL_HIGH 3
#define APE_CMD_WRITE_DIGITAL_LOW 4
#define APE_CMD_SETUP_PIN_OUTPUT 5
#define APE_CMD_SETUP_PIN_INPUT_PULLUP 6
#define APE_CMD_SETUP_PIN_INPUT 7
// 8 analog registers.. A0 to A7
// A4 and A5 not supported due to I2C
#define CMD_ANALOG_READ_A0 0b1000 // 0x8
// ....
#define CMD_ANALOG_READ_A7 0b1111 // 0xF
#define CMD_SETUP_ANALOG_INTERNAL 0x10
#define CMD_SETUP_ANALOG_DEFAULT 0x11
#define get_ape(constructor) static_cast<ArduinoPortExpander *>(constructor.get_component(0))
#define ape_binary_output(ape, pin) get_ape(ape)->get_binary_output(pin)
#define ape_binary_sensor(ape, pin) get_ape(ape)->get_binary_sensor(pin)
#define ape_analog_input(ape, pin) get_ape(ape)->get_analog_input(pin)
class ArduinoPortExpander;
using namespace esphome;
#ifdef APE_BINARY_OUTPUT
class ApeBinaryOutput : public output::BinaryOutput
{
public:
ApeBinaryOutput(ArduinoPortExpander *parent, uint8_t pin)
{
this->parent_ = parent;
this->pin_ = pin;
}
void write_state(bool state) override;
uint8_t get_pin() { return this->pin_; }
protected:
ArduinoPortExpander *parent_;
uint8_t pin_;
// Pins are setup as output after the state is written, Arduino has no open drain outputs, after setting an output it will either sink or source thus activating outputs writen to false during a flick.
bool setup_{true};
bool state_{false};
friend class ArduinoPortExpander;
};
#endif
#ifdef APE_BINARY_SENSOR
class ApeBinarySensor : public binary_sensor::BinarySensor
{
public:
ApeBinarySensor(ArduinoPortExpander *parent, uint8_t pin)
{
this->pin_ = pin;
}
uint8_t get_pin() { return this->pin_; }
protected:
uint8_t pin_;
};
#endif
#ifdef APE_SENSOR
class ApeAnalogInput : public sensor::Sensor
{
public:
ApeAnalogInput(ArduinoPortExpander *parent, uint8_t pin)
{
this->pin_ = pin;
}
uint8_t get_pin() { return this->pin_; }
protected:
uint8_t pin_;
};
#endif
class ArduinoPortExpander : public Component, public I2CDevice
{
public:
ArduinoPortExpander(I2CBus *bus, uint8_t address, bool vref_default = false)
{
set_i2c_address(address);
set_i2c_bus(bus);
this->vref_default_ = vref_default;
}
void setup() override
{
#ifdef APE_LOGGING
ESP_LOGCONFIG(TAGape, "Setting up ArduinoPortExpander at %#02x ...", address_);
#endif
/* We cannot setup as usual as arduino boots later than esp8266
Poll i2c bus for our Arduino for a n seconds instead of failing fast,
also this is important as pin setup (INPUT_PULLUP, OUTPUT it's done once)
*/
this->configure_timeout_ = millis() + 5000;
}
void loop() override
{
if (millis() < this->configure_timeout_)
{
bool try_configure = millis() % 100 > 50;
if (try_configure == this->configure_)
return;
this->configure_ = try_configure;
if (ERROR_OK == this->read_register(APE_CMD_DIGITAL_READ, const_cast<uint8_t *>(this->read_buffer_), 3))
{
#ifdef APE_LOGGING
ESP_LOGCONFIG(TAGape, "ArduinoPortExpander found at %#02x", address_);
#endif
delay(10);
if (this->vref_default_)
{
this->write_register(CMD_SETUP_ANALOG_DEFAULT, nullptr, 0); // 0: unused
}
// Config success
this->configure_timeout_ = 0;
this->status_clear_error();
#ifdef APE_BINARY_SENSOR
for (ApeBinarySensor *pin : this->input_pins_)
{
App.feed_wdt();
uint8_t pinNo = pin->get_pin();
#ifdef APE_LOGGING
ESP_LOGCONFIG(TAGape, "Setup input pin %d", pinNo);
#endif
this->write_register(APE_CMD_SETUP_PIN_INPUT_PULLUP, &pinNo, 1);
delay(20);
}
#endif
#ifdef APE_BINARY_OUTPUT
for (ApeBinaryOutput *output : this->output_pins_)
{
if (!output->setup_)
{ // this output has a valid value already
this->write_state(output->pin_, output->state_, true);
App.feed_wdt();
delay(20);
}
}
#endif
#ifdef APE_SENSOR
for (ApeAnalogInput *sensor : this->analog_pins_)
{
App.feed_wdt();
uint8_t pinNo = sensor->get_pin();
#ifdef APE_LOGGING
ESP_LOGCONFIG(TAGape, "Setup analog input pin %d", pinNo);
#endif
this->write_register(APE_CMD_SETUP_PIN_INPUT, &pinNo, 1);
delay(20);
}
#endif
return;
}
// Still not answering
return;
}
if (this->configure_timeout_ != 0 && millis() > this->configure_timeout_)
{
#ifdef APE_LOGGING
ESP_LOGE(TAGape, "ArduinoPortExpander NOT found at %#02x", address_);
#endif
this->mark_failed();
return;
}
#ifdef APE_BINARY_SENSOR
if (ERROR_OK != this->read_register(APE_CMD_DIGITAL_READ, const_cast<uint8_t *>(this->read_buffer_), 3))
{
#ifdef APE_LOGGING
ESP_LOGE(TAGape, "Error reading. Reconfiguring pending.");
#endif
this->status_set_error();
this->configure_timeout_ = millis() + 5000;
return;
}
for (ApeBinarySensor *pin : this->input_pins_)
{
uint8_t pinNo = pin->get_pin();
uint8_t bit = pinNo % 8;
uint8_t value = pinNo < 8 ? this->read_buffer_[0] : pinNo < 16 ? this->read_buffer_[1] : this->read_buffer_[2];
bool ret = value & (1 << bit);
if (this->initial_state_)
pin->publish_initial_state(ret);
else
pin->publish_state(ret);
}
#endif
#ifdef APE_SENSOR
for (ApeAnalogInput *pin : this->analog_pins_)
{
uint8_t pinNo = pin->get_pin();
pin->publish_state(analogRead(pinNo));
}
#endif
this->initial_state_ = false;
}
#ifdef APE_SENSOR
uint16_t analogRead(uint8_t pin)
{
bool ok = (ERROR_OK == this->read_register((uint8_t)(CMD_ANALOG_READ_A0 + pin), const_cast<uint8_t *>(this->read_buffer_), 2));
#ifdef APE_LOGGING
ESP_LOGVV(TAGape, "analog read pin: %d ok: %d byte0: %d byte1: %d", pin, ok, this->read_buffer_[0], this->read_buffer_[1]);
#endif
uint16_t value = this->read_buffer_[0] | ((uint16_t)this->read_buffer_[1] << 8);
return value;
}
#endif
#ifdef APE_BINARY_OUTPUT
output::BinaryOutput *get_binary_output(uint8_t pin)
{
ApeBinaryOutput *output = new ApeBinaryOutput(this, pin);
output_pins_.push_back(output);
return output;
}
#endif
#ifdef APE_BINARY_SENSOR
binary_sensor::BinarySensor *get_binary_sensor(uint8_t pin)
{
ApeBinarySensor *binarySensor = new ApeBinarySensor(this, pin);
input_pins_.push_back(binarySensor);
return binarySensor;
}
#endif
#ifdef APE_SENSOR
sensor::Sensor *get_analog_input(uint8_t pin)
{
ApeAnalogInput *input = new ApeAnalogInput(this, pin);
analog_pins_.push_back(input);
return input;
}
#endif
void write_state(uint8_t pin, bool state, bool setup = false)
{
if (this->configure_timeout_ != 0)
return;
#ifdef APE_LOGGING
ESP_LOGD(TAGape, "Writing %d to pin %d", state, pin);
#endif
this->write_register(state ? APE_CMD_WRITE_DIGITAL_HIGH : APE_CMD_WRITE_DIGITAL_LOW, &pin, 1);
if (setup)
{
App.feed_wdt();
delay(20);
#ifdef APE_LOGGING
ESP_LOGI(TAGape, "Setup output pin %d", pin);
#endif
this->write_register(APE_CMD_SETUP_PIN_OUTPUT, &pin, 1);
}
}
protected:
bool configure_{true};
bool initial_state_{true};
uint8_t read_buffer_[3]{0, 0, 0};
unsigned long configure_timeout_{5000};
bool vref_default_{false};
#ifdef APE_BINARY_OUTPUT
std::vector<ApeBinaryOutput *> output_pins_;
#endif
#ifdef APE_BINARY_SENSOR
std::vector<ApeBinarySensor *> input_pins_;
#endif
#ifdef APE_SENSOR
std::vector<ApeAnalogInput *> analog_pins_;
#endif
};
#ifdef APE_BINARY_OUTPUT
void ApeBinaryOutput::write_state(bool state)
{
this->state_ = state;
this->parent_->write_state(this->pin_, state, this->setup_);
this->setup_ = false;
}
#endif
File renamed without changes.
File renamed without changes.
Binary file not shown.
File renamed without changes.
Binary file not shown.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="1194" height="240" fill="none" viewBox="0 0 1194 240"><g clip-path="url(#clip0_2_63)"><path fill="#18BCF2" d="M240 219C240 227.24 233.24 234 225 234H15C6.76 234 0 227.24 0 219V129C0 120.76 4.78 109.22 10.6 103.4L109.4 4.61999C115.24 -1.22001 124.78 -1.22001 130.62 4.61999L229.4 103.4C235.24 109.24 240 120.76 240 129V219Z"/><path fill="#F2F4F9" d="M160 78.66H80C76.68 78.66 74 81.34 74 84.66V234H86V90.66H154V102.66H104C100.68 102.66 98 105.34 98 108.66V132.66C98 135.98 100.68 138.66 104 138.66H154V150.66H104C100.68 150.66 98 153.34 98 156.66V180.66C98 183.98 100.68 186.66 104 186.66H154V198.66H104C100.68 198.66 98 201.34 98 204.66C98 207.98 100.68 210.66 104 210.66H160C163.32 210.66 166 207.98 166 204.66V180.66C166 177.34 163.32 174.66 160 174.66H110V162.66H160C163.32 162.66 166 159.98 166 156.66V132.66C166 129.34 163.32 126.66 160 126.66H110V114.66H160C163.32 114.66 166 111.98 166 108.66V84.66C166 81.34 163.32 78.66 160 78.66Z"/><path fill="#F2F4F9" d="M423 167.61V190.11H336V49.95H423V72.63H359.82V108.91H416.26V130.01H359.82V167.61H423Z"/><path fill="#F2F4F9" d="M491.08 47.41C503.9 47.41 514.54 50.53 523.04 56.79C531.54 63.03 536.76 71.39 538.7 81.83L516.3 87.93C515.04 81.93 512.12 77.31 507.54 74.05C502.94 70.81 497.28 69.17 490.52 69.17C483.26 69.17 477.52 70.91 473.28 74.37C469.02 77.83 466.9 82.45 466.9 88.19C466.9 97.25 472.52 103.13 483.78 105.81L506.66 111.53C518.48 114.59 527.32 119.45 533.2 126.11C539.08 132.77 542.02 140.97 542.02 150.71C542.02 163.21 537.48 173.31 528.42 181.03C519.36 188.75 507.24 192.61 492.04 192.61C478.36 192.61 466.78 189.39 457.36 182.95C448.04 176.27 442.54 167.45 440.86 156.51L463.26 150.69C464.08 156.87 467.16 161.73 472.5 165.23C477.84 168.73 484.64 170.47 492.9 170.47C501.16 170.47 507.08 168.79 511.6 165.45C516.14 162.11 518.4 157.57 518.4 151.81C518.4 142.81 512.78 136.87 501.52 133.99L478.64 128.45C466.88 125.77 458.06 120.99 452.16 114.15C446.26 107.31 443.3 98.95 443.3 89.07C443.3 76.69 447.7 66.65 456.48 58.93C465.26 51.21 476.8 47.35 491.12 47.35L491.08 47.41Z"/><path fill="#F2F4F9" d="M666.1 95.61C666.1 109.37 661.92 120.49 653.58 128.99C645.24 137.49 634 141.75 619.88 141.75H588.38V190.13H564.56V49.95H620.06C634.3 49.95 645.54 54.07 653.76 62.27C661.98 70.49 666.08 81.59 666.08 95.59L666.1 95.61ZM641.16 95.05C641.16 87.99 638.96 82.25 634.56 77.85C630.16 73.45 623.92 71.25 615.86 71.25H588.4V120.85H615.5C623.74 120.85 630.1 118.51 634.54 113.81C638.98 109.13 641.2 102.87 641.2 95.05H641.16Z"/><path fill="#F2F4F9" d="M687.38 49.95H711.2V108.55L772.98 108.73V49.95H796.98V190.11H772.98V129.83L711.2 129.65V190.11H687.38V49.95Z"/><path fill="#F2F4F9" d="M868.6 92.79C883.1 92.79 894.92 97.45 904.04 106.75C913.16 116.07 917.72 128.03 917.72 142.65C917.72 157.27 913.16 169.15 904.04 178.47C894.92 187.79 883.1 192.43 868.6 192.43C854.1 192.43 842.1 187.77 832.98 178.47C823.86 169.15 819.3 157.23 819.3 142.65C819.3 128.07 823.86 115.97 832.98 106.69C842.1 97.41 853.98 92.77 868.6 92.77V92.79ZM868.6 172.01C876.34 172.01 882.64 169.27 887.5 163.81C892.34 158.35 894.76 151.23 894.76 142.49C894.76 133.75 892.34 126.67 887.5 121.25C882.66 115.85 876.36 113.15 868.6 113.15C860.84 113.15 854.26 115.85 849.38 121.25C844.5 126.65 842.06 133.73 842.06 142.49C842.06 151.25 844.5 158.35 849.38 163.81C854.26 169.27 860.66 172.01 868.6 172.01Z"/><path fill="#F2F4F9" d="M1081.6 129.83V190.11H1059.56V133.29C1059.56 126.73 1057.88 121.61 1054.5 117.91C1051.12 114.23 1046.54 112.37 1040.72 112.37C1034.54 112.37 1029.6 114.39 1025.9 118.41C1022.22 122.45 1020.36 128.09 1020.36 135.33V190.09H998.04V133.27C998.04 126.71 996.4 121.59 993.12 117.89C989.84 114.21 985.3 112.35 979.48 112.35C973.3 112.35 968.32 114.37 964.58 118.39C960.84 122.41 958.96 128.07 958.96 135.31V190.07H936.28V95.39H957.38L958.14 104.49C963.64 96.43 972.6 92.39 985.04 92.39C992.28 92.39 998.58 93.89 1003.88 96.89C1009.2 99.89 1013.22 104.27 1015.98 110.01C1018.3 104.51 1022.12 100.19 1027.46 97.07C1032.8 93.95 1039.16 92.39 1046.54 92.39C1057.28 92.39 1065.82 95.71 1072.14 102.33C1078.46 108.95 1081.6 118.11 1081.6 129.79V129.83Z"/><path fill="#F2F4F9" d="M1193.54 151.11H1120.98C1121.74 158.23 1124.42 163.67 1129.04 167.43C1133.66 171.19 1139.54 173.05 1146.66 173.05C1158.22 173.05 1166.32 168.23 1170.94 158.61L1189.88 166.11C1186.32 174.43 1180.7 180.93 1173.06 185.61C1165.4 190.29 1156.6 192.65 1146.66 192.65C1132.66 192.65 1121.3 188.07 1112.58 178.91C1103.86 169.75 1099.5 157.73 1099.5 142.87C1099.5 128.01 1103.9 115.91 1112.68 106.59C1121.46 97.27 1132.94 92.63 1147.14 92.63C1161.34 92.63 1172.3 97.23 1180.8 106.41C1189.3 115.59 1193.56 127.69 1193.56 142.69V151.13L1193.54 151.11ZM1121.36 135.17H1170.48C1170.04 127.49 1167.72 121.63 1163.5 117.59C1159.28 113.55 1153.6 111.55 1146.48 111.55C1139.36 111.55 1133.66 113.59 1129.24 117.69C1124.8 121.79 1122.18 127.61 1121.36 135.17Z"/></g><defs><clipPath id="clip0_2_63"><rect width="1193.56" height="240" fill="#fff"/></cliLine truncated

After

Width:  |  Height:  |  Size: 4.9 KiB

File renamed without changes.
+1
View File
@@ -1,3 +1,4 @@
--- ---
platform: status platform: status
name: Status name: Status
id: status_sensor
+1
View File
@@ -1,3 +1,4 @@
--- ---
platform: factory_reset platform: factory_reset
name: Factory Defaults name: Factory Defaults
id: factory_reset_button
+1
View File
@@ -1,3 +1,4 @@
--- ---
platform: restart platform: restart
name: Restart name: Restart
id: restart_button
+1
View File
@@ -1,3 +1,4 @@
--- ---
platform: safe_mode platform: safe_mode
name: Restart (Safe Mode) name: Restart (Safe Mode)
id: restart_safe_mode_button
+1
View File
@@ -1,3 +1,4 @@
--- ---
platform: shutdown platform: shutdown
name: Shutdown name: Shutdown
id: shutdown_button
+1 -1
View File
@@ -1,7 +1,7 @@
--- ---
<<: !include wifi.yaml <<: !include wifi.yaml
<<: !include api.yaml <<: !include api.yaml
<<: !include ota.yaml <<: !include ota_esp32.yaml
# <<: !include logger.yaml # <<: !include logger.yaml
<<: !include logger_debug.yaml <<: !include logger_debug.yaml
+1 -1
View File
@@ -1,6 +1,6 @@
--- ---
<<: !include api.yaml <<: !include api.yaml
<<: !include ota.yaml <<: !include ota_esp32.yaml
<<: !include logger_debug.yaml <<: !include logger_debug.yaml
<<: !include ethernet.yaml <<: !include ethernet.yaml
+9
View File
@@ -0,0 +1,9 @@
- if:
condition:
and:
- switch.is_on: ${enable_id}
- switch.is_on: auto_close
- lambda: 'return id(beacon_count) == 1;'
then:
- button.press: gate_close
- lambda: 'id(beacon_count) -= 1;'
+9
View File
@@ -0,0 +1,9 @@
- lambda: 'id(beacon_count) += 1;'
- if:
condition:
and:
- switch.is_on: ${enable_id}
- switch.is_on: auto_open
- lambda: 'return id(beacon_count) == 1;'
then:
- button.press: gate_open
+5
View File
@@ -0,0 +1,5 @@
---
ota:
- platform: esphome
password: !secret ota_password
allow_partition_access: true
+4
View File
@@ -2,9 +2,13 @@
platform: debug platform: debug
free: free:
name: Heap Free name: Heap Free
id: heap_free_sensor
fragmentation: fragmentation:
name: Heap Fragmentation name: Heap Fragmentation
id: heap_fragmentation_sensor
block: block:
name: Heap Max Block name: Heap Max Block
id: heap_max_block_sensor
loop_time: loop_time:
name: Loop Time name: Loop Time
id: loop_time_sensor
+1
View File
@@ -1,6 +1,7 @@
--- ---
platform: uptime platform: uptime
name: Uptime name: Uptime
id: uptime_sensor
unit_of_measurement: "days" unit_of_measurement: "days"
accuracy_decimals: 2 accuracy_decimals: 2
update_interval: 60s update_interval: 60s
+1
View File
@@ -1,4 +1,5 @@
--- ---
platform: wifi_signal platform: wifi_signal
name: WiFi Signal name: WiFi Signal
id: wifi_signal_sensor
update_interval: 60s update_interval: 60s
+1
View File
@@ -1,3 +1,4 @@
--- ---
platform: restart platform: restart
name: Restart name: Restart
id: restart_switch
+1
View File
@@ -1,3 +1,4 @@
--- ---
platform: safe_mode platform: safe_mode
name: Restart (Safe Mode) name: Restart (Safe Mode)
id: restart_safe_mode_switch
+1
View File
@@ -1,3 +1,4 @@
--- ---
platform: shutdown platform: shutdown
name: Shutdown name: Shutdown
id: shutdown_switch
+2
View File
@@ -2,5 +2,7 @@
platform: debug platform: debug
device: device:
name: Device Info name: Device Info
id: device_info_sensor
reset_reason: reset_reason:
name: Reset Reason name: Reset Reason
id: reset_reason_sensor
+3
View File
@@ -2,7 +2,10 @@
platform: ethernet_info platform: ethernet_info
ip_address: ip_address:
name: IP Address name: IP Address
id: ip_address_sensor
address_1: address_1:
name: IP Address 1 name: IP Address 1
id: ip_address_1_sensor
address_2: address_2:
name: IP Address 2 name: IP Address 2
id: ip_address_2_sensor
+1
View File
@@ -1,6 +1,7 @@
--- ---
platform: git_ref platform: git_ref
name: Git Ref name: Git Ref
id: git_ref_sensor
long: true long: true
all: true all: true
abbrev: 16 abbrev: 16
+1
View File
@@ -1,3 +1,4 @@
--- ---
platform: uptime platform: uptime
name: Uptime name: Uptime
id: uptime_sensor
+1
View File
@@ -1,3 +1,4 @@
--- ---
platform: version platform: version
name: Version name: Version
id: version_sensor
+10
View File
@@ -2,29 +2,39 @@
platform: wifi_info platform: wifi_info
ip_address: ip_address:
name: IP Address name: IP Address
id: ip_address_sensor
icon: mdi:ip-network icon: mdi:ip-network
# address_0: # address_0:
# name: IP Address 0 # name: IP Address 0
# icon: mdi:ip-network # icon: mdi:ip-network
address_1: address_1:
name: IP Address 1 name: IP Address 1
id: ip_address_1_sensor
icon: mdi:ip-network icon: mdi:ip-network
address_2: address_2:
name: IP Address 2 name: IP Address 2
id: ip_address_2_sensor
icon: mdi:ip-network icon: mdi:ip-network
# address_3: # address_3:
# name: IP Address 3 # name: IP Address 3
# id: ip_address_3_sensor
# icon: mdi:ip-network # icon: mdi:ip-network
# address_4: # address_4:
# name: IP Address 4 # name: IP Address 4
# id: ip_address_4_sensor
# icon: mdi:ip-network # icon: mdi:ip-network
#ssid: #ssid:
# name: SSID # name: SSID
# id: ssid_sensor
#bssid: #bssid:
# name: BSSID # name: BSSID
# id: bssid_sensor
mac_address: mac_address:
name: MAC name: MAC
id: mac_address_sensor
#scan_results: #scan_results:
# name: Latest Scan Results # name: Latest Scan Results
# id: scan_results_sensor
power_save_mode: power_save_mode:
name: WiFi Power Save Mode name: WiFi Power Save Mode
id: wifi_power_save_mode_sensor
+106
View File
@@ -0,0 +1,106 @@
esp32:
variant: esp32
toolchain: esp-idf
framework:
type: esp-idf
external_components:
- source: components
# PINOUTS: M5ATOM
# IR G12
# NEO G27
# BUTTON G39
# I2C0 SDA G26
# I2C0 SCL G32
# I2C1 SDA G25
# I2C1 SCL G21
# UART0 RX G3
# UART0 TX G1
# UART1 RX G23
# UART1 TX G33
# 1-WIRE G22
# NC G19
esphome:
on_loop:
then:
lambda: |-
static uint32_t last_state = 0;
auto state = App.get_app_state();
if (state != last_state) {
if (state & STATUS_LED_ERROR) {
auto call = id(led).turn_on();
call.set_effect("ERROR");
call.perform();
} else if (state & STATUS_LED_WARNING) {
auto call = id(led).turn_on();
call.set_effect("BOOT");
call.perform();
} else {
auto call = id(led).turn_on();
call.set_effect("BEACON");
call.perform();
}
last_state = state;
}
light:
- platform: esp32_rmt_led_strip
name: LED
id: led
rgb_order: GRB
pin: 27
num_leds: 1
chipset: ws2812
restore_mode: ALWAYS_OFF
effects:
- strobe:
name: "BEACON"
colors:
- state: true
red: 0%
green: 0%
blue: 50%
duration: 200ms
- state: false
duration: 200ms
- state: true
red: 0%
green: 0%
blue: 50%
duration: 200ms
- state: false
duration: 10s
- lambda:
name: "ERROR"
update_interval: 0.5s
lambda: |-
static bool state = false;
auto call = id(led).turn_on();
call.set_transition_length(500);
call.set_rgb(1, 0, 0);
if (!state) {
call.set_brightness(1);
} else {
// If using 0, it freaks Home Assistant UI.
call.set_brightness(0.01);
}
call.perform();
state = !state;
- lambda:
name: "BOOT"
update_interval: 0.5s
lambda: |-
static bool state = false;
auto call = id(led).turn_on();
call.set_transition_length(500);
call.set_rgb(0, 1, 0);
if (!state) {
call.set_brightness(1);
} else {
// If using 0, it freaks Home Assistant UI.
call.set_brightness(0.01);
}
call.perform();
state = !state;
+1
View File
@@ -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: WPA2
-12
View File
@@ -1,12 +0,0 @@
#!/bin/bash
export ESPHOME_IS_HA_ADDON=true
while IFS=, read -r device
do
esphome compile ${device}.yaml
# esphome upload ${device}.yaml --device ${device}.local
# esphome run ${device}.yaml
done < devices_dev.csv
# done < devices_prod.csv
#done < devices_nspanel.csv
-24
View File
@@ -1,24 +0,0 @@
import esphome.codegen as cg
import esphome.config_validation as cv
from esphome.components import i2c
from esphome.const import CONF_ID, CONF_SLEEP_DURATION
DEPENDENCIES = ['i2c']
CONF_I2C_ADDR = 0x51
bm8563 = cg.esphome_ns.namespace('bm8563')
BM8563 = bm8563.class_('BM8563', cg.Component, i2c.I2CDevice)
CONFIG_SCHEMA = cv.Schema({
cv.GenerateID(): cv.declare_id(BM8563),
cv.Optional(CONF_SLEEP_DURATION): cv.positive_time_period_seconds,
}).extend(cv.COMPONENT_SCHEMA).extend(i2c.i2c_device_schema(CONF_I2C_ADDR))
def to_code(config):
var = cg.new_Pvariable(config[CONF_ID])
if CONF_SLEEP_DURATION in config:
cg.add(var.set_sleep_duration(config[CONF_SLEEP_DURATION]))
yield cg.register_component(var, config)
yield i2c.register_i2c_device(var, config)
-242
View File
@@ -1,242 +0,0 @@
#include "esphome/core/log.h"
#include "esphome/components/i2c/i2c_bus.h"
#include "bm8563.h"
namespace esphome {
namespace bm8563 {
static const char *TAG = "bm8563.sensor";
void BM8563::setup(){
this->write_byte_16(0,0);
this->setupComplete = true;
if (this->sleep_duration_.has_value()) {
SetAlarmIRQ(*this->sleep_duration_);
}
}
void BM8563::loop(){
// if(!this->setupComplete){
// return;
// }
// BM8563_TimeTypeDef BM8563_TimeStruct;
// getTime(&BM8563_TimeStruct);
// this->publish_state(BM8563_TimeStruct.seconds);
}
void BM8563::dump_config(){
ESP_LOGCONFIG(TAG, "BM8563:");
ESP_LOGCONFIG(TAG, " Address: 0x%02X", this->address_);
ESP_LOGCONFIG(TAG, " setupComplete: %s", this->setupComplete ? "true" : "false");
if (this->sleep_duration_.has_value()) {
uint32_t duration = *this->sleep_duration_;
ESP_LOGCONFIG(TAG, " Sleep Duration: %u ms", duration);
}
}
void BM8563::set_sleep_duration(uint32_t time_s) {
this->sleep_duration_ = uint64_t(time_s);
if (this->sleep_duration_.has_value()) {
SetAlarmIRQ(*this->sleep_duration_);
}
}
bool BM8563::getVoltLow() {
uint8_t data = ReadReg(0x02);
return data & 0x80; // RTCC_VLSEC_MASK
}
uint8_t BM8563::bcd2ToByte(uint8_t value) {
uint8_t tmp = 0;
tmp = ((uint8_t)(value & (uint8_t)0xF0) >> (uint8_t)0x4) * 10;
return (tmp + (value & (uint8_t)0x0F));
}
uint8_t BM8563::byteToBcd2(uint8_t value) {
uint8_t bcdhigh = 0;
while (value >= 10) {
bcdhigh++;
value -= 10;
}
return ((uint8_t)(bcdhigh << 4) | value);
}
void BM8563::getTime(BM8563_TimeTypeDef* BM8563_TimeStruct) {
uint8_t buf[3] = {0};
this->read_register(0x02, buf, 3);
BM8563_TimeStruct->seconds = bcd2ToByte(buf[0] & 0x7f);
BM8563_TimeStruct->minutes = bcd2ToByte(buf[1] & 0x7f);
BM8563_TimeStruct->hours = bcd2ToByte(buf[2] & 0x3f);
}
void BM8563::setTime(BM8563_TimeTypeDef* BM8563_TimeStruct) {
if (BM8563_TimeStruct == NULL) {
return;
}
uint8_t buf[3] = {byteToBcd2(BM8563_TimeStruct->seconds), byteToBcd2(BM8563_TimeStruct->minutes), byteToBcd2(BM8563_TimeStruct->hours)};
this->write_register(0x02, buf, 3);
}
void BM8563::getDate(BM8563_DateTypeDef* BM8563_DateStruct) {
uint8_t buf[4] = {0};
this->read_register(0x05, buf, 4);
BM8563_DateStruct->date = bcd2ToByte(buf[0] & 0x3f);
BM8563_DateStruct->weekDay = bcd2ToByte(buf[1] & 0x07);
BM8563_DateStruct->month = bcd2ToByte(buf[2] & 0x1f);
if (buf[2] & 0x80) {
BM8563_DateStruct->year = 1900 + bcd2ToByte(buf[3] & 0xff);
} else {
BM8563_DateStruct->year = 2000 + bcd2ToByte(buf[3] & 0xff);
}
}
void BM8563::setDate(BM8563_DateTypeDef* BM8563_DateStruct) {
if (BM8563_DateStruct == NULL) {
return;
}
uint8_t buf[4] = {byteToBcd2(BM8563_DateStruct->date), byteToBcd2(BM8563_DateStruct->weekDay), 0, byteToBcd2((uint8_t)(BM8563_DateStruct->year % 100))};
if (BM8563_DateStruct->year < 2000) {
buf[3] = byteToBcd2(BM8563_DateStruct->month) | 0x80;
} else {
buf[3] = byteToBcd2(BM8563_DateStruct->month) | 0x00;
}
this->write_register(0x05, buf, 4);
}
void BM8563::WriteReg(uint8_t reg, uint8_t data) {
this->write_byte(reg, data);
}
uint8_t BM8563::ReadReg(uint8_t reg) {
uint8_t data;
this->read_register(reg, &data, 1);
return data;
}
int BM8563::SetAlarmIRQ(int afterSeconds) {
uint8_t reg_value = 0;
reg_value = ReadReg(0x01);
if (afterSeconds < 0) {
reg_value &= ~(1 << 0);
WriteReg(0x01, reg_value);
reg_value = 0x03;
WriteReg(0x0E, reg_value);
return -1;
}
uint8_t type_value = 2;
uint8_t div = 1;
if (afterSeconds > 255) {
div = 60;
type_value = 0x83;
} else {
type_value = 0x82;
}
afterSeconds = (afterSeconds / div) & 0xFF;
WriteReg(0x0F, afterSeconds);
WriteReg(0x0E, type_value);
reg_value |= (1 << 0);
reg_value &= ~(1 << 7);
WriteReg(0x01, reg_value);
return afterSeconds * div;
}
int BM8563::SetAlarmIRQ(const BM8563_TimeTypeDef &BM8563_TimeStruct) {
uint8_t irq_enable = false;
uint8_t out_buf[4] = {0x80, 0x80, 0x80, 0x80};
if (BM8563_TimeStruct.minutes >= 0) {
irq_enable = true;
out_buf[0] = byteToBcd2(BM8563_TimeStruct.minutes) & 0x7f;
}
if (BM8563_TimeStruct.hours >= 0) {
irq_enable = true;
out_buf[1] = byteToBcd2(BM8563_TimeStruct.hours) & 0x3f;
}
out_buf[2] = 0x00;
out_buf[3] = 0x00;
uint8_t reg_value = ReadReg(0x01);
if (irq_enable) {
reg_value |= (1 << 1);
} else {
reg_value &= ~(1 << 1);
}
for (int i = 0; i < 4; i++) {
WriteReg(0x09 + i, out_buf[i]);
}
WriteReg(0x01, reg_value);
return irq_enable ? 1 : 0;
}
int BM8563::SetAlarmIRQ(const BM8563_DateTypeDef &BM8563_DateStruct, const BM8563_TimeTypeDef &BM8563_TimeStruct) {
uint8_t irq_enable = false;
uint8_t out_buf[4] = {0x80, 0x80, 0x80, 0x80};
if (BM8563_TimeStruct.minutes >= 0) {
irq_enable = true;
out_buf[0] = byteToBcd2(BM8563_TimeStruct.minutes) & 0x7f;
}
if (BM8563_TimeStruct.hours >= 0) {
irq_enable = true;
out_buf[1] = byteToBcd2(BM8563_TimeStruct.hours) & 0x3f;
}
if (BM8563_DateStruct.date >= 0) {
irq_enable = true;
out_buf[2] = byteToBcd2(BM8563_DateStruct.date) & 0x3f;
}
if (BM8563_DateStruct.weekDay >= 0) {
irq_enable = true;
out_buf[3] = byteToBcd2(BM8563_DateStruct.weekDay) & 0x07;
}
uint8_t reg_value = ReadReg(0x01);
if (irq_enable) {
reg_value |= (1 << 1);
} else {
reg_value &= ~(1 << 1);
}
for (int i = 0; i < 4; i++) {
WriteReg(0x09 + i, out_buf[i]);
}
WriteReg(0x01, reg_value);
return irq_enable ? 1 : 0;
}
void BM8563::clearIRQ() {
uint8_t data = ReadReg(0x01);
WriteReg(0x01, data & 0xf3);
}
void BM8563::disableIRQ() {
clearIRQ();
uint8_t data = ReadReg(0x01);
WriteReg(0x01, data & 0xfC);
}
} // namespace bm8563
} // namespace esphome
-62
View File
@@ -1,62 +0,0 @@
#pragma once
#include "esphome/core/component.h"
#include "esphome/components/sensor/sensor.h"
#include "esphome/components/i2c/i2c.h"
namespace esphome {
namespace bm8563 {
typedef struct
{
int8_t hours;
int8_t minutes;
int8_t seconds;
} BM8563_TimeTypeDef;
typedef struct
{
int8_t weekDay;
int8_t month;
int8_t date;
int16_t year;
} BM8563_DateTypeDef;
class BM8563 : public Component, public i2c::I2CDevice {
public:
void setup() override;
void loop() override;
void dump_config() override;
void set_sleep_duration(uint32_t time_ms);
bool getVoltLow();
void getTime(BM8563_TimeTypeDef* BM8563_TimeStruct);
void getDate(BM8563_DateTypeDef* BM8563_DateStruct);
void setTime(BM8563_TimeTypeDef* BM8563_TimeStruct);
void setDate(BM8563_DateTypeDef* BM8563_DateStruct);
int SetAlarmIRQ(int afterSeconds);
int SetAlarmIRQ(const BM8563_TimeTypeDef &BM8563_TimeStruct);
int SetAlarmIRQ(const BM8563_DateTypeDef &BM8563_DateStruct, const BM8563_TimeTypeDef &BM8563_TimeStruct);
void clearIRQ();
void disableIRQ();
void WriteReg(uint8_t reg, uint8_t data);
uint8_t ReadReg(uint8_t reg);
private:
uint8_t bcd2ToByte(uint8_t value);
uint8_t byteToBcd2(uint8_t value);
uint8_t trdata[7];
optional<uint64_t> sleep_duration_;
bool setupComplete;
};
} // namespace bm8563
} // namespace esphome
-30
View File
@@ -1,30 +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"]
MULTI_CONF = True
AUTO_LOAD = ["switch"]
CODEOWNERS = ["@brotherdust"]
m5stack_4relay_ns = cg.esphome_ns.namespace("m5stack_4relay")
M5STACK4RELAYOutput = m5stack_4relay_ns.class_(
"M5STACK4RELAYSwitchComponent", cg.Component, i2c.I2CDevice
)
CONFIG_SCHEMA = (
cv.Schema(
{
cv.GenerateID(): cv.declare_id(M5STACK4RELAYOutput),
}
)
.extend(cv.COMPONENT_SCHEMA)
.extend(i2c.i2c_device_schema(0x26))
)
def to_code(config):
var = cg.new_Pvariable(config[CONF_ID])
yield cg.register_component(var, config)
yield i2c.register_i2c_device(var, config)
@@ -1,49 +0,0 @@
#include "m5stack_4relay.h"
#include <bitset>
#include "esphome/core/log.h"
namespace esphome {
namespace m5stack_4relay {
static const char *const TAG = "m5stack_4relay.switch";
void M5STACK4RELAYSwitchComponent::setup() {
ESP_LOGCONFIG(TAG, "Setting up M5STACK4RELAY (0x%02X)...", this->address_);
component_status = 0;
get_status(&component_status);
ESP_LOGD(TAG, "Setup Status 0x%02X", component_status);
}
M5STACK4RELAYChannel *M5STACK4RELAYSwitchComponent::create_channel(uint8_t channel) {
return new M5STACK4RELAYChannel(this, channel);
}
void M5STACK4RELAYSwitchComponent::get_status(uint8_t *state) { this->read_byte(RELAY_CONTROL_REG); }
bool M5STACK4RELAYSwitchComponent::set_channel_value_(uint8_t channel, bool state) {
get_status(&component_status);
ESP_LOGD(TAG, "Current status 0x%02X", component_status);
ESP_LOGD(TAG, "Desired channel: %1u", channel);
ESP_LOGD(TAG, "Desired state: %1u", state);
channel = 3 - channel;
if (state) {
component_status |= (1u << channel);
} else {
component_status &= ~(1u << channel);
}
ESP_LOGD(TAG, "New status 0x%02X", component_status);
return this->write_byte(this->address_, RELAY_CONTROL_REG, component_status);
}
void M5STACK4RELAYChannel::write_state(bool state) {
if (!this->set_channel_value_(this->channel_, state)) {
publish_state(false);
} else {
publish_state(state);
}
}
} // namespace m5stack_4relay
} // namespace esphome
@@ -1,49 +0,0 @@
#pragma once
#include "esphome/components/i2c/i2c.h"
#include "esphome/components/switch/switch.h"
#include "esphome/core/component.h"
#include "esphome/core/log.h"
namespace esphome {
namespace m5stack_4relay {
class M5STACK4RELAYSwitchComponent;
class M5STACK4RELAYChannel : public switch_::Switch {
public:
M5STACK4RELAYChannel(M5STACK4RELAYSwitchComponent *parent, uint8_t channel) : parent_(parent), channel_(channel) {}
protected:
void write_state(bool state) override;
M5STACK4RELAYSwitchComponent *parent_;
uint8_t channel_;
};
class M5STACK4RELAYSwitchComponent : public Component, public i2c::I2CDevice {
public:
const uint8_t MODE_CONTROL_REG = 0x10;
const uint8_t RELAY_CONTROL_REG = 0x11;
uint8_t component_status;
M5STACK4RELAYSwitchComponent() {}
M5STACK4RELAYChannel *create_channel(uint8_t channel);
void setup() override;
float get_setup_priority() const override { return setup_priority::HARDWARE; }
protected:
friend M5STACK4RELAYChannel;
void get_status(uint8_t *state);
bool set_channel_value_(uint8_t channel, bool state);
bool read_bytes_(uint8_t a_register, uint8_t *data, uint8_t len, uint32_t conversion) {
return this->raw_receive(this->address_, data, len);
}
float value_;
};
} // namespace m5stack_4relay
} // namespace esphome
-25
View File
@@ -1,25 +0,0 @@
import esphome.config_validation as cv
import esphome.codegen as cg
from esphome.components import switch
from esphome.const import CONF_ID, CONF_CHANNEL
from . import M5STACK4RELAYOutput, m5stack_4relay_ns
DEPENDENCIES = ["m5stack_4relay"]
M5STACK4RELAYChannel = m5stack_4relay_ns.class_("M5STACK4RELAYChannel", switch.Switch)
CONF_M5STACK_4RELAY_ID = "m5stack_4relay_id"
CONFIG_SCHEMA = switch.SWITCH_SCHEMA.extend(
{
cv.Required(CONF_ID): cv.declare_id(M5STACK4RELAYChannel),
cv.GenerateID(CONF_M5STACK_4RELAY_ID): cv.use_id(M5STACK4RELAYOutput),
cv.Required(CONF_CHANNEL): cv.int_range(min=0, max=3),
}
)
async def to_code(config):
paren = await cg.get_variable(config[CONF_M5STACK_4RELAY_ID])
rhs = paren.create_channel(config[CONF_CHANNEL])
var = cg.Pvariable(config[CONF_ID], rhs)
await switch.register_switch(var, config)
-1
View File
@@ -1 +0,0 @@
https://github.com/TomG736/esphome-BM8563
-28
View File
@@ -1,28 +0,0 @@
# PCA9536D i2c I/O expander
Requires a configured i2c bus
Example:
```yaml
pca9536d:
- id: my_pca
switch:
- platform: gpio
pin:
pca9536d: my_pca
number: 0
id: relay
binary_sensor:
- platform: gpio
pin:
pca9536d: my_pca
number: 1
id: button
```
# Optional parameters
`address:` defaults to 0x41
-69
View File
@@ -1,69 +0,0 @@
import esphome.codegen as cg
import esphome.config_validation as cv
from esphome import pins
from esphome.components import i2c
from esphome.const import (
CONF_ID,
CONF_INPUT,
CONF_INVERTED,
CONF_NUMBER,
CONF_MODE,
CONF_OUTPUT,
)
DEPENDENCIES = ["i2c"]
MULTI_CONF = True
CONF_PCA9536D = "pca9536d"
pca9536d_ns = cg.esphome_ns.namespace("pca9536d")
PCA9536DGPIOMode = pca9536d_ns.enum("PCA9536DGPIOMode")
PCA9536D = pca9536d_ns.class_("PCA9536D", cg.Component, i2c.I2CDevice)
PCA9536DGPIOPin = pca9536d_ns.class_("PCA9536DGPIOPin", cg.GPIOPin)
CONFIG_SCHEMA = cv.COMPONENT_SCHEMA.extend(
{
cv.Required(CONF_ID): cv.declare_id(PCA9536D),
}
).extend(i2c.i2c_device_schema(0x41))
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)
def validate_mode(value):
if not (value[CONF_INPUT] or value[CONF_OUTPUT]):
raise cv.Invalid("Mode must be either input or output")
if value[CONF_INPUT] and value[CONF_OUTPUT]:
raise cv.Invalid("Mode must be either input or output")
return value
PCA9536D_PIN_SCHEMA = cv.Schema(
{
cv.GenerateID(): cv.declare_id(PCA9536DGPIOPin),
cv.Required(CONF_PCA9536D): cv.use_id(PCA9536D),
cv.Required(CONF_NUMBER): cv.int_range(min=0, max=7),
cv.Optional(CONF_MODE, default={}): cv.All(
{
cv.Optional(CONF_INPUT, default=False): cv.boolean,
cv.Optional(CONF_OUTPUT, default=False): cv.boolean,
},
validate_mode,
),
cv.Optional(CONF_INVERTED, default=False): cv.boolean,
}
)
@pins.PIN_SCHEMA_REGISTRY.register(CONF_PCA9536D, PCA9536D_PIN_SCHEMA)
async def pca9536d_pin_to_code(config):
var = cg.new_Pvariable(config[CONF_ID])
parent = await cg.get_variable(config[CONF_PCA9536D])
cg.add(var.set_parent(parent))
cg.add(var.set_pin(config[CONF_NUMBER]))
cg.add(var.set_inverted(config[CONF_INVERTED]))
cg.add(var.set_flags(pins.gpio_flags_expr(config[CONF_MODE])))
return var
-108
View File
@@ -1,108 +0,0 @@
#include "pca9536d.h"
#include "esphome/core/log.h"
namespace esphome {
namespace pca9536d {
static const char *TAG = "pca9536d";
void PCA9536D::setup() {
ESP_LOGCONFIG(TAG, "Setting up PCA9536D...");
if (!this->read_gpio_()) {
ESP_LOGE(TAG, "PCA9536D not available under 0x%02X", this->address_);
this->mark_failed();
return;
}
this->write_gpio_();
}
void PCA9536D::dump_config() {
ESP_LOGCONFIG(TAG, "PCA9536D:");
LOG_I2C_DEVICE(this)
if (this->is_failed())
ESP_LOGE(TAG, "Communication with PCA9536D failed!");
}
bool PCA9536D::digital_read(uint8_t pin) {
this->read_gpio_();
return this->inputs_ & (1 << pin);
}
void PCA9536D::digital_write(uint8_t pin, bool value) {
if (value)
this->outputs_ |= (1 << pin);
else
this->outputs_ &= ~(1 << pin);
this->write_gpio_();
}
void PCA9536D::set_pin_mode(uint8_t pin, uint8_t mode) {
switch (mode) {
case gpio::FLAG_INPUT:
this->modes_ |= 1 << pin;
break;
case gpio::FLAG_OUTPUT:
this->modes_ &= ~(1 << pin);
break;
}
this->set_modes_();
}
bool PCA9536D::read_gpio_() {
if (this->is_failed())
return false;
uint8_t data;
if (!this->read_bytes(0, &data, 1)) {
this->status_set_warning();
return false;
}
this->inputs_ = data;
this->status_clear_warning();
return true;
}
bool PCA9536D::write_gpio_() {
if (this->is_failed())
return false;
uint8_t data = this->outputs_;
if (!this->write_bytes(1, &data, 1)) {
this->status_set_warning();
return false;
}
this->status_clear_warning();
return true;
}
bool PCA9536D::set_modes_() {
if (this->is_failed())
return false;
uint8_t data = this->modes_;
if (!this->write_bytes(3, &data, 1)) {
this->status_set_warning();
return false;
}
this->status_clear_warning();
return true;
}
void PCA9536DGPIOPin::setup() { this->pin_mode(this->flags_); }
bool PCA9536DGPIOPin::digital_read() { return this->parent_->digital_read(this->pin_) != this->inverted_; }
void PCA9536DGPIOPin::digital_write(bool value) { this->parent_->digital_write(this->pin_, value != this->inverted_); }
void PCA9536DGPIOPin::pin_mode(gpio::Flags flags) { this->parent_->set_pin_mode(this->pin_, flags); }
std::string PCA9536DGPIOPin::dump_summary() const {
return str_sprintf("%u via PCA9536D", pin_);
}
} // namespace pca9536d
} // namespace esphome
-52
View File
@@ -1,52 +0,0 @@
#pragma once
#include "esphome/core/component.h"
#include "esphome/core/hal.h"
#include "esphome/components/i2c/i2c.h"
namespace esphome {
namespace pca9536d {
class PCA9536D: public Component, public i2c::I2CDevice {
public:
void setup() override;
float get_setup_priority() const { return setup_priority::IO; }
void dump_config() override;
bool digital_read(uint8_t pin);
void digital_write(uint8_t pin, bool value);
void set_pin_mode(uint8_t pin, uint8_t mode);
protected:
bool read_gpio_();
bool write_gpio_();
bool set_modes_();
// pin modes - 0 means output, 1 means input
uint8_t modes_{0xff};
uint8_t outputs_{0x00};
uint8_t inputs_{0x00};
};
class PCA9536DGPIOPin : public GPIOPin {
public:
void setup() override;
void pin_mode(gpio::Flags flags) override;
bool digital_read() override;
void digital_write(bool value) override;
std::string dump_summary() const override;
void set_parent(PCA9536D *parent) { parent_ = parent; }
void set_pin(uint8_t pin) { pin_ = pin; }
void set_inverted(bool inverted) { inverted_ = inverted; }
void set_flags(gpio::Flags flags) { flags_ = flags; }
protected:
PCA9536D *parent_;
uint8_t pin_;
bool inverted_;
gpio::Flags flags_;
};
} // namespace pca9536d
} // namespace esphome
-57
View File
@@ -1,57 +0,0 @@
import esphome.codegen as cg
import esphome.config_validation as cv
from esphome import pins
from esphome.components import i2c
from esphome.const import CONF_ID, CONF_NUMBER, CONF_MODE, CONF_INVERTED
DEPENDENCIES = ['i2c']
MULTI_CONF = True
pca9554_ns = cg.esphome_ns.namespace('pca9554')
PCA9554GPIOMode = pca9554_ns.enum('PCA9554GPIOMode')
PCF8674_GPIO_MODES = {
'INPUT': PCA9554GPIOMode.PCA9554_INPUT,
'OUTPUT': PCA9554GPIOMode.PCA9554_OUTPUT,
}
PCA9554Component = pca9554_ns.class_('PCA9554Component', cg.Component, i2c.I2CDevice)
PCA9554GPIOPin = pca9554_ns.class_('PCA9554GPIOPin', cg.GPIOPin)
CONF_PCA9554 = 'pca9554'
CONF_PCF8575 = 'pcf8575'
CONFIG_SCHEMA = cv.Schema({
cv.Required(CONF_ID): cv.declare_id(PCA9554Component),
cv.Optional(CONF_PCF8575, default=False): cv.boolean,
}).extend(cv.COMPONENT_SCHEMA).extend(i2c.i2c_device_schema(0x20))
def to_code(config):
var = cg.new_Pvariable(config[CONF_ID])
yield cg.register_component(var, config)
yield i2c.register_i2c_device(var, config)
cg.add(var.set_pcf8575(config[CONF_PCF8575]))
def validate_pca9554_gpio_mode(value):
value = cv.string(value)
return cv.enum(PCF8674_GPIO_MODES, upper=True)(value)
PCA9554_OUTPUT_PIN_SCHEMA = cv.Schema({
cv.Required(CONF_PCA9554): cv.use_id(PCA9554Component),
cv.Required(CONF_NUMBER): cv.int_,
cv.Optional(CONF_MODE, default="OUTPUT"): validate_pca9554_gpio_mode,
cv.Optional(CONF_INVERTED, default=False): cv.boolean,
})
PCA9554_INPUT_PIN_SCHEMA = cv.Schema({
cv.Required(CONF_PCA9554): cv.use_id(PCA9554Component),
cv.Required(CONF_NUMBER): cv.int_,
cv.Optional(CONF_MODE, default="INPUT"): validate_pca9554_gpio_mode,
cv.Optional(CONF_INVERTED, default=False): cv.boolean,
})
@pins.PIN_SCHEMA_REGISTRY.register('pca9554', (PCA9554_OUTPUT_PIN_SCHEMA, PCA9554_INPUT_PIN_SCHEMA))
def pca9554_pin_to_code(config):
parent = yield cg.get_variable(config[CONF_PCA9554])
yield PCA9554GPIOPin.new(parent, config[CONF_NUMBER], config[CONF_MODE], config[CONF_INVERTED])
-96
View File
@@ -1,96 +0,0 @@
#include "pca9554.h"
#include "esphome/core/log.h"
namespace esphome {
namespace pca9554 {
static const char *TAG = "pca9554";
void PCA9554Component::setup() {
ESP_LOGCONFIG(TAG, "Setting up PCA9554...");
if (!this->read_gpio_()) {
ESP_LOGE(TAG, "PCA9554 not available under 0x%02X", this->address_);
this->mark_failed();
return;
}
this->write_gpio_();
this->read_gpio_();
}
void PCA9554Component::dump_config() {
ESP_LOGCONFIG(TAG, "PCA9554:");
LOG_I2C_DEVICE(this)
if (this->is_failed()) {
ESP_LOGE(TAG, "Communication with PCA9554 failed!");
}
}
bool PCA9554Component::digital_read(uint8_t pin) {
this->read_gpio_();
return this->input_mask_ & (1 << pin);
}
void PCA9554Component::digital_write(uint8_t pin, bool value) {
if (value) {
this->output_mask_ |= (1 << pin);
} else {
this->output_mask_ &= ~(1 << pin);
}
this->write_gpio_();
}
void PCA9554Component::pin_mode(uint8_t pin, uint8_t mode) {
switch (mode) {
case PCA9554_OUTPUT:
// Clear mode mask bit
this->mode_mask_ &= ~(1 << pin);
// Write GPIO to enable input mode
this->write_gpio_();
break;
case PCA9554_INPUT:
// Set mode mask bit
this->mode_mask_ |= 1 << pin;
break;
default:
break;
}
}
bool PCA9554Component::read_gpio_() {
if (this->is_failed())
return false;
bool success;
uint8_t data[2];
if (!success) {
this->status_set_warning();
return false;
}
this->status_clear_warning();
return true;
}
bool PCA9554Component::write_gpio_() {
if (this->is_failed())
return false;
uint16_t value = 0;
// Pins in OUTPUT mode and where pin is HIGH.
value |= this->mode_mask_ & this->output_mask_;
// Pins in INPUT mode must also be set here
value |= ~this->mode_mask_;
uint8_t data[2];
data[0] = value;
data[1] = value >> 8;
this->status_clear_warning();
return true;
}
float PCA9554Component::get_setup_priority() const { return setup_priority::IO; }
void PCA9554GPIOPin::setup() { this->pin_mode(this->mode_); }
bool PCA9554GPIOPin::digital_read() { return this->parent_->digital_read(this->pin_) != this->inverted_; }
void PCA9554GPIOPin::digital_write(bool value) { this->parent_->digital_write(this->pin_, value != this->inverted_); }
void PCA9554GPIOPin::pin_mode(uint8_t mode) { this->parent_->pin_mode(this->pin_, mode); }
PCA9554GPIOPin::PCA9554GPIOPin(PCA9554Component *parent, uint8_t pin, uint8_t mode, bool inverted)
: GPIOPin(pin, mode, inverted), parent_(parent) {}
} // namespace pca9554
} // namespace esphome
-61
View File
@@ -1,61 +0,0 @@
#pragma once
#include "esphome/core/component.h"
#include "esphome/core/esphal.h"
#include "esphome/components/i2c/i2c.h"
namespace esphome {
namespace pca9554 {
/// Modes for PCA9554 pins
enum PCA9554GPIOMode : uint8_t {
PCA9554_INPUT = INPUT,
PCA9554_OUTPUT = OUTPUT,
};
class PCA9554Component : public Component, public i2c::I2CDevice {
public:
PCA9554Component() = default;
/// Check i2c availability and setup masks
void setup() override;
/// Helper function to read the value of a pin.
bool digital_read(uint8_t pin);
/// Helper function to write the value of a pin.
void digital_write(uint8_t pin, bool value);
/// Helper function to set the pin mode of a pin.
void pin_mode(uint8_t pin, uint8_t mode);
float get_setup_priority() const override;
void dump_config() override;
protected:
bool read_gpio_();
bool write_gpio_();
/// Mask for the pin mode - 1 means input, 0 means output
uint16_t mode_mask_{0x00};
/// The mask to write as output state - 1 means HIGH, 0 means LOW
uint16_t output_mask_{0x00};
/// The state read in read_gpio_ - 1 means HIGH, 0 means LOW
uint16_t input_mask_{0x00};
};
/// Helper class to expose a PCA9554 pin as an internal input GPIO pin.
class PCA9554GPIOPin : public GPIOPin {
public:
PCA9554GPIOPin(PCA9554Component *parent, uint8_t pin, uint8_t mode, bool inverted = false);
void setup() override;
void pin_mode(uint8_t mode) override;
bool digital_read() override;
void digital_write(bool value) override;
protected:
PCA9554Component *parent_;
};
} // namespace pca9554
} // namespace esphome
Submodule components/sim7600 deleted from d754e306ad.
-3
View File
@@ -1,3 +0,0 @@
import esphome.codegen as cg
st7735_ns = cg.esphome_ns.namespace('st7735')
-41
View File
@@ -1,41 +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_ID, CONF_LAMBDA
from esphome.const import CONF_DC_PIN, CONF_CS_PIN, CONF_ID, CONF_LAMBDA, CONF_PAGES
from esphome.const import CONF_EXTERNAL_VCC, CONF_LAMBDA, CONF_MODEL, CONF_RESET_PIN, \
CONF_BRIGHTNESS
from . import st7735_ns
DEPENDENCIES = ['spi']
ST7735 = st7735_ns.class_('ST7735', cg.PollingComponent, spi.SPIDevice)
ST7735Ref = ST7735.operator('ref')
CONFIG_SCHEMA = display.FULL_DISPLAY_SCHEMA.extend({
cv.GenerateID(): cv.declare_id(ST7735),
cv.Required(CONF_RESET_PIN): pins.gpio_output_pin_schema,
cv.Required(CONF_DC_PIN): pins.gpio_output_pin_schema,
cv.Required(CONF_CS_PIN): pins.gpio_output_pin_schema,
cv.Optional(CONF_BRIGHTNESS, default=1.0): cv.percentage,
}).extend(cv.polling_component_schema('1s')).extend(spi.spi_device_schema())
def to_code(config):
var = cg.new_Pvariable(config[CONF_ID])
yield cg.register_component(var, config)
yield spi.register_spi_device(var, config)
dc = yield cg.gpio_pin_expression(config[CONF_DC_PIN])
cg.add(var.set_dc_pin(dc))
reset = yield cg.gpio_pin_expression(config[CONF_RESET_PIN])
cg.add(var.set_reset_pin(reset))
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_))
yield display.register_display(var, config)
-351
View File
@@ -1,351 +0,0 @@
#include "st7735.h"
#include "esphome/core/log.h"
#include "esphome/components/display/display_buffer.h"
namespace esphome {
namespace st7735 {
#define ST_CMD_DELAY 0x80 // special signifier for command lists
#define ST77XX_NOP 0x00
#define ST77XX_SWRESET 0x01
#define ST77XX_RDDID 0x04
#define ST77XX_RDDST 0x09
#define ST77XX_SLPIN 0x10
#define ST77XX_SLPOUT 0x11
#define ST77XX_PTLON 0x12
#define ST77XX_NORON 0x13
#define ST77XX_INVOFF 0x20
#define ST77XX_INVON 0x21
#define ST77XX_DISPOFF 0x28
#define ST77XX_DISPON 0x29
#define ST77XX_CASET 0x2A
#define ST77XX_RASET 0x2B
#define ST77XX_RAMWR 0x2C
#define ST77XX_RAMRD 0x2E
#define ST77XX_PTLAR 0x30
#define ST77XX_TEOFF 0x34
#define ST77XX_TEON 0x35
#define ST77XX_MADCTL 0x36
#define ST77XX_COLMOD 0x3A
#define ST77XX_MADCTL_MY 0x80
#define ST77XX_MADCTL_MX 0x40
#define ST77XX_MADCTL_MV 0x20
#define ST77XX_MADCTL_ML 0x10
#define ST77XX_MADCTL_RGB 0x00
#define ST77XX_RDID1 0xDA
#define ST77XX_RDID2 0xDB
#define ST77XX_RDID3 0xDC
#define ST77XX_RDID4 0xDD
// some flags for initR() :(
#define INITR_GREENTAB 0x00
#define INITR_REDTAB 0x01
#define INITR_BLACKTAB 0x02
#define INITR_18GREENTAB INITR_GREENTAB
#define INITR_18REDTAB INITR_REDTAB
#define INITR_18BLACKTAB INITR_BLACKTAB
#define INITR_144GREENTAB 0x01
#define INITR_MINI160x80 0x04
#define INITR_HALLOWING 0x05
// Some register settings
#define ST7735_MADCTL_BGR 0x08
#define ST7735_MADCTL_MH 0x04
#define ST7735_FRMCTR1 0xB1
#define ST7735_FRMCTR2 0xB2
#define ST7735_FRMCTR3 0xB3
#define ST7735_INVCTR 0xB4
#define ST7735_DISSET5 0xB6
#define ST7735_PWCTR1 0xC0
#define ST7735_PWCTR2 0xC1
#define ST7735_PWCTR3 0xC2
#define ST7735_PWCTR4 0xC3
#define ST7735_PWCTR5 0xC4
#define ST7735_VMCTR1 0xC5
#define ST7735_PWCTR6 0xFC
#define ST7735_GMCTRP1 0xE0
#define ST7735_GMCTRN1 0xE1
static const uint8_t PROGMEM
Rcmd1[] = { // 7735R init, part 1 (red or green tab)
15, // 15 commands in list:
ST77XX_SWRESET, ST_CMD_DELAY, // 1: Software reset, 0 args, w/delay
150, // 150 ms delay
ST77XX_SLPOUT, ST_CMD_DELAY, // 2: Out of sleep mode, 0 args, w/delay
255, // 500 ms delay
ST7735_FRMCTR1, 3, // 3: Framerate ctrl - normal mode, 3 arg:
0x01, 0x2C, 0x2D, // Rate = fosc/(1x2+40) * (LINE+2C+2D)
ST7735_FRMCTR2, 3, // 4: Framerate ctrl - idle mode, 3 args:
0x01, 0x2C, 0x2D, // Rate = fosc/(1x2+40) * (LINE+2C+2D)
ST7735_FRMCTR3, 6, // 5: Framerate - partial mode, 6 args:
0x01, 0x2C, 0x2D, // Dot inversion mode
0x01, 0x2C, 0x2D, // Line inversion mode
ST7735_INVCTR, 1, // 6: Display inversion ctrl, 1 arg:
0x07, // No inversion
ST7735_PWCTR1, 3, // 7: Power control, 3 args, no delay:
0xA2,
0x02, // -4.6V
0x84, // AUTO mode
ST7735_PWCTR2, 1, // 8: Power control, 1 arg, no delay:
0xC5, // VGH25=2.4C VGSEL=-10 VGH=3 * AVDD
ST7735_PWCTR3, 2, // 9: Power control, 2 args, no delay:
0x0A, // Opamp current small
0x00, // Boost frequency
ST7735_PWCTR4, 2, // 10: Power control, 2 args, no delay:
0x8A, // BCLK/2,
0x2A, // opamp current small & medium low
ST7735_PWCTR5, 2, // 11: Power control, 2 args, no delay:
0x8A, 0xEE,
ST7735_VMCTR1, 1, // 12: Power control, 1 arg, no delay:
0x0E,
ST77XX_INVOFF, 0, // 13: Don't invert display, no args
ST77XX_MADCTL, 1, // 14: Mem access ctl (directions), 1 arg:
0xC8, // row/col addr, bottom-top refresh
ST77XX_COLMOD, 1, // 15: set color mode, 1 arg, no delay:
0x05 }, // 16-bit color
Rcmd2green[] = { // 7735R init, part 2 (green tab only)
2, // 2 commands in list:
ST77XX_CASET, 4, // 1: Column addr set, 4 args, no delay:
0x00, 0x02, // XSTART = 0
0x00, 0x7F+0x02, // XEND = 127
ST77XX_RASET, 4, // 2: Row addr set, 4 args, no delay:
0x00, 0x01, // XSTART = 0
0x00, 0x9F+0x01 }, // XEND = 159
Rcmd2green144[] = { // 7735R init, part 2 (green 1.44 tab)
2, // 2 commands in list:
ST77XX_CASET, 4, // 1: Column addr set, 4 args, no delay:
0x00, 0x00, // XSTART = 0
0x00, 0x7F, // XEND = 127
ST77XX_RASET, 4, // 2: Row addr set, 4 args, no delay:
0x00, 0x00, // XSTART = 0
0x00, 0x7F }, // XEND = 127
Rcmd3[] = { // 7735R init, part 3 (red or green tab)
4, // 4 commands in list:
ST7735_GMCTRP1, 16 , // 1: Gamma Adjustments (pos. polarity), 16 args + delay:
0x02, 0x1c, 0x07, 0x12, // (Not entirely necessary, but provides
0x37, 0x32, 0x29, 0x2d, // accurate colors)
0x29, 0x25, 0x2B, 0x39,
0x00, 0x01, 0x03, 0x10,
ST7735_GMCTRN1, 16 , // 2: Gamma Adjustments (neg. polarity), 16 args + delay:
0x03, 0x1d, 0x07, 0x06, // (Not entirely necessary, but provides
0x2E, 0x2C, 0x29, 0x2D, // accurate colors)
0x2E, 0x2E, 0x37, 0x3F,
0x00, 0x00, 0x02, 0x10,
ST77XX_NORON, ST_CMD_DELAY, // 3: Normal display on, no args, w/delay
10, // 10 ms delay
ST77XX_DISPON, ST_CMD_DELAY, // 4: Main screen turn on, no args w/delay
100 }; // 100 ms delay
static const char *TAG = "st7735";
void ST7735::setup() {
ESP_LOGCONFIG(TAG, "Setting up SPI ST7735...");
this->spi_setup();
this->dc_pin_->setup(); // OUTPUT
this->init_reset_();
this->displayInit(Rcmd1);
this->displayInit(Rcmd2green);
this->displayInit(Rcmd3);
this->writecommand(ST7735_INVON);
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//this->disable();
delay(120);
//this->enable();
this->writecommand(ST7735_DISPON); //Display on
delay(120);
this->init_internal_(this->get_buffer_length_());
memset(this->buffer_, 0x00, this->get_buffer_length_());
}
void ST7735::write_display_data() {
uint16_t offsetx = 26;
uint16_t offsety = 1;
uint16_t x1 = offsetx;
uint16_t x2 = x1 + get_width_internal()-1;
uint16_t y1 = offsety;
uint16_t y2 = y1 + get_height_internal()-1;
this->enable();
// set column(x) address
this->dc_pin_->digital_write(false);
this->write_byte(ST77XX_CASET);
this->dc_pin_->digital_write(true);
this->spi_master_write_addr(x1, x2);
// set Page(y) address
this->dc_pin_->digital_write(false);
this->write_byte(ST77XX_RASET);
this->dc_pin_->digital_write(true);
this->spi_master_write_addr(y1, y2);
// Memory Write
this->dc_pin_->digital_write(false);
this->write_byte(ST77XX_RAMWR);
this->dc_pin_->digital_write(true);
this->write_array(this->buffer_, this->get_buffer_length_());
this->disable();
}
void ST7735::spi_master_write_addr(uint16_t addr1, uint16_t addr2)
{
static uint8_t Byte[4];
Byte[0] = (addr1 >> 8) & 0xFF;
Byte[1] = addr1 & 0xFF;
Byte[2] = (addr2 >> 8) & 0xFF;
Byte[3] = addr2 & 0xFF;
this->dc_pin_->digital_write(true);
this->write_array(Byte, 4);
}
void ST7735::spi_master_write_color(uint16_t color, uint16_t size)
{
static uint8_t Byte[1024];
int index = 0;
for(int i=0;i<size;i++) {
Byte[index++] = (color >> 8) & 0xFF;
Byte[index++] = color & 0xFF;
}
this->dc_pin_->digital_write(true);
return write_array(Byte, size*2);
}
void ST7735::dump_config() {
LOG_DISPLAY("", "SPI ST7735", this);
LOG_PIN(" CS Pin: ", this->cs_);
LOG_PIN(" DC Pin: ", this->dc_pin_);
LOG_PIN(" Reset Pin: ", this->reset_pin_);
LOG_UPDATE_INTERVAL(this);
}
float ST7735::get_setup_priority() const {
return setup_priority::PROCESSOR;
}
void ST7735::update() {
this->do_update_();
this->write_display_data();
}
void ST7735::loop() {
}
int ST7735::get_width_internal() {
return 80;
}
int ST7735::get_height_internal() {
return 160;
}
size_t ST7735::get_buffer_length_() {
return size_t(this->get_width_internal()) * size_t(this->get_height_internal()) * 2;
}
void HOT ST7735::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;
const uint32_t color565 = color.to_rgb_565();
// where should the bits go in the big buffer array? math...
uint16_t pos = (x + y * this->get_width_internal()) * 2;
this->buffer_[pos++] = (color565 >> 8) & 0xff;
this->buffer_[pos] = color565 & 0xff;
}
void ST7735::displayInit(const uint8_t *addr) {
uint8_t numCommands, cmd, numArgs;
uint16_t ms;
numCommands = pgm_read_byte(addr++); // Number of commands to follow
while(numCommands--) { // For each command...
cmd = pgm_read_byte(addr++); // Read command
numArgs = pgm_read_byte(addr++); // Number of args to follow
ms = numArgs & ST_CMD_DELAY; // If hibit set, delay follows args
numArgs &= ~ST_CMD_DELAY; // Mask out delay bit
this->sendcommand(cmd, addr, numArgs);
addr += numArgs;
if(ms) {
ms = pgm_read_byte(addr++); // Read post-command delay time (ms)
if(ms == 255) ms = 500; // If 255, delay for 500 ms
delay(ms);
}
}
}
void ST7735::init_reset_() {
if (this->reset_pin_ != nullptr) {
this->reset_pin_->setup();
this->reset_pin_->digital_write(true);
delay(1);
// Trigger Reset
this->reset_pin_->digital_write(false);
delay(10);
// Wake up
this->reset_pin_->digital_write(true);
}
}
void ST7735::writecommand(uint8_t value) {
this->enable();
this->dc_pin_->digital_write(false);
this->write_byte(value);
this->dc_pin_->digital_write(true);
this->disable();
}
void ST7735::writedata(uint8_t value) {
this->dc_pin_->digital_write(true);
this->enable();
this->write_byte(value);
this->disable();
}
void ST7735::sendcommand(uint8_t cmd, const uint8_t* dataBytes, uint8_t numDataBytes) {
this->writecommand(cmd);
this->senddata(dataBytes,numDataBytes);
}
void ST7735::senddata(const uint8_t* dataBytes, uint8_t numDataBytes) {
this->dc_pin_->digital_write(true); //pull DC high to indicate data
this->cs_->digital_write(false);
this->enable();
for (uint8_t i=0; i<numDataBytes; i++) {
this->transfer_byte(pgm_read_byte(dataBytes++)); //write byte - SPI library
}
this->cs_->digital_write(true);
this->disable();
}
} // namespace st7735
} // namespace esphome
-149
View File
@@ -1,149 +0,0 @@
#pragma once
#include "esphome/core/component.h"
#include "esphome/components/spi/spi.h"
#include "esphome/components/display/display_buffer.h"
// ST7735 specific commands used in init
#define ST7735_NOP 0x00
#define ST7735_SWRESET 0x01
#define ST7735_RDDID 0x04
#define ST7735_RDDST 0x09
#define ST7735_RDDPM 0x0A // Read display power mode
#define ST7735_RDD_MADCTL 0x0B // Read display MADCTL
#define ST7735_RDD_COLMOD 0x0C // Read display pixel format
#define ST7735_RDDIM 0x0D // Read display image mode
#define ST7735_RDDSM 0x0E // Read display signal mode
#define ST7735_RDDSR 0x0F // Read display self-diagnostic result (ST7735)
#define ST7735_SLPIN 0x10
#define ST7735_SLPOUT 0x11
#define ST7735_PTLON 0x12
#define ST7735_NORON 0x13
#define ST7735_INVOFF 0x20
#define ST7735_INVON 0x21
#define ST7735_GAMSET 0x26 // Gamma set
#define ST7735_DISPOFF 0x28
#define ST7735_DISPON 0x29
#define ST7735_CASET 0x2A
#define ST7735_RASET 0x2B
#define ST7735_RAMWR 0x2C
#define ST7735_RGBSET 0x2D // Color setting for 4096, 64K and 262K colors
#define ST7735_RAMRD 0x2E
#define ST7735_PTLAR 0x30
#define ST7735_VSCRDEF 0x33 // Vertical scrolling definition (ST7735)
#define ST7735_TEOFF 0x34 // Tearing effect line off
#define ST7735_TEON 0x35 // Tearing effect line on
#define ST7735_MADCTL 0x36 // Memory data access control
#define ST7735_IDMOFF 0x38 // Idle mode off
#define ST7735_IDMON 0x39 // Idle mode on
#define ST7735_RAMWRC 0x3C // Memory write continue (ST7735)
#define ST7735_RAMRDC 0x3E // Memory read continue (ST7735)
#define ST7735_COLMOD 0x3A
#define ST7735_RAMCTRL 0xB0 // RAM control
#define ST7735_RGBCTRL 0xB1 // RGB control
#define ST7735_PORCTRL 0xB2 // Porch control
#define ST7735_FRCTRL1 0xB3 // Frame rate control
#define ST7735_PARCTRL 0xB5 // Partial mode control
#define ST7735_GCTRL 0xB7 // Gate control
#define ST7735_GTADJ 0xB8 // Gate on timing adjustment
#define ST7735_DGMEN 0xBA // Digital gamma enable
#define ST7735_VCOMS 0xBB // VCOMS setting
#define ST7735_LCMCTRL 0xC0 // LCM control
#define ST7735_IDSET 0xC1 // ID setting
#define ST7735_VDVVRHEN 0xC2 // VDV and VRH command enable
#define ST7735_VRHS 0xC3 // VRH set
#define ST7735_VDVSET 0xC4 // VDV setting
#define ST7735_VCMOFSET 0xC5 // VCOMS offset set
#define ST7735_FRCTR2 0xC6 // FR Control 2
#define ST7735_CABCCTRL 0xC7 // CABC control
#define ST7735_REGSEL1 0xC8 // Register value section 1
#define ST7735_REGSEL2 0xCA // Register value section 2
#define ST7735_PWMFRSEL 0xCC // PWM frequency selection
#define ST7735_PWCTRL1 0xD0 // Power control 1
#define ST7735_VAPVANEN 0xD2 // Enable VAP/VAN signal output
#define ST7735_CMD2EN 0xDF // Command 2 enable
#define ST7735_PVGAMCTRL 0xE0 // Positive voltage gamma control
#define ST7735_NVGAMCTRL 0xE1 // Negative voltage gamma control
#define ST7735_DGMLUTR 0xE2 // Digital gamma look-up table for red
#define ST7735_DGMLUTB 0xE3 // Digital gamma look-up table for blue
#define ST7735_GATECTRL 0xE4 // Gate control
#define ST7735_SPI2EN 0xE7 // SPI2 enable
#define ST7735_PWCTRL2 0xE8 // Power control 2
#define ST7735_EQCTRL 0xE9 // Equalize time control
#define ST7735_PROMCTRL 0xEC // Program control
#define ST7735_PROMEN 0xFA // Program mode enable
#define ST7735_NVMSET 0xFC // NVM setting
#define ST7735_PROMACT 0xFE // Program action
// Some ready-made 16-bit ('565') color settings:
#define ST77XX_BLACK 0x0000
#define ST77XX_WHITE 0xFFFF
#define ST77XX_RED 0xF800
#define ST77XX_GREEN 0x07E0
#define ST77XX_BLUE 0x001F
#define ST77XX_CYAN 0x07FF
#define ST77XX_MAGENTA 0xF81F
#define ST77XX_YELLOW 0xFFE0
#define ST77XX_ORANGE 0xFC00
// Some ready-made 16-bit ('565') color settings:
#define ST7735_BLACK ST77XX_BLACK
#define ST7735_WHITE ST77XX_WHITE
#define ST7735_RED ST77XX_RED
#define ST7735_GREEN ST77XX_GREEN
#define ST7735_BLUE ST77XX_BLUE
#define ST7735_CYAN ST77XX_CYAN
#define ST7735_MAGENTA ST77XX_MAGENTA
#define ST7735_YELLOW ST77XX_YELLOW
#define ST7735_ORANGE ST77XX_ORANGE
namespace esphome {
namespace st7735 {
class ST7735 : public PollingComponent, public display::DisplayBuffer,
public spi::SPIDevice<spi::BIT_ORDER_MSB_FIRST, spi::CLOCK_POLARITY_HIGH, spi::CLOCK_PHASE_TRAILING,
spi::DATA_RATE_8MHZ> {
public:
void set_dc_pin(GPIOPin *dc_pin) { this->dc_pin_ = dc_pin; }
void set_reset_pin(GPIOPin *reset_pin) { this->reset_pin_ = reset_pin; }
// ========== 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;
void loop() override;
void write_display_data();
protected:
GPIOPin *dc_pin_;
GPIOPin *reset_pin_{nullptr};
void displayInit(const uint8_t *addr);
void sendcommand(uint8_t cmd, const uint8_t* dataBytes, uint8_t numDataBytes);
void senddata(const uint8_t* dataBytes, uint8_t numDataBytes);
void init_reset_();
void writecommand(uint8_t value);
void writedata(uint8_t value);
void spi_master_write_addr(uint16_t addr1, uint16_t addr2);
void spi_master_write_color(uint16_t color, uint16_t size);
void draw_absolute_pixel_internal(int x, int y, Color color) override;
int get_height_internal() override;
int get_width_internal() override;
size_t get_buffer_length_();
};
} // namespace st7735
} // namespace esphome
-28
View File
@@ -1,28 +0,0 @@
m5stickc
mcu-basement
mcu-cam-1
mcu-clock-1
mcu-desk-lamp
mcu-dev-1
mcu-dev-2
mcu-dev-heating
mcu-dev-lora
mcu-dev-neo
mcu-dimmer
mcu-fireplace
mcu-gate
mcu-heating
mcu-irrigation-1
mcu-mini-01
mcu-mini-02
mcu-mini-03
mcu-mini-04
mcu-patio
mcu-rf433
mcu-socket-01
mcu-socket-02
mcu-socket-03
mcu-sw-office-r
mcu-tv-light
mcu-waterproof-socket
secrets
1 m5stickc
2 mcu-basement
3 mcu-cam-1
4 mcu-clock-1
5 mcu-desk-lamp
6 mcu-dev-1
7 mcu-dev-2
8 mcu-dev-heating
9 mcu-dev-lora
10 mcu-dev-neo
11 mcu-dimmer
12 mcu-fireplace
13 mcu-gate
14 mcu-heating
15 mcu-irrigation-1
16 mcu-mini-01
17 mcu-mini-02
18 mcu-mini-03
19 mcu-mini-04
20 mcu-patio
21 mcu-rf433
22 mcu-socket-01
23 mcu-socket-02
24 mcu-socket-03
25 mcu-sw-office-r
26 mcu-tv-light
27 mcu-waterproof-socket
28 secrets
-3
View File
@@ -1,3 +0,0 @@
#!/bin/bash
ls -1 *.yaml | sed "s/.yaml//g" > devices.csv
-4
View File
@@ -1,4 +0,0 @@
mcu-clock-1
mcu-nspanel-dev
mcu-gateway
mcu-atoms3
1 mcu-clock-1
2 mcu-nspanel-dev
3 mcu-gateway
4 mcu-atoms3
-4
View File
@@ -1,4 +0,0 @@
nodemcu_cam_1
nodemcu_heating_dev
nodemcu_heating_dev_2
nodemcu_neo_0
1 nodemcu_cam_1
2 nodemcu_heating_dev
3 nodemcu_heating_dev_2
4 nodemcu_neo_0
-7
View File
@@ -1,7 +0,0 @@
mcu-nspanel-bedroom
mcu-nspanel-dev
mcu-nspanel-ex
mcu-nspanel-office-j
mcu-nspanel-office-r
mcu-nspanel-patio
mcu-nspanel-fireplace
1 mcu-nspanel-bedroom
2 mcu-nspanel-dev
3 mcu-nspanel-ex
4 mcu-nspanel-office-j
5 mcu-nspanel-office-r
6 mcu-nspanel-patio
7 mcu-nspanel-fireplace
-27
View File
@@ -1,27 +0,0 @@
mcu-basement
mcu-basement-2
mcu-clock-1
mcu-desk-lamp
mcu-dimmer
mcu-fireplace
mcu-echo
mcu-gate
mcu-heating
mcu-kitchen
mcu-office-r
mcu-mains-power
mcu-nspanel-bedroom
mcu-nspanel-office-j
mcu-nspanel-office-r
mcu-nspanel-patio
mcu-nspanel-fireplace
mcu-rf433
mcu-socket-01
mcu-socket-02
mcu-socket-03
mcu-patio
mcu-shed
mcu-staircase-light
mcu-tv-light
mcu-waterproof-socket
mcu-well
1 mcu-basement
2 mcu-basement-2
3 mcu-clock-1
4 mcu-desk-lamp
5 mcu-dimmer
6 mcu-fireplace
7 mcu-echo
8 mcu-gate
9 mcu-heating
10 mcu-kitchen
11 mcu-office-r
12 mcu-mains-power
13 mcu-nspanel-bedroom
14 mcu-nspanel-office-j
15 mcu-nspanel-office-r
16 mcu-nspanel-patio
17 mcu-nspanel-fireplace
18 mcu-rf433
19 mcu-socket-01
20 mcu-socket-02
21 mcu-socket-03
22 mcu-patio
23 mcu-shed
24 mcu-staircase-light
25 mcu-tv-light
26 mcu-waterproof-socket
27 mcu-well
+6 -4
View File
@@ -1,9 +1,10 @@
---
substitutions: substitutions:
device: air-office-r device: air-office-r
name: Office R Air name: Office R Air
name_short: Office R name_short: Office R
area: Office R area: Office R
comment: "${area} | AirQ Monitoring" comment: AirQ Monitoring
esphome: esphome:
name: mcu-${device} name: mcu-${device}
@@ -13,6 +14,7 @@ esphome:
esp32: esp32:
variant: esp32 variant: esp32
toolchain: esp-idf
framework: framework:
type: esp-idf type: esp-idf
@@ -47,7 +49,7 @@ light:
- platform: esp32_rmt_led_strip - platform: esp32_rmt_led_strip
# name: LED # name: LED
id: neo id: neo
rgb_order: GRB channel_colors: GRB
pin: 27 pin: 27
num_leds: 1 num_leds: 1
chipset: ws2812 chipset: ws2812
@@ -55,7 +57,7 @@ light:
- platform: esp32_rmt_led_strip - platform: esp32_rmt_led_strip
name: NEO name: NEO
id: neo_strip id: neo_strip
rgb_order: GRB channel_colors: GRB
pin: 25 pin: 25
num_leds: 7 num_leds: 7
chipset: ws2812 chipset: ws2812
@@ -104,7 +106,7 @@ light:
move_interval: 100ms move_interval: 100ms
sensor: sensor:
# https://blissair.com/what-is-pm-2-5.htm # https://blissair.com/what-is-pm-2-5.htm
- platform: pm1006 - platform: pm1006
uart_id: particle_uart uart_id: particle_uart
update_interval: 20s update_interval: 20s
+117
View File
@@ -0,0 +1,117 @@
---
substitutions:
device: apollo-dev #test
name: Apollo DEV #test
area: DEV
comment: --
esphome:
name: mcu-${device} #test
friendly_name: ${name} #test
area: ${area}
comment: ${comment}
esp32:
variant: esp32c6
flash_size: 8MB
toolchain: esp-idf
framework:
type: esp-idf
packages:
common: !include common/common.yaml
api:
# https://github.com/granadaxronos/120-SONG_NOKIA_RTTTL_RINGTONE_PLAYER_FOR_ARDUINO_UNO/blob/master/RTTTL_PLAYER/songs.h
actions:
- action: play_rtttl
variables:
song: string
then:
- rtttl.play:
rtttl: !lambda 'return song;'
switch:
- platform: gpio
id: accessory_power
internal: true
name: Accessory Power
pin: 4
restore_mode: ALWAYS_ON
setup_priority: 2000
web_server:
version: "3"
light:
- platform: esp32_rmt_led_strip
name: RGB LEDs
pin: 14
id: rgb_leds
chipset: WS2812
num_leds: 10
channel_colors: GRB
rmt_symbols: 48
effects:
# Use default parameters:
- random:
# Customize parameters
- random:
name: "My Slow Random Effect"
transition_length: 30s
update_interval: 30s
- random:
name: "My Fast Random Effect"
transition_length: 4s
update_interval: 5s
- addressable_rainbow:
- addressable_color_wipe:
- addressable_scan:
- addressable_twinkle:
- addressable_random_twinkle:
- addressable_fireworks:
- addressable_flicker:
- platform: esp32_rmt_led_strip
name: Onboard RGB LED
pin: 5
id: onboard_rgb_led
chipset: WS2812
num_leds: 1
channel_colors: GRB
rmt_symbols: 48
output:
- platform: ledc
pin: 18
id: buzzer_output
rtttl:
- output: buzzer_output
id: rtttl_player
i2c:
- scl: 0
sda: 1
id: i2c_1
sensor:
- platform: aht10
i2c_id: i2c_1
variant: AHT20
humidity:
name: Humidity
id: aht20_humidity
device_class: humidity
unit_of_measurement: "%"
accuracy_decimals: 2
force_update: false
state_class: measurement
temperature:
name: Temperature
id: aht20_temperature
device_class: temperature
unit_of_measurement: °C
accuracy_decimals: 2
force_update: false
state_class: measurement
id: aht20
+23 -12
View File
@@ -1,8 +1,9 @@
---
substitutions: substitutions:
device: atoms3 device: atoms3
name: AtomS3 name: AtomS3
area: DEV area: DEV
comment: "${area} | --" comment: --
esphome: esphome:
name: mcu-${device} name: mcu-${device}
@@ -20,6 +21,7 @@ esphome:
esp32: esp32:
variant: esp32s3 variant: esp32s3
flash_size: 8MB flash_size: 8MB
toolchain: esp-idf
framework: framework:
type: esp-idf type: esp-idf
@@ -32,11 +34,11 @@ pcf8574:
pcf8575: true pcf8575: true
animation: animation:
- file: "blinky.gif" - file: "assets/images/blinky.gif"
id: blinky id: blinky
resize: 128x128 resize: 128x128
type: RGB565 type: RGB565
- file: "vault_boy_walking.gif" - file: "assets/images/vault_boy_walking.gif"
id: vaultboy id: vaultboy
resize: 168x121 resize: 168x121
type: RGB565 type: RGB565
@@ -177,9 +179,9 @@ i2c:
# - 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
m5stack_4relay: m5stack_4relay:
id: m5stack_relay_1 id: m5stack_relay_1
@@ -206,7 +208,15 @@ output:
- platform: gpio - platform: gpio
id: motor_in2 id: motor_in2
pin: 2 pin: 2
- platform: ledc
pin: 16
id: gpio_tft_backlight
light:
- platform: monochromatic
id: display_tft_backlight
output: gpio_tft_backlight
restore_mode: ALWAYS_ON
switch: switch:
- platform: template - platform: template
@@ -229,7 +239,7 @@ switch:
- output.turn_off: motor_in1 - output.turn_off: motor_in1
- output.turn_off: motor_in2 - output.turn_off: motor_in2
# switch: # switch:
- platform: m5stack_4relay - platform: m5stack_4relay
name: Relay 1 name: Relay 1
id: relay_1 id: relay_1
@@ -260,7 +270,7 @@ switch:
name: "PCF8574 Pin #8" name: "PCF8574 Pin #8"
pin: pin:
pcf8574: pcf8574_hub pcf8574: pcf8574_hub
number: 17 number: 9
# One of INPUT or OUTPUT # One of INPUT or OUTPUT
mode: mode:
output: true output: true
@@ -359,18 +369,19 @@ font:
size: 12 size: 12
display: display:
- platform: st7789v - platform: mipi_spi
model: ST7789V
id: display_tft id: display_tft
model: Custom dimensions:
height: 128 height: 128
width: 128 width: 128
offset_height: 2 offset_height: 2
offset_width: 1 offset_width: 1
backlight_pin: 16 # backlight_pin: 16
cs_pin: 15 cs_pin: 15
dc_pin: 33 dc_pin: 33
reset_pin: 34 reset_pin: 34
eightbitcolor: true # eightbitcolor: true
update_interval: 1s update_interval: 1s
lambda: |- lambda: |-
//Ingress shown animation Frame. //Ingress shown animation Frame.
+2 -1
View File
@@ -1,9 +1,10 @@
---
substitutions: substitutions:
device: basement-2 device: basement-2
name_short: Basement name_short: Basement
name: Basement 2 name: Basement 2
area: Basement area: Basement
comment: "${area} | Lights" comment: Lights
esphome: esphome:
name: mcu-${device} name: mcu-${device}
+19 -18
View File
@@ -1,8 +1,9 @@
---
substitutions: substitutions:
device: basement device: basement
name: Basement name: Basement
area: Basement area: Basement
comment: "${area} | Sockets" comment: Sockets
esphome: esphome:
name: mcu-${device} name: mcu-${device}
@@ -26,7 +27,7 @@ packages:
# GPIO13 Blue Status LED # GPIO13 Blue Status LED
globals: globals:
- id: blower_auto - id: aerator_auto
type: bool type: bool
restore_value: true restore_value: true
initial_value: "true" initial_value: "true"
@@ -43,15 +44,15 @@ binary_sensor:
- min_length: 50ms - min_length: 50ms
max_length: 350ms max_length: 350ms
then: then:
- homeassistant.service: - homeassistant.action:
service: light.toggle action: light.toggle
data: data:
entity_id: light.mcu_basement_2_light entity_id: light.mcu_basement_2_light
- min_length: 351ms - min_length: 351ms
max_length: 1000ms max_length: 1000ms
then: then:
- homeassistant.service: - homeassistant.action:
service: light.toggle action: light.toggle
data: data:
entity_id: light.exercise_room entity_id: light.exercise_room
- min_length: 1001ms - min_length: 1001ms
@@ -61,12 +62,12 @@ binary_sensor:
# service: light.turn_off # service: light.turn_off
# data: # data:
# entity_id: light.basement_light # entity_id: light.basement_light
- homeassistant.service: - homeassistant.action:
service: light.turn_off action: light.turn_off
data: data:
entity_id: light.exercise_room entity_id: light.exercise_room
- homeassistant.service: - homeassistant.action:
service: light.turn_off action: light.turn_off
data: data:
entity_id: light.exercise_room_fan entity_id: light.exercise_room_fan
- platform: gpio - platform: gpio
@@ -87,14 +88,14 @@ binary_sensor:
filters: filters:
invert: invert:
on_press: on_press:
- homeassistant.service: - homeassistant.action:
service: light.turn_on action: light.turn_on
data: data:
entity_id: light.mcu_basement_2_light entity_id: light.mcu_basement_2_light
select: select:
- platform: template - platform: template
name: Sewage Treatment Blower name: Sewage Treatment Aerator Pump
icon: mdi:hair-dryer-outline icon: mdi:hair-dryer-outline
optimistic: true optimistic: true
options: options:
@@ -108,14 +109,14 @@ select:
- lambda: |- - lambda: |-
switch (i) { switch (i) {
case 0: { case 0: {
id(blower_auto) = false; id(aerator_auto) = false;
id(relay_1).turn_on(); id(relay_1).turn_on();
} break; } break;
case 1: { case 1: {
id(blower_auto) = true; id(aerator_auto) = true;
} break; } break;
case 2: case 2:
id(blower_auto) = false; id(aerator_auto) = false;
id(relay_1).turn_off(); id(relay_1).turn_off();
} }
@@ -126,7 +127,7 @@ status_led:
switch: switch:
- platform: gpio - platform: gpio
name: Sewage Treatment Blower name: Sewage Treatment Aerator Pump
icon: mdi:hair-dryer-outline icon: mdi:hair-dryer-outline
pin: 12 pin: 12
id: relay_1 id: relay_1
@@ -146,7 +147,7 @@ time:
then: then:
- if: - if:
condition: condition:
lambda: 'return id(blower_auto);' lambda: 'return id(aerator_auto);'
then: then:
- switch.turn_on: relay_1 - switch.turn_on: relay_1
- delay: 12min - delay: 12min
+21 -18
View File
@@ -1,8 +1,9 @@
---
substitutions: substitutions:
device: bedroom-lamp-left device: bedroom-lamp-left
name: Bedroom Lamp Left name: Bedroom Lamp Left
area: Bedroom area: Bedroom
comment: "${area} | Left Lamp" comment: Left Lamp
default_transition_length: 800ms default_transition_length: 800ms
esphome: esphome:
@@ -13,6 +14,7 @@ esphome:
esp32: esp32:
variant: esp32 variant: esp32
toolchain: esp-idf
framework: framework:
type: esp-idf type: esp-idf
sdkconfig_options: sdkconfig_options:
@@ -95,7 +97,7 @@ script:
id: my_light_mode id: my_light_mode
state: white state: white
then: then:
- front_panel.turn_on_leds: [ POWER, COLOR ] - front_panel.turn_on_leds: [POWER, COLOR]
- front_panel.set_level: !lambda return id(current_brightness); - front_panel.set_level: !lambda return id(current_brightness);
# In night light mode, turn off the front panel illumination, except # In night light mode, turn off the front panel illumination, except
# for the power button. # for the power button.
@@ -105,15 +107,15 @@ script:
id: my_light_mode id: my_light_mode
state: night state: night
then: then:
- front_panel.turn_on_leds: [ POWER ] - front_panel.turn_on_leds: [POWER]
- front_panel.update_leds: - front_panel.update_leds:
# If you want to control light presets from Home Assistant, then you can # If you want to control light presets from Home Assistant, then you can
# make use of the following service. # make use of the following service.
api: api:
reboot_timeout: 0s reboot_timeout: 0s
services: actions:
- service: activate_preset - action: activate_preset
variables: variables:
my_group: string my_group: string
my_preset: string my_preset: string
@@ -130,6 +132,7 @@ api:
ota: ota:
platform: esphome platform: esphome
password: !secret ota_password password: !secret ota_password
allow_partition_access: true
on_begin: on_begin:
then: then:
- light.disco_on: - light.disco_on:
@@ -201,18 +204,18 @@ light:
# These bindings have been setup below, using the binary_sensor for # These bindings have been setup below, using the binary_sensor for
# the color button. # the color button.
presets: presets:
# rgb: # rgb:
# red: { red: 100%, green: 0%, blue: 0% } # red: { red: 100%, green: 0%, blue: 0% }
# green: { red: 0%, green: 100%, blue: 0% } # green: { red: 0%, green: 100%, blue: 0% }
# blue: { red: 0%, green: 0%, blue: 100% } # blue: { red: 0%, green: 0%, blue: 100% }
# yellow: { red: 100%, green: 100%, blue: 0% } # yellow: { red: 100%, green: 100%, blue: 0% }
# purple: { red: 100%, green: 0%, blue: 100% } # purple: { red: 100%, green: 0%, blue: 100% }
# randomize: { effect: Fast Random } # randomize: { effect: Fast Random }
white: white:
cold: { color_temperature: 153 mireds } cold: {color_temperature: 153 mireds}
chilly: { color_temperature: 275 mireds } chilly: {color_temperature: 275 mireds}
luke: { color_temperature: 400 mireds } luke: {color_temperature: 400 mireds}
warm: { color_temperature: 588 mireds } warm: {color_temperature: 588 mireds}
# Binary sensors can be created for handling front panel touch / release # Binary sensors can be created for handling front panel touch / release
# events. To specify what part of the front panel to look at, the "for" # events. To specify what part of the front panel to look at, the "for"
@@ -276,8 +279,8 @@ sensor:
lambda: |- lambda: |-
return id(group_control); return id(group_control);
then: then:
- homeassistant.service: - homeassistant.action:
service: light.turn_on action: light.turn_on
data: data:
light_name: bedroom_lamp light_name: bedroom_lamp
brightness: !lambda return x; brightness: !lambda return x;
+19 -16
View File
@@ -1,8 +1,9 @@
---
substitutions: substitutions:
device: bedroom-lamp-right device: bedroom-lamp-right
name: Bedroom Lamp Right name: Bedroom Lamp Right
area: Bedroom area: Bedroom
comment: "${area} | Right Lamp" comment: Right Lamp
default_transition_length: 800ms default_transition_length: 800ms
esphome: esphome:
@@ -13,6 +14,7 @@ esphome:
esp32: esp32:
variant: esp32 variant: esp32
toolchain: esp-idf
framework: framework:
type: esp-idf type: esp-idf
sdkconfig_options: sdkconfig_options:
@@ -92,7 +94,7 @@ script:
id: my_light_mode id: my_light_mode
state: white state: white
then: then:
- front_panel.turn_on_leds: [ POWER, COLOR ] - front_panel.turn_on_leds: [POWER, COLOR]
- front_panel.set_level: !lambda return id(current_brightness); - front_panel.set_level: !lambda return id(current_brightness);
# In night light mode, turn off the front panel illumination, except # In night light mode, turn off the front panel illumination, except
# for the power button. # for the power button.
@@ -102,15 +104,15 @@ script:
id: my_light_mode id: my_light_mode
state: night state: night
then: then:
- front_panel.turn_on_leds: [ POWER ] - front_panel.turn_on_leds: [POWER]
- front_panel.update_leds: - front_panel.update_leds:
# If you want to control light presets from Home Assistant, then you can # If you want to control light presets from Home Assistant, then you can
# make use of the following service. # make use of the following service.
api: api:
reboot_timeout: 0s reboot_timeout: 0s
services: actions:
- service: activate_preset - action: activate_preset
variables: variables:
my_group: string my_group: string
my_preset: string my_preset: string
@@ -127,6 +129,7 @@ api:
ota: ota:
platform: esphome platform: esphome
password: !secret ota_password password: !secret ota_password
allow_partition_access: true
on_begin: on_begin:
then: then:
- light.disco_on: - light.disco_on:
@@ -198,18 +201,18 @@ light:
# These bindings have been setup below, using the binary_sensor for # These bindings have been setup below, using the binary_sensor for
# the color button. # the color button.
presets: presets:
# rgb: # rgb:
# red: { red: 100%, green: 0%, blue: 0% } # red: { red: 100%, green: 0%, blue: 0% }
# green: { red: 0%, green: 100%, blue: 0% } # green: { red: 0%, green: 100%, blue: 0% }
# blue: { red: 0%, green: 0%, blue: 100% } # blue: { red: 0%, green: 0%, blue: 100% }
# yellow: { red: 100%, green: 100%, blue: 0% } # yellow: { red: 100%, green: 100%, blue: 0% }
# purple: { red: 100%, green: 0%, blue: 100% } # purple: { red: 100%, green: 0%, blue: 100% }
# randomize: { effect: Fast Random } # randomize: { effect: Fast Random }
white: white:
cold: { color_temperature: 153 mireds } cold: {color_temperature: 153 mireds}
chilly: { color_temperature: 275 mireds } chilly: {color_temperature: 275 mireds}
luke: { color_temperature: 400 mireds } luke: {color_temperature: 400 mireds}
warm: { color_temperature: 588 mireds } warm: {color_temperature: 588 mireds}
# Binary sensors can be created for handling front panel touch / release # Binary sensors can be created for handling front panel touch / release
# events. To specify what part of the front panel to look at, the "for" # events. To specify what part of the front panel to look at, the "for"
+4 -4
View File
@@ -1,8 +1,9 @@
---
substitutions: substitutions:
device: c6-test-1 device: c6-test-1
name: C6 TEST 1 name: C6 TEST 1
area: DEV area: DEV
comment: "${area} | C6" comment: C6
esphome: esphome:
name: mcu-${device} name: mcu-${device}
@@ -38,10 +39,9 @@ esphome:
esp32: esp32:
variant: esp32c6 variant: esp32c6
flash_size: 16MB flash_size: 16MB
toolchain: esp-idf
framework: framework:
type: esp-idf type: esp-idf
# version: 5.4.2
# platform_version: 54.03.21
logger: logger:
hardware_uart: USB_SERIAL_JTAG hardware_uart: USB_SERIAL_JTAG
@@ -56,7 +56,7 @@ light:
- platform: esp32_rmt_led_strip - platform: esp32_rmt_led_strip
name: LED name: LED
id: led id: led
rgb_order: GRB channel_colors: GRB
pin: 8 pin: 8
num_leds: 1 num_leds: 1
# rmt_channel: 0 # rmt_channel: 0
+4 -4
View File
@@ -1,8 +1,9 @@
---
substitutions: substitutions:
device: c6-test-2 device: c6-test-2
name: C6 TEST 2 name: C6 TEST 2
area: DEV area: DEV
comment: "${area} | C6" comment: C6
esphome: esphome:
name: mcu-${device} name: mcu-${device}
@@ -38,10 +39,9 @@ esphome:
esp32: esp32:
variant: esp32c6 variant: esp32c6
flash_size: 16MB flash_size: 16MB
toolchain: esp-idf
framework: framework:
type: esp-idf type: esp-idf
# version: 5.4.2
# platform_version: 54.03.21
logger: logger:
hardware_uart: USB_SERIAL_JTAG hardware_uart: USB_SERIAL_JTAG
@@ -56,7 +56,7 @@ light:
- platform: esp32_rmt_led_strip - platform: esp32_rmt_led_strip
name: LED name: LED
id: led id: led
rgb_order: GRB channel_colors: GRB
pin: 8 pin: 8
num_leds: 1 num_leds: 1
# rmt_channel: 0 # rmt_channel: 0
+3 -2
View File
@@ -1,8 +1,9 @@
---
substitutions: substitutions:
device: cam-1 device: cam-1
name: Cam 1 name: Cam 1
area: DEV area: DEV
comment: "${area} | Camera" comment: Camera
esphome: esphome:
name: mcu-${device} name: mcu-${device}
@@ -11,8 +12,8 @@ esphome:
comment: ${comment} comment: ${comment}
esp32: esp32:
# board: esp32cam
variant: esp32 variant: esp32
toolchain: esp-idf
framework: framework:
type: esp-idf type: esp-idf
+3 -3
View File
@@ -1,8 +1,9 @@
---
substitutions: substitutions:
device: can-node-1 device: can-node-1
name: CAN Node 1 name: CAN Node 1
area: DEV area: DEV
comment: "${area} | CANopen" comment: CANopen
esphome: esphome:
name: mcu-${device} name: mcu-${device}
@@ -12,10 +13,9 @@ esphome:
esp32: esp32:
variant: esp32 variant: esp32
toolchain: esp-idf
framework: framework:
type: esp-idf type: esp-idf
# version: 5.4.2
# platform_version: 54.03.21
external_components: external_components:
- source: github://mrk-its/esphome-canopen@dev - source: github://mrk-its/esphome-canopen@dev
+3 -3
View File
@@ -1,8 +1,9 @@
---
substitutions: substitutions:
device: can-node-2 device: can-node-2
name: CAN Node 2 name: CAN Node 2
area: DEV area: DEV
comment: "${area} | CANopen" comment: CANopen
esphome: esphome:
name: mcu-${device} name: mcu-${device}
@@ -12,10 +13,9 @@ esphome:
esp32: esp32:
variant: esp32 variant: esp32
toolchain: esp-idf
framework: framework:
type: esp-idf type: esp-idf
version: 5.4.2
platform_version: 54.03.21
external_components: external_components:
- source: github://mrk-its/esphome-canopen@dev - source: github://mrk-its/esphome-canopen@dev
+8 -6
View File
@@ -1,8 +1,9 @@
---
substitutions: substitutions:
device: cec-bedroom device: cec-bedroom
name: Bedroom TV name: Bedroom TV
area: Bedroom area: Bedroom
comment: "${area} | CEC" comment: CEC
esphome: esphome:
name: mcu-${device} name: mcu-${device}
@@ -12,6 +13,7 @@ esphome:
esp32: esp32:
variant: esp32 variant: esp32
toolchain: esp-idf
framework: framework:
type: esp-idf type: esp-idf
@@ -69,7 +71,7 @@ light:
- platform: esp32_rmt_led_strip - platform: esp32_rmt_led_strip
name: LED name: LED
id: led id: led
rgb_order: GRB channel_colors: GRB
pin: 27 pin: 27
num_leds: 1 num_leds: 1
chipset: ws2812 chipset: ws2812
@@ -138,22 +140,22 @@ hdmi_cec:
then: then:
- hdmi_cec.send: # Report ARC started - hdmi_cec.send: # Report ARC started
destination: 0x0 destination: 0x0
data: [ 0xC1 ] data: [0xC1]
- opcode: 0x70 # System audio mode request - opcode: 0x70 # System audio mode request
then: then:
- hdmi_cec.send: - hdmi_cec.send:
destination: 0x0 destination: 0x0
data: [ 0x72, 0x01 ] data: [0x72, 0x01]
- opcode: 0x71 # Give audio status - opcode: 0x71 # Give audio status
then: then:
- hdmi_cec.send: - hdmi_cec.send:
destination: 0x0 destination: 0x0
data: [ 0x7A, 0x7F ] data: [0x7A, 0x7F]
- opcode: 0x7D # Give audio system mode status - opcode: 0x7D # Give audio system mode status
then: then:
- hdmi_cec.send: - hdmi_cec.send:
destination: 0x0 destination: 0x0
data: [ 0x7E, 0x01 ] data: [0x7E, 0x01]
- opcode: 0x46 # Give OSD name - opcode: 0x46 # Give OSD name
then: then:
- hdmi_cec.send: - hdmi_cec.send:
+5 -3
View File
@@ -1,8 +1,9 @@
---
substitutions: substitutions:
device: clock-1 device: clock-1
name: Clock 1 name: Clock 1
area: Office R area: Office R
comment: "${area} | Clock" comment: Clock
esphome: esphome:
name: mcu-${device} name: mcu-${device}
@@ -14,6 +15,7 @@ esphome:
esp32: esp32:
variant: esp32c3 variant: esp32c3
toolchain: esp-idf
framework: framework:
type: esp-idf type: esp-idf
# version: 5.4.2 # version: 5.4.2
@@ -39,8 +41,8 @@ packages:
# 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
api: api:
services: actions:
- service: play_rtttl - action: play_rtttl
variables: variables:
song: string song: string
then: then:
+7 -5
View File
@@ -1,8 +1,9 @@
---
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: TV Rack Clock
esphome: esphome:
name: mcu-${device} name: mcu-${device}
@@ -12,6 +13,7 @@ esphome:
esp32: esp32:
variant: esp32 variant: esp32
toolchain: esp-idf
framework: framework:
type: esp-idf type: esp-idf
@@ -21,15 +23,15 @@ external_components:
url: https://github.com/trip5/esphome-tm1650 url: https://github.com/trip5/esphome-tm1650
ref: main ref: main
refresh: 60s refresh: 60s
components: [ tm1650 ] components: [tm1650]
packages: packages:
common: !include common/common.yaml common: !include common/common.yaml
# 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
api: api:
services: actions:
- service: play_rtttl - action: play_rtttl
variables: variables:
song: string song: string
then: then:
@@ -94,7 +96,7 @@ light:
- platform: esp32_rmt_led_strip - platform: esp32_rmt_led_strip
name: LED name: LED
id: led id: led
rgb_order: GRB channel_colors: GRB
pin: 27 pin: 27
num_leds: 1 num_leds: 1
chipset: ws2812 chipset: ws2812
+3 -1
View File
@@ -1,8 +1,9 @@
---
substitutions: substitutions:
device: desk-lamp device: desk-lamp
name: Desk Lamp name: Desk Lamp
area: Room area: Room
comment: "${area} | Desk lamp" comment: Desk lamp
esphome: esphome:
name: mcu-${device} name: mcu-${device}
@@ -12,6 +13,7 @@ esphome:
esp32: esp32:
variant: esp32 variant: esp32
toolchain: esp-idf
framework: framework:
type: esp-idf type: esp-idf
+7 -11
View File
@@ -1,8 +1,9 @@
---
substitutions: substitutions:
device: dimmer device: dimmer
name: Dimmer name: Dimmer
area: Basement area: Basement
comment: "${area} | Pain cave fan" comment: Pain cave fan
esphome: esphome:
name: mcu-${device} name: mcu-${device}
@@ -16,26 +17,21 @@ esphome:
auto state = App.get_app_state(); auto state = App.get_app_state();
if (state != last_state) { if (state != last_state) {
if (state & STATUS_LED_ERROR) { if (state & STATUS_LED_ERROR) {
auto call = id(led).turn_on(); id(led).turn_on().set_effect('ERROR').perform();
call.set_effect("ERROR");
call.perform();
} else if (state & STATUS_LED_WARNING) { } else if (state & STATUS_LED_WARNING) {
auto call = id(led).turn_on(); id(led).turn_on().set_effect('BOOT').perform();
call.set_effect("BOOT");
call.perform();
} else { } else {
auto call = id(led).turn_off(); id(led).turn_off().perform();
call.perform();
} }
last_state = state; last_state = state;
} }
esp32: esp32:
variant: esp32 variant: esp32
toolchain: esp-idf
framework: framework:
type: esp-idf type: esp-idf
packages: packages:
common: !include common/common.yaml common: !include common/common.yaml
@@ -127,7 +123,7 @@ light:
- platform: esp32_rmt_led_strip - platform: esp32_rmt_led_strip
name: LED name: LED
id: led id: led
rgb_order: GRB channel_colors: GRB
pin: 27 pin: 27
num_leds: 1 num_leds: 1
# rmt_channel: 0 # rmt_channel: 0
+47 -41
View File
@@ -1,9 +1,10 @@
---
substitutions: substitutions:
device: echo-1 device: echo-1
name: Echo 1 name: Echo 1
name_short: Echo 1 name_short: Echo 1
area: DEV area: DEV
comment: "${area} | Echo" comment: Echo
esphome: esphome:
name: mcu-${device} name: mcu-${device}
@@ -14,33 +15,15 @@ esphome:
esp32: esp32:
variant: esp32 variant: esp32
framework: framework:
type: arduino type: esp-idf
# version: 2.0.14
# platform_version: 6.5.0
# type: esp-idf
# version: 5.1.2
# platform_version: 6.5.0
external_components:
- source: components
# - source:
# type: git
# url: https://github.com/nielsnl68/esphome
# ref: nvds-RTTTL_I2S
# components: [ speaker, rtttl ]
# refresh: 0s
- source: github://pr#5177
components: [ rtttl ]
refresh: 0s
packages: packages:
common: !include common/common_esp8266.yaml # this profile is without fancy features that are not supported by arduino common: !include common/common.yaml
api: api:
services: actions:
# 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 - action: play_rtttl
variables: variables:
song: string song: string
then: then:
@@ -48,8 +31,8 @@ api:
rtttl: !lambda 'return song;' rtttl: !lambda 'return song;'
# i2c: # i2c:
# sda: 26 # - sda: 26
# scl: 32 # scl: 32
# scan: true #false # scan: true #false
# frequency: 100kHz # frequency: 100kHz
@@ -80,7 +63,7 @@ light:
- platform: esp32_rmt_led_strip - platform: esp32_rmt_led_strip
name: LED name: LED
id: neo_buildin id: neo_buildin
rgb_order: GRB channel_colors: GRB
pin: 27 pin: 27
num_leds: 1 num_leds: 1
chipset: ws2812 chipset: ws2812
@@ -109,35 +92,58 @@ light:
# # brightness: 30% # # brightness: 30%
i2s_audio: i2s_audio:
- id: speaker_bus
i2s_lrclk_pin: 33 i2s_lrclk_pin: 33
i2s_bclk_pin: 19 i2s_bclk_pin: 19
media_player:
- platform: i2s_audio
id: media_out
name: ${name} Player
dac_type: external
i2s_dout_pin:
number: 22
allow_other_uses: true
mode: mono
speaker: speaker:
- platform: i2s_audio - platform: i2s_audio
id: echo_speaker id: speaker_id
i2s_audio_id: speaker_bus
dac_type: external dac_type: external
i2s_dout_pin: i2s_dout_pin: 22
number: 22
allow_other_uses: true
channel: mono channel: mono
sample_rate: 16000
buffer_duration: 100ms
- platform: mixer
id: mixer_speaker_id
output_speaker: speaker_id
num_channels: 1
task_stack_in_psram: false
source_speakers:
- id: announcement_spk_mixer_input
- id: media_spk_mixer_input
- id: rtttl_spk_mixer_input
- platform: resampler
id: media_spk_resampling_input
output_speaker: media_spk_mixer_input
- platform: resampler
id: announcement_spk_resampling_input
output_speaker: announcement_spk_mixer_input
- platform: resampler
id: rtttl_spk_resampling_input
output_speaker: rtttl_spk_mixer_input
media_player:
- platform: speaker
id: media_out
name: ${name} Player
buffer_size: 14000
media_pipeline:
speaker: media_spk_resampling_input
format: NONE
announcement_pipeline:
speaker: announcement_spk_resampling_input
format: NONE
rtttl: rtttl:
id: my_rtttl id: my_rtttl
speaker: echo_speaker speaker: rtttl_spk_resampling_input
microphone: microphone:
- platform: i2s_audio - platform: i2s_audio
id: echo_microphone id: echo_microphone
i2s_audio_id: speaker_bus
i2s_din_pin: 23 i2s_din_pin: 23
adc_type: external adc_type: external
pdm: true pdm: true
+7 -4
View File
@@ -1,9 +1,10 @@
---
substitutions: substitutions:
device: echo device: echo
name: Echo name: Echo
name_short: Echo name_short: Echo
area: Office R area: Office R
comment: "${area} | Speaker" comment: Speaker
esphome: esphome:
name: mcu-${device} name: mcu-${device}
@@ -13,6 +14,7 @@ esphome:
esp32: esp32:
variant: esp32 variant: esp32
toolchain: esp-idf
framework: framework:
type: esp-idf type: esp-idf
@@ -20,9 +22,9 @@ packages:
common: !include common/common.yaml common: !include common/common.yaml
api: api:
services: actions:
# 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 - action: play_rtttl
variables: variables:
song: string song: string
then: then:
@@ -100,7 +102,7 @@ speaker:
dac_type: external dac_type: external
i2s_dout_pin: 22 i2s_dout_pin: 22
channel: mono channel: mono
sample_rate: 48000 sample_rate: 16000
buffer_duration: 100ms # Smaller buffer buffer_duration: 100ms # Smaller buffer
- platform: mixer - platform: mixer
id: mixer_speaker_id id: mixer_speaker_id
@@ -126,6 +128,7 @@ media_player:
id: media_out id: media_out
name: Player name: Player
codec_support_enabled: false codec_support_enabled: false
buffer_size: 14000
media_pipeline: media_pipeline:
speaker: media_spk_resampling_input speaker: media_spk_resampling_input
# format: WAV # format: WAV
+5 -1
View File
@@ -1,17 +1,21 @@
---
substitutions: substitutions:
device: eworkbench device: eworkbench
name: Electronics Workbench name: Electronics Workbench
comment: "Office R | Electronics Workbench" area: Office R
comment: Electronics Workbench
esphome: esphome:
name: mcu-${device} name: mcu-${device}
friendly_name: ${name} friendly_name: ${name}
area: ${area}
comment: ${comment} comment: ${comment}
platformio_options: platformio_options:
board_build.flash_mode: dio board_build.flash_mode: dio
esp32: esp32:
variant: esp32c3 variant: esp32c3
toolchain: esp-idf
framework: framework:
type: esp-idf type: esp-idf
+3 -1
View File
@@ -1,8 +1,9 @@
---
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: Fireplace monitoring for heating
esphome: esphome:
name: mcu-${device} name: mcu-${device}
@@ -12,6 +13,7 @@ esphome:
esp32: esp32:
variant: esp32 variant: esp32
toolchain: esp-idf
framework: framework:
type: esp-idf type: esp-idf
+47 -124
View File
@@ -1,8 +1,9 @@
---
substitutions: substitutions:
device: gate device: gate
name: Gate name: Gate
area: Outside area: Outside
comment: "${area} | Gate" comment: Gate
esphome: esphome:
name: mcu-${device} name: mcu-${device}
@@ -12,6 +13,7 @@ esphome:
esp32: esp32:
variant: esp32 variant: esp32
toolchain: esp-idf
framework: framework:
type: esp-idf type: esp-idf
@@ -93,161 +95,90 @@ switch:
optimistic: true optimistic: true
restore_mode: RESTORE_DEFAULT_ON restore_mode: RESTORE_DEFAULT_ON
# Bluetooth related stuff globals:
- id: beacon_count
type: int
restore_value: no
initial_value: '0'
esp32_ble_tracker: esp32_ble_tracker:
id: ${name}_ble_tracker id: ${device}_ble_tracker
scan_parameters: scan_parameters:
duration: 1min duration: 1min
# bluetooth_proxy:
binary_sensor: binary_sensor:
- platform: ble_presence - platform: ble_presence
id: ibeacon_auris id: ibeacon_auris
ibeacon_uuid: !secret ble_beacon_toyota_auris_uuid ibeacon_uuid: !secret ble_beacon_toyota_auris_uuid
name: "Vehicle iBeacon Auris" name: "Vehicle iBeacon Auris"
timeout: 2min timeout: 2min
on_press: on_press: !include {file: common/gate_beacon_open.yaml, vars: {enable_id: enable_auris}}
- if: on_release: !include {file: common/gate_beacon_close.yaml, vars: {enable_id: enable_auris}}
condition:
and:
- switch.is_on: enable_auris
- switch.is_on: auto_open
- binary_sensor.is_off: ibeacon_yaris
- binary_sensor.is_off: ibeacon_pcx125
- binary_sensor.is_off: ibeacon_dl650
then:
- button.press: gate_open
on_release:
- if:
condition:
and:
- switch.is_on: enable_auris
- switch.is_on: auto_close
- binary_sensor.is_off: ibeacon_yaris
- binary_sensor.is_off: ibeacon_pcx125
- binary_sensor.is_off: ibeacon_dl650
then:
- button.press: gate_close
- platform: ble_presence - platform: ble_presence
id: ibeacon_yaris id: ibeacon_yaris
ibeacon_uuid: !secret ble_beacon_toyota_yaris_uuid ibeacon_uuid: !secret ble_beacon_toyota_yaris_uuid
name: "Vehicle iBeacon Yaris" name: "Vehicle iBeacon Yaris"
timeout: 2min timeout: 2min
on_press: on_press: !include {file: common/gate_beacon_open.yaml, vars: {enable_id: enable_yaris}}
- if: on_release: !include {file: common/gate_beacon_close.yaml, vars: {enable_id: enable_yaris}}
condition:
and:
- switch.is_on: enable_yaris
- switch.is_on: auto_open
- binary_sensor.is_off: ibeacon_auris
- binary_sensor.is_off: ibeacon_pcx125
- binary_sensor.is_off: ibeacon_dl650
then:
- button.press: gate_open
on_release:
- if:
condition:
and:
- switch.is_on: enable_yaris
- switch.is_on: auto_close
- binary_sensor.is_off: ibeacon_auris
- binary_sensor.is_off: ibeacon_pcx125
- binary_sensor.is_off: ibeacon_dl650
then:
- button.press: gate_close
- platform: ble_presence - platform: ble_presence
id: ibeacon_pcx125 id: ibeacon_pcx125
ibeacon_uuid: !secret ble_beacon_honda_uuid ibeacon_uuid: !secret ble_beacon_honda_uuid
name: "Vehicle iBeacon Honda PCX125" name: "Vehicle iBeacon Honda PCX125"
timeout: 2min timeout: 2min
on_press: on_press: !include {file: common/gate_beacon_open.yaml, vars: {enable_id: enable_pcx125}}
- if: on_release: !include {file: common/gate_beacon_close.yaml, vars: {enable_id: enable_pcx125}}
condition:
and:
- switch.is_on: enable_pcx125
- switch.is_on: auto_open
- binary_sensor.is_off: ibeacon_auris
- binary_sensor.is_off: ibeacon_yaris
- binary_sensor.is_off: ibeacon_dl650
then:
- button.press: gate_open
on_release:
- if:
condition:
and:
- switch.is_on: enable_pcx125
- switch.is_on: auto_close
- binary_sensor.is_off: ibeacon_auris
- binary_sensor.is_off: ibeacon_yaris
- binary_sensor.is_off: ibeacon_dl650
then:
- button.press: gate_close
- platform: ble_presence - platform: ble_presence
id: ibeacon_dl650 id: ibeacon_dl650
ibeacon_uuid: !secret ble_beacon_suzuki_uuid ibeacon_uuid: !secret ble_beacon_suzuki_uuid
name: "Vehicle iBeacon Suzuki DL650" name: "Vehicle iBeacon Suzuki DL650"
timeout: 2min timeout: 2min
on_press: on_press: !include {file: common/gate_beacon_open.yaml, vars: {enable_id: enable_dl650}}
- if: on_release: !include {file: common/gate_beacon_close.yaml, vars: {enable_id: enable_dl650}}
condition:
and:
- switch.is_on: enable_dl650
- switch.is_on: auto_open
- binary_sensor.is_off: ibeacon_auris
- binary_sensor.is_off: ibeacon_yaris
- binary_sensor.is_off: ibeacon_pcx125
then:
- button.press: gate_open
on_release:
- if:
condition:
and:
- switch.is_on: enable_dl650
- switch.is_on: auto_close
- binary_sensor.is_off: ibeacon_auris
- binary_sensor.is_off: ibeacon_yaris
- binary_sensor.is_off: ibeacon_pcx125
then:
- button.press: gate_close
# - platform: gpio
# id: gate_flash
# pin:
# number: 26
# inverted: true
# mode:
# input: true
# filters:
# - delayed_on: 10ms
- platform: gpio - platform: gpio
id: gate_ogi id: gate_ogi_state
pin: pin:
number: 32 number: 32
inverted: true inverted: true
allow_other_uses: true
mode: mode:
input: true input: true
filters: filters:
- delayed_on: 10ms - delayed_on_off: 10ms
- delayed_on_off: 1500ms
entity_category: diagnostic entity_category: diagnostic
on_multi_click: on_press:
- timing: - select.set:
- OFF for at least 1500ms id: gate_state
then: option: Open
- logger.log: "OGI ON (steady) => GATE OPEN"
on_release:
- select.set: - select.set:
id: gate_state id: gate_state
option: Closed option: Closed
- logger.log: "OGI OFF => GATE CLOSED" - logger.log: "OGI OFF (steady) => GATE CLOSED"
invalid_cooldown: 100ms - platform: gpio
id: gate_ogi_blink
pin:
number: 32
inverted: true
allow_other_uses: true
mode:
input: true
filters:
- delayed_on_off: 10ms
entity_category: diagnostic
on_multi_click:
- timing: - timing:
- ON for at least 400ms - ON for 400ms to 500ms
- OFF for at least 400ms - OFF for 400ms to 500ms
- ON for at least 400ms - ON for 400ms to 500ms
- OFF for at least 400ms - OFF for 400ms to 500ms
then: then:
- select.set: - select.set:
id: gate_state id: gate_state
option: Opening option: Opening
- logger.log: "OGI SLOW BLINK => GATE OPENING" - logger.log: "OGI SLOW BLINKING => GATE OPENING"
invalid_cooldown: 100ms invalid_cooldown: 100ms
- timing: - timing:
- ON for at most 300ms - ON for at most 300ms
@@ -258,15 +189,7 @@ binary_sensor:
- select.set: - select.set:
id: gate_state id: gate_state
option: Closing option: Closing
- logger.log: "OGI FAST BLINK => GATE CLOSING" - logger.log: "OGI FAST BLINKING => GATE CLOSING"
invalid_cooldown: 100ms
- timing:
- ON for at least 1500ms
then:
- select.set:
id: gate_state
option: Open
- logger.log: "OGI ON => GATE OPEN"
invalid_cooldown: 100ms invalid_cooldown: 100ms
select: select:
+43 -33
View File
@@ -1,8 +1,9 @@
---
substitutions: substitutions:
device: gateway device: gateway
name: Gateway name: Gateway
area: DEV area: DEV
comment: "${area} | BLE Proxy, Modbus" comment: BLE Proxy, Modbus
esphome: esphome:
name: mcu-${device} name: mcu-${device}
@@ -12,14 +13,18 @@ esphome:
esp32: esp32:
variant: esp32 variant: esp32
toolchain: esp-idf
framework: framework:
type: esp-idf type: esp-idf
advanced:
minimum_chip_revision: 3.0
sram1_as_iram: true
external_components: external_components:
# Ethernet LLDP 802.1AB transmitter # Ethernet LLDP 802.1AB transmitter
- source: github://pr#11760 # - source: github://pr#11760
components: [ethernet] # components: [ethernet]
refresh: 1h # refresh: 1h
- source: github://pr#2112 - source: github://pr#2112
components: ["m5stack_4relay"] components: ["m5stack_4relay"]
refresh: 1h refresh: 1h
@@ -49,22 +54,22 @@ i2c:
scl: 16 scl: 16
scan: true scan: true
ethernet: # ethernet:
lldp: # lldp:
# Enable LLDP transmission # # Enable LLDP transmission
#enabled: true # #enabled: true
# Optional: override default port # # Optional: override default port
port: "test-port" # port: eth
# Optional: override default system name # # Optional: override default system name
system_name: "test-system" # system_name: mcu-${device}
# Optional: override default system description # # Optional: override default system description
system_description: "test-description" # system_description: ${comment}
# Optional: override default "fast mode" burst packet count # # Optional: override default "fast mode" burst packet count
tx_fast_count: 4 # tx_fast_count: 4
# Optional: override default LLDP frame transmission interval # # Optional: override default LLDP frame transmission interval
tx_interval: 30 # tx_interval: 30
# Optional: override default hold count, used in conjuction with tx_interval to calculate overall TTL # # Optional: override default hold count, used in conjuction with tx_interval to calculate overall TTL
tx_hold: 4 # tx_hold: 4
# ethernet: # ethernet:
# type: LAN8720 # type: LAN8720
@@ -73,19 +78,19 @@ ethernet:
# clk_mode: GPIO17_OUT # clk_mode: GPIO17_OUT
# phy_addr: 0 # phy_addr: 0
# power_pin: 12 # power_pin: 12
# use_address: 10.17.240.245 # use_address: 10.17.240.245
# # Optional manual IP # # Optional manual IP
# manual_ip: # manual_ip:
# static_ip: 10.17.240.254 # static_ip: 10.17.240.254
# gateway: 10.17.240.1 # gateway: 10.17.240.1
# subnet: 255.255.255.0 # subnet: 255.255.255.0
# ethernet: # ethernet:
# use_address: 10.17.241.254 # use_address: 10.17.241.254
# use_address: 10.17.241.98 # use_address: 10.17.241.98
# use_address: mcu-gateway.local # use_address: mcu-gateway.local
uart: uart:
id: uart_modbus id: uart_modbus
@@ -124,7 +129,6 @@ sensor:
register_type: read register_type: read
value_type: U_WORD value_type: U_WORD
accuracy_decimals: 1 accuracy_decimals: 1
register_count: 1
filters: filters:
- multiply: 0.1 - multiply: 0.1
- platform: modbus_controller - platform: modbus_controller
@@ -147,7 +151,6 @@ sensor:
register_type: read register_type: read
value_type: U_WORD value_type: U_WORD
accuracy_decimals: 1 accuracy_decimals: 1
register_count: 1
filters: filters:
- multiply: 0.1 - multiply: 0.1
- platform: modbus_controller - platform: modbus_controller
@@ -187,14 +190,21 @@ sensor:
register_type: holding register_type: holding
value_type: U_WORD value_type: U_WORD
accuracy_decimals: 1 accuracy_decimals: 1
register_count: 2
filters: filters:
- calibrate_linear: - calibrate_linear:
- 50 -> 0 - 50 -> 0
- 450 -> 5 - 450 -> 5
- platform: modbus_controller
modbus_controller_id: modbus_adc_1
id: adc_1_1_padding
internal: true
address: 1
register_type: holding
value_type: U_WORD
reuse_previous_range: true
switch: switch:
- platform: modbus_controller - platform: modbus_controller
modbus_controller_id: modbus_adc_1 modbus_controller_id: modbus_adc_1
name: Readress MODBUS name: Readress MODBUS
register_type: holding register_type: holding
+10 -8
View File
@@ -1,8 +1,9 @@
---
substitutions: substitutions:
device: heater device: heater
name: Heater name: Heater
area: Basement area: Basement
comment: "${area} | Hot water and Heating control" comment: Hot water and Heating control
esphome: esphome:
name: mcu-${device} name: mcu-${device}
@@ -22,6 +23,7 @@ esphome:
esp32: esp32:
variant: esp32 variant: esp32
toolchain: esp-idf
framework: framework:
type: esp-idf type: esp-idf
@@ -248,13 +250,13 @@ switch:
sensor: sensor:
# - platform: ds248x # - platform: ds248x
- platform: dallas_temp - 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
# [22:06:25][D][dallas.sensor:082]: 0x5A041750B2C8FF28 Hot Water Tank - Bottom (Solar) # [22:06:25][D][dallas.sensor:082]: 0x5A041750B2C8FF28 Hot Water Tank - Bottom (Solar)
# [22:06:25][D][dallas.sensor:082]: 0xDB041750EAE2FF28 Heating Water Return (OUT from System, TO Heater) # [22:06:25][D][dallas.sensor:082]: 0xDB041750EAE2FF28 Heating Water Return (OUT from System, TO Heater)
# [22:06:25][D][dallas.sensor:082]: 0xB2041750CF1AFF28 Heating Water (OUT from Heater, TO System) # [22:06:25][D][dallas.sensor:082]: 0xB2041750CF1AFF28 Heating Water (OUT from Heater, TO System)
# [22:06:25][D][dallas.sensor:082]: 0x960417517301FF28 Hot Water Tank - TOP (Heater) # [22:06:25][D][dallas.sensor:082]: 0x960417517301FF28 Hot Water Tank - TOP (Heater)
# 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)
+5 -2
View File
@@ -1,8 +1,9 @@
---
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: Kitchen Worktop and Stove Lights
esphome: esphome:
name: mcu-${device} name: mcu-${device}
@@ -27,15 +28,17 @@ esphome:
- light.turn_off: light_3 - light.turn_off: light_3
# - light.turn_off: light_4 # - light.turn_off: light_4
esp32: esp32:
variant: esp32 variant: esp32
toolchain: esp-idf
framework: framework:
type: esp-idf type: esp-idf
packages: packages:
common: !include common/common.yaml common: !include common/common.yaml
api:
reboot_timeout: 300s
# PINOUTS: M5ATOM+Atom Hub Switch # PINOUTS: M5ATOM+Atom Hub Switch
# IR G12 # IR G12
+9 -11
View File
@@ -1,9 +1,10 @@
---
substitutions: substitutions:
device: lightening device: lightening
name: Lightening detector name: Lightening detector
name_short: Lightening name_short: Lightening
area: DEV area: DEV
comment: "${area} | Lightening" comment: Lightening
esphome: esphome:
name: mcu-${device} name: mcu-${device}
@@ -13,12 +14,10 @@ esphome:
esp32: esp32:
variant: esp32 variant: esp32
toolchain: esp-idf
framework: framework:
type: esp-idf type: esp-idf
external_components:
- source: components
packages: packages:
common: !include common/common.yaml common: !include common/common.yaml
@@ -38,11 +37,11 @@ as3935_i2c:
irq_pin: 26 irq_pin: 26
binary_sensor: binary_sensor:
# - platform: gpio # - platform: gpio
# # name: Button # # name: Button
# pin: # pin:
# number: 39 # number: 39
# inverted: true # inverted: true
- platform: as3935 - platform: as3935
name: Storm Alert name: Storm Alert
@@ -50,7 +49,7 @@ light:
- platform: esp32_rmt_led_strip - platform: esp32_rmt_led_strip
# name: LED # name: LED
id: neo id: neo
rgb_order: GRB channel_colors: GRB
pin: 27 pin: 27
num_leds: 1 num_leds: 1
chipset: ws2812 chipset: ws2812
@@ -62,4 +61,3 @@ sensor:
name: Energy name: Energy
distance: distance:
name: Storm Distance name: Storm Distance
+5 -4
View File
@@ -1,8 +1,9 @@
---
substitutions: substitutions:
device: lvgl-eworkbench device: lvgl-eworkbench
name: Electronics Workbench Display name: Electronics Workbench Display
area: Office R area: Office R
comment: "${area} | Electronics Workbench" comment: Electronics Workbench
esphome: esphome:
name: mcu-${device} name: mcu-${device}
@@ -13,6 +14,7 @@ esphome:
esp32: esp32:
variant: esp32s3 variant: esp32s3
flash_size: 16MB flash_size: 16MB
toolchain: esp-idf
framework: framework:
type: esp-idf type: esp-idf
@@ -103,8 +105,8 @@ power_supply:
enable_on_boot: true enable_on_boot: true
display: display:
- platform: qspi_dbi - platform: mipi_spi
model: axs15231 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
@@ -113,7 +115,6 @@ display:
height: 480 height: 480
width: 320 width: 320
cs_pin: 45 cs_pin: 45
brightness: 50
rotation: 90 rotation: 90
auto_clear_enabled: false auto_clear_enabled: false
show_test_card: true show_test_card: true
+14 -14
View File
@@ -1,3 +1,4 @@
---
substitutions: substitutions:
device: lvgl-trainer device: lvgl-trainer
name: Trainer Display name: Trainer Display
@@ -115,8 +116,8 @@ light:
default_transition_length: 500ms default_transition_length: 500ms
display: display:
- platform: qspi_dbi - platform: mipi_spi
model: axs15231 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
@@ -125,8 +126,6 @@ display:
height: 480 height: 480
width: 320 width: 320
cs_pin: 45 cs_pin: 45
brightness: 50
rotation: 90
auto_clear_enabled: false auto_clear_enabled: false
# show_test_card: true # show_test_card: true
# lambda: |- # lambda: |-
@@ -186,7 +185,7 @@ binary_sensor:
- platform: homeassistant - platform: homeassistant
id: exercise_room_light id: exercise_room_light
entity_id: light.exercise_room entity_id: light.exercise_room
publish_initial_state: true trigger_on_initial_state: true
on_state: on_state:
then: then:
lvgl.widget.update: lvgl.widget.update:
@@ -196,7 +195,7 @@ binary_sensor:
- platform: homeassistant - platform: homeassistant
id: exercise_room_fan id: exercise_room_fan
entity_id: light.mcu_dimmer_exercise_room_fan entity_id: light.mcu_dimmer_exercise_room_fan
publish_initial_state: true trigger_on_initial_state: true
on_state: on_state:
then: then:
lvgl.widget.update: lvgl.widget.update:
@@ -205,18 +204,19 @@ binary_sensor:
checked: !lambda return x; checked: !lambda return x;
lvgl: lvgl:
rotation: 90
buffer_size: 100% buffer_size: 100%
log_level: WARN log_level: WARN
color_depth: 16 color_depth: 16
default_font: montserrat_18 default_font: montserrat_18
# on_idle: # on_idle:
# - timeout: !lambda "return (id(display_timeout).state * 1000);" # - timeout: !lambda "return (id(display_timeout).state * 1000);"
# then: # then:
# - logger.log: "LVGL is idle" # - logger.log: "LVGL is idle"
# - light.turn_off: # - light.turn_off:
# id: display_backlight # id: display_backlight
# transition_length: 2500ms # transition_length: 2500ms
# - lvgl.pause: # - lvgl.pause:
top_layer: top_layer:
widgets: widgets:
- buttonmatrix: - buttonmatrix:
+3 -2
View File
@@ -1,8 +1,9 @@
---
substitutions: substitutions:
device: lvgl device: lvgl
name: LVGL name: LVGL
area: DEV area: DEV
comment: "${area} | LVGL" comment: LVGL
esphome: esphome:
name: mcu-${device} name: mcu-${device}
@@ -11,11 +12,11 @@ esphome:
comment: ${comment} comment: ${comment}
platformio_options: platformio_options:
board_build.flash_mode: dio board_build.flash_mode: dio
includes: ota.h
esp32: esp32:
variant: esp32s3 variant: esp32s3
flash_size: 16MB flash_size: 16MB
toolchain: esp-idf
framework: framework:
type: esp-idf type: esp-idf
# Required to achieve sufficient PSRAM bandwidth # Required to achieve sufficient PSRAM bandwidth
+3 -1
View File
@@ -1,8 +1,9 @@
---
substitutions: substitutions:
device: m5paper device: m5paper
name: M5Paper name: M5Paper
area: DEV area: DEV
comment: "${area} | M5Paper" comment: M5Paper
esphome: esphome:
name: mcu-${device} name: mcu-${device}
@@ -12,6 +13,7 @@ esphome:
esp32: esp32:
variant: esp32 variant: esp32
toolchain: esp-idf
framework: framework:
type: esp-idf type: esp-idf
+3 -1
View File
@@ -1,8 +1,9 @@
---
substitutions: substitutions:
device: mains-power device: mains-power
name: Mains Power name: Mains Power
area: Room area: Room
comment: "${area} | Mains Power Monitoring" comment: Mains Power Monitoring
esphome: esphome:
name: mcu-${device} name: mcu-${device}
@@ -19,6 +20,7 @@ esphome:
esp32: esp32:
variant: esp32 variant: esp32
toolchain: esp-idf
framework: framework:
type: esp-idf type: esp-idf
Loaded 100 of 132 files, more files were not shown because too many files have changed in this diff. Show more