mirror of
https://github.com/randybb/esphome-configs.git
synced 2026-12-06 01:06:52 +01:00
ESPHome 2026.12: on_client_synced, CanPayload, cleanups
- LVGL panels (NSPanels, lvgl, lvgl-4848s040, m5core2, tft), m5paper: api on_client_synced instead of a 2 s delay and an api.connected check - car-can: on_frame x is canbus::CanPayload, frames_per_id keeps it without a heap vector - gateway: drop the commented ethernet (common/ethernet.yaml has it), LLDP (PR draft), manual_ip and use_address - clock-1, echo: drop the commented neopixelbus lights
This commit is contained in:
1 parent
01fe45ce8d
commit
0f6e2350cc
10 files changed
+23
-165
No files matched your search
@@ -81,14 +81,9 @@ ota:
|
|||||||
|
|
||||||
api:
|
api:
|
||||||
# status page until Home Assistant connects (log viewers don't subscribe to states)
|
# status page until Home Assistant connects (log viewers don't subscribe to states)
|
||||||
on_client_connected:
|
# Home Assistant has subscribed and received every state
|
||||||
- delay: 2s
|
on_client_synced:
|
||||||
- if:
|
- lvgl.page.show: page_home
|
||||||
condition:
|
|
||||||
api.connected:
|
|
||||||
state_subscription_only: true
|
|
||||||
then:
|
|
||||||
- lvgl.page.show: page_home
|
|
||||||
on_client_disconnected:
|
on_client_disconnected:
|
||||||
- if:
|
- if:
|
||||||
condition:
|
condition:
|
||||||
|
|||||||
+4
-5
@@ -48,7 +48,7 @@ logger:
|
|||||||
globals:
|
globals:
|
||||||
# CAN ID -> frames seen and the last data
|
# CAN ID -> frames seen and the last data
|
||||||
- id: frames_per_id
|
- id: frames_per_id
|
||||||
type: std::map<uint32_t, std::pair<uint32_t, std::vector<uint8_t>>>
|
type: std::map<uint32_t, std::pair<uint32_t, canbus::CanPayload>>
|
||||||
- id: ecm_last_seen
|
- id: ecm_last_seen
|
||||||
type: uint32_t
|
type: uint32_t
|
||||||
initial_value: '0'
|
initial_value: '0'
|
||||||
@@ -80,13 +80,12 @@ canbus:
|
|||||||
0x262, 0x263, 0x266, 0x2C1, 0x2C3, 0x3A0, 0x3D3, 0x4AC,
|
0x262, 0x263, 0x266, 0x2C1, 0x2C3, 0x3A0, 0x3D3, 0x4AC,
|
||||||
0x440, 0x442, 0x443, 0x44D, 0x640};
|
0x440, 0x442, 0x443, 0x44D, 0x640};
|
||||||
bool watch = std::find(std::begin(noisy), std::end(noisy), can_id) == std::end(noisy);
|
bool watch = std::find(std::begin(noisy), std::end(noisy), can_id) == std::end(noisy);
|
||||||
bool changed = e.second != x;
|
bool changed = !std::equal(x.begin(), x.end(), e.second.begin(), e.second.end());
|
||||||
// 0x224 (brake): byte 5 counts, compare the rest
|
// 0x224 (brake): byte 5 counts, compare the rest
|
||||||
if (can_id == 0x224 && x.size() > 5 && e.second.size() == x.size()) {
|
if (can_id == 0x224 && x.size() > 5 && e.second.size() == x.size()) {
|
||||||
watch = true;
|
watch = true;
|
||||||
auto a = x, b = e.second;
|
changed = !std::equal(x.begin(), x.begin() + 5, e.second.begin()) ||
|
||||||
a[5] = b[5] = 0;
|
!std::equal(x.begin() + 6, x.end(), e.second.begin() + 6);
|
||||||
changed = a != b;
|
|
||||||
}
|
}
|
||||||
if (watch && e.first > 1 && changed) {
|
if (watch && e.first > 1 && changed) {
|
||||||
char hex[format_hex_pretty_size(8)];
|
char hex[format_hex_pretty_size(8)];
|
||||||
|
|||||||
@@ -51,60 +51,6 @@ api:
|
|||||||
- rtttl.play:
|
- rtttl.play:
|
||||||
rtttl: !lambda 'return song;'
|
rtttl: !lambda 'return song;'
|
||||||
|
|
||||||
# light:
|
|
||||||
# - platform: neopixelbus
|
|
||||||
# type: GRB
|
|
||||||
# pin: 2
|
|
||||||
# variant: WS2812
|
|
||||||
# method: ESP8266_UART1
|
|
||||||
# num_leds: 1
|
|
||||||
# name: "${name} Light"
|
|
||||||
# id: neo
|
|
||||||
# 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
|
|
||||||
# - strobe:
|
|
||||||
# - strobe:
|
|
||||||
# name: Strobe Effect With Custom Values
|
|
||||||
# colors:
|
|
||||||
# - state: True
|
|
||||||
# brightness: 100%
|
|
||||||
# red: 100%
|
|
||||||
# green: 90%
|
|
||||||
# blue: 0%
|
|
||||||
# duration: 500ms
|
|
||||||
# - state: False
|
|
||||||
# duration: 250ms
|
|
||||||
# - state: True
|
|
||||||
# brightness: 100%
|
|
||||||
# red: 0%
|
|
||||||
# green: 100%
|
|
||||||
# blue: 0%
|
|
||||||
# duration: 500ms
|
|
||||||
# - flicker:
|
|
||||||
# - flicker:
|
|
||||||
# name: Flicker Effect With Custom Values
|
|
||||||
# alpha: 95%
|
|
||||||
# intensity: 1.5%
|
|
||||||
# - addressable_rainbow:
|
|
||||||
# - addressable_rainbow:
|
|
||||||
# name: Rainbow Effect With Custom Values
|
|
||||||
# speed: 10
|
|
||||||
# width: 50
|
|
||||||
# - addressable_scan:
|
|
||||||
# - addressable_scan:
|
|
||||||
# name: Scan Effect With Custom Values
|
|
||||||
# move_interval: 100ms
|
|
||||||
|
|
||||||
globals:
|
globals:
|
||||||
- id: alarm_id
|
- id: alarm_id
|
||||||
type: bool
|
type: bool
|
||||||
|
|||||||
@@ -77,13 +77,6 @@ binary_sensor:
|
|||||||
id: media_out
|
id: media_out
|
||||||
|
|
||||||
light:
|
light:
|
||||||
# - platform: neopixelbus
|
|
||||||
# type: GRB
|
|
||||||
# pin: 27
|
|
||||||
# variant: WS2812
|
|
||||||
# num_leds: 1
|
|
||||||
# name: On-Board LED"
|
|
||||||
# id: neo_buildin
|
|
||||||
- platform: rgb
|
- platform: rgb
|
||||||
name: Light
|
name: Light
|
||||||
id: led_light
|
id: led_light
|
||||||
|
|||||||
@@ -49,10 +49,6 @@ esp32:
|
|||||||
sram1_as_iram: true
|
sram1_as_iram: true
|
||||||
|
|
||||||
external_components:
|
external_components:
|
||||||
# Ethernet LLDP 802.1AB transmitter
|
|
||||||
# - source: github://pr#11760
|
|
||||||
# components: [ethernet]
|
|
||||||
# refresh: 1h
|
|
||||||
- source: github://pr#2112
|
- source: github://pr#2112
|
||||||
components: ["m5stack_4relay"]
|
components: ["m5stack_4relay"]
|
||||||
refresh: 1h
|
refresh: 1h
|
||||||
@@ -67,44 +63,6 @@ i2c:
|
|||||||
scl: 16
|
scl: 16
|
||||||
scan: true
|
scan: true
|
||||||
|
|
||||||
# ethernet:
|
|
||||||
# lldp:
|
|
||||||
# # Enable LLDP transmission
|
|
||||||
# #enabled: true
|
|
||||||
# # Optional: override default port
|
|
||||||
# port: eth
|
|
||||||
# # Optional: override default system name
|
|
||||||
# system_name: mcu-${device}
|
|
||||||
# # Optional: override default system description
|
|
||||||
# system_description: ${comment}
|
|
||||||
# # Optional: override default "fast mode" burst packet count
|
|
||||||
# tx_fast_count: 4
|
|
||||||
# # Optional: override default LLDP frame transmission interval
|
|
||||||
# tx_interval: 30
|
|
||||||
# # Optional: override default hold count, used in conjuction with tx_interval to calculate overall TTL
|
|
||||||
# tx_hold: 4
|
|
||||||
|
|
||||||
# ethernet:
|
|
||||||
# type: LAN8720
|
|
||||||
# mdc_pin: 23
|
|
||||||
# mdio_pin: 18
|
|
||||||
# clk_mode: GPIO17_OUT
|
|
||||||
# phy_addr: 0
|
|
||||||
# power_pin: 12
|
|
||||||
# use_address: 10.17.240.245
|
|
||||||
|
|
||||||
# # Optional manual IP
|
|
||||||
# manual_ip:
|
|
||||||
# static_ip: 10.17.240.254
|
|
||||||
# gateway: 10.17.240.1
|
|
||||||
# subnet: 255.255.255.0
|
|
||||||
|
|
||||||
|
|
||||||
# ethernet:
|
|
||||||
# use_address: 10.17.241.254
|
|
||||||
# use_address: 10.17.241.98
|
|
||||||
# use_address: mcu-gateway.local
|
|
||||||
|
|
||||||
uart:
|
uart:
|
||||||
id: uart_modbus
|
id: uart_modbus
|
||||||
tx_pin: 4
|
tx_pin: 4
|
||||||
|
|||||||
@@ -86,14 +86,9 @@ packages:
|
|||||||
|
|
||||||
api:
|
api:
|
||||||
# status page until Home Assistant connects (log viewers don't subscribe to states)
|
# status page until Home Assistant connects (log viewers don't subscribe to states)
|
||||||
on_client_connected:
|
# Home Assistant has subscribed and received every state
|
||||||
- delay: 2s
|
on_client_synced:
|
||||||
- if:
|
- lvgl.page.show: main_page
|
||||||
condition:
|
|
||||||
api.connected:
|
|
||||||
state_subscription_only: true
|
|
||||||
then:
|
|
||||||
- lvgl.page.show: main_page
|
|
||||||
on_client_disconnected:
|
on_client_disconnected:
|
||||||
- if:
|
- if:
|
||||||
condition:
|
condition:
|
||||||
|
|||||||
+3
-8
@@ -148,14 +148,9 @@ packages:
|
|||||||
|
|
||||||
api:
|
api:
|
||||||
# status page until Home Assistant connects (log viewers don't subscribe to states)
|
# status page until Home Assistant connects (log viewers don't subscribe to states)
|
||||||
on_client_connected:
|
# Home Assistant has subscribed and received every state
|
||||||
- delay: 2s
|
on_client_synced:
|
||||||
- if:
|
- lvgl.page.show: main_page
|
||||||
condition:
|
|
||||||
api.connected:
|
|
||||||
state_subscription_only: true
|
|
||||||
then:
|
|
||||||
- lvgl.page.show: main_page
|
|
||||||
on_client_disconnected:
|
on_client_disconnected:
|
||||||
- if:
|
- if:
|
||||||
condition:
|
condition:
|
||||||
|
|||||||
+3
-8
@@ -127,14 +127,9 @@ mlx90640:
|
|||||||
|
|
||||||
api:
|
api:
|
||||||
# status page until Home Assistant connects (log viewers don't subscribe to states)
|
# status page until Home Assistant connects (log viewers don't subscribe to states)
|
||||||
on_client_connected:
|
# Home Assistant has subscribed and received every state
|
||||||
- delay: 2s
|
on_client_synced:
|
||||||
- if:
|
- lvgl.page.show: {id: main_page, lvgl_id: lvgl_main}
|
||||||
condition:
|
|
||||||
api.connected:
|
|
||||||
state_subscription_only: true
|
|
||||||
then:
|
|
||||||
- lvgl.page.show: {id: main_page, lvgl_id: lvgl_main}
|
|
||||||
on_client_disconnected:
|
on_client_disconnected:
|
||||||
- if:
|
- if:
|
||||||
condition:
|
condition:
|
||||||
|
|||||||
+4
-17
@@ -124,28 +124,15 @@ wifi:
|
|||||||
- component.update: m5paper_display
|
- component.update: m5paper_display
|
||||||
|
|
||||||
api:
|
api:
|
||||||
# status screen until Home Assistant connects (log viewers don't subscribe to states)
|
# status screen until Home Assistant has subscribed and received every state (log viewers don't subscribe)
|
||||||
on_client_connected:
|
on_client_synced:
|
||||||
- delay: 2s
|
- lambda: id(show_status) = false;
|
||||||
- if:
|
|
||||||
condition:
|
|
||||||
api.connected:
|
|
||||||
state_subscription_only: true
|
|
||||||
then:
|
|
||||||
- lambda: id(show_status) = false;
|
|
||||||
- if:
|
- if:
|
||||||
condition:
|
condition:
|
||||||
lambda: return !id(calendar_page);
|
lambda: return !id(calendar_page);
|
||||||
then:
|
then:
|
||||||
- component.update: m5paper_display
|
- component.update: m5paper_display
|
||||||
# outside the battery cycle (power button, USB) WiFi is up anyway: always refresh
|
# outside the battery cycle (power button, USB) WiFi is up anyway: always refresh
|
||||||
- if:
|
|
||||||
condition:
|
|
||||||
and:
|
|
||||||
- lambda: return !id(calendar_page);
|
|
||||||
- api.connected:
|
|
||||||
state_subscription_only: true
|
|
||||||
then:
|
|
||||||
- script.execute: fetch_events
|
- script.execute: fetch_events
|
||||||
on_client_disconnected:
|
on_client_disconnected:
|
||||||
- if:
|
- if:
|
||||||
|
|||||||
+3
-8
@@ -38,14 +38,9 @@ packages:
|
|||||||
|
|
||||||
api:
|
api:
|
||||||
# status page until Home Assistant connects (log viewers don't subscribe to states)
|
# status page until Home Assistant connects (log viewers don't subscribe to states)
|
||||||
on_client_connected:
|
# Home Assistant has subscribed and received every state
|
||||||
- delay: 2s
|
on_client_synced:
|
||||||
- if:
|
- lvgl.page.show: main_page
|
||||||
condition:
|
|
||||||
api.connected:
|
|
||||||
state_subscription_only: true
|
|
||||||
then:
|
|
||||||
- lvgl.page.show: main_page
|
|
||||||
on_client_disconnected:
|
on_client_disconnected:
|
||||||
- if:
|
- if:
|
||||||
condition:
|
condition:
|
||||||
|
|||||||
Reference in new issue
Block a user