diff --git a/common/nspanel_terminal/panel.yaml b/common/nspanel_terminal/panel.yaml index a3ae848..75a0fdd 100644 --- a/common/nspanel_terminal/panel.yaml +++ b/common/nspanel_terminal/panel.yaml @@ -81,14 +81,9 @@ ota: api: # status page until Home Assistant connects (log viewers don't subscribe to states) - on_client_connected: - - delay: 2s - - if: - condition: - api.connected: - state_subscription_only: true - then: - - lvgl.page.show: page_home + # Home Assistant has subscribed and received every state + on_client_synced: + - lvgl.page.show: page_home on_client_disconnected: - if: condition: diff --git a/mcu-car-can.yaml b/mcu-car-can.yaml index a25866c..1968b82 100644 --- a/mcu-car-can.yaml +++ b/mcu-car-can.yaml @@ -48,7 +48,7 @@ logger: globals: # CAN ID -> frames seen and the last data - id: frames_per_id - type: std::map>> + type: std::map> - id: ecm_last_seen type: uint32_t initial_value: '0' @@ -80,13 +80,12 @@ canbus: 0x262, 0x263, 0x266, 0x2C1, 0x2C3, 0x3A0, 0x3D3, 0x4AC, 0x440, 0x442, 0x443, 0x44D, 0x640}; 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 if (can_id == 0x224 && x.size() > 5 && e.second.size() == x.size()) { watch = true; - auto a = x, b = e.second; - a[5] = b[5] = 0; - changed = a != b; + changed = !std::equal(x.begin(), x.begin() + 5, e.second.begin()) || + !std::equal(x.begin() + 6, x.end(), e.second.begin() + 6); } if (watch && e.first > 1 && changed) { char hex[format_hex_pretty_size(8)]; diff --git a/mcu-clock-1.yaml b/mcu-clock-1.yaml index a779cb2..8a9ef30 100644 --- a/mcu-clock-1.yaml +++ b/mcu-clock-1.yaml @@ -51,60 +51,6 @@ api: - rtttl.play: 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: - id: alarm_id type: bool diff --git a/mcu-echo.yaml b/mcu-echo.yaml index 835d9d2..de50083 100644 --- a/mcu-echo.yaml +++ b/mcu-echo.yaml @@ -77,13 +77,6 @@ binary_sensor: id: media_out light: - # - platform: neopixelbus - # type: GRB - # pin: 27 - # variant: WS2812 - # num_leds: 1 - # name: On-Board LED" - # id: neo_buildin - platform: rgb name: Light id: led_light diff --git a/mcu-gateway.yaml b/mcu-gateway.yaml index f51dc9e..d3b5945 100644 --- a/mcu-gateway.yaml +++ b/mcu-gateway.yaml @@ -49,10 +49,6 @@ esp32: sram1_as_iram: true external_components: - # Ethernet LLDP 802.1AB transmitter - # - source: github://pr#11760 - # components: [ethernet] - # refresh: 1h - source: github://pr#2112 components: ["m5stack_4relay"] refresh: 1h @@ -67,44 +63,6 @@ i2c: scl: 16 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: id: uart_modbus tx_pin: 4 diff --git a/mcu-lvgl-4848s040.yaml b/mcu-lvgl-4848s040.yaml index 91b5f4c..d619027 100644 --- a/mcu-lvgl-4848s040.yaml +++ b/mcu-lvgl-4848s040.yaml @@ -86,14 +86,9 @@ packages: api: # status page until Home Assistant connects (log viewers don't subscribe to states) - on_client_connected: - - delay: 2s - - if: - condition: - api.connected: - state_subscription_only: true - then: - - lvgl.page.show: main_page + # Home Assistant has subscribed and received every state + on_client_synced: + - lvgl.page.show: main_page on_client_disconnected: - if: condition: diff --git a/mcu-lvgl.yaml b/mcu-lvgl.yaml index f6cb5a9..91720e5 100644 --- a/mcu-lvgl.yaml +++ b/mcu-lvgl.yaml @@ -148,14 +148,9 @@ packages: api: # status page until Home Assistant connects (log viewers don't subscribe to states) - on_client_connected: - - delay: 2s - - if: - condition: - api.connected: - state_subscription_only: true - then: - - lvgl.page.show: main_page + # Home Assistant has subscribed and received every state + on_client_synced: + - lvgl.page.show: main_page on_client_disconnected: - if: condition: diff --git a/mcu-m5core2.yaml b/mcu-m5core2.yaml index 1c5ec76..d5e1bef 100644 --- a/mcu-m5core2.yaml +++ b/mcu-m5core2.yaml @@ -127,14 +127,9 @@ mlx90640: api: # status page until Home Assistant connects (log viewers don't subscribe to states) - on_client_connected: - - delay: 2s - - if: - condition: - api.connected: - state_subscription_only: true - then: - - lvgl.page.show: {id: main_page, lvgl_id: lvgl_main} + # Home Assistant has subscribed and received every state + on_client_synced: + - lvgl.page.show: {id: main_page, lvgl_id: lvgl_main} on_client_disconnected: - if: condition: diff --git a/mcu-m5paper.yaml b/mcu-m5paper.yaml index 82b204b..f2e5a10 100644 --- a/mcu-m5paper.yaml +++ b/mcu-m5paper.yaml @@ -124,28 +124,15 @@ wifi: - component.update: m5paper_display api: - # status screen until Home Assistant connects (log viewers don't subscribe to states) - on_client_connected: - - delay: 2s - - if: - condition: - api.connected: - state_subscription_only: true - then: - - lambda: id(show_status) = false; + # status screen until Home Assistant has subscribed and received every state (log viewers don't subscribe) + on_client_synced: + - lambda: id(show_status) = false; - if: condition: lambda: return !id(calendar_page); then: - component.update: m5paper_display - # 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: + # outside the battery cycle (power button, USB) WiFi is up anyway: always refresh - script.execute: fetch_events on_client_disconnected: - if: diff --git a/mcu-tft.yaml b/mcu-tft.yaml index c5d8c23..d07ad10 100644 --- a/mcu-tft.yaml +++ b/mcu-tft.yaml @@ -38,14 +38,9 @@ packages: api: # status page until Home Assistant connects (log viewers don't subscribe to states) - on_client_connected: - - delay: 2s - - if: - condition: - api.connected: - state_subscription_only: true - then: - - lvgl.page.show: main_page + # Home Assistant has subscribed and received every state + on_client_synced: + - lvgl.page.show: main_page on_client_disconnected: - if: condition: