mirror of
https://github.com/randybb/esphome-configs.git
synced 2026-12-06 09:06:52 +01:00
Compare commits
3
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ad2a00f674 | ||
|
|
bf88390257 | ||
|
|
a7215bdef9 |
No files matched your search
@@ -48,7 +48,7 @@ psram:
|
||||
ignore_not_found: false
|
||||
|
||||
external_components:
|
||||
- source: github://ptaru/nspanel-terminal@v0.7.1
|
||||
- source: github://ptaru/nspanel-terminal@v0.8.0
|
||||
components: [nspanel_terminal]
|
||||
|
||||
wifi:
|
||||
@@ -168,6 +168,7 @@ display:
|
||||
- platform: nspanel_terminal
|
||||
id: panel
|
||||
uart_id: display_uart
|
||||
lvgl_iram: true
|
||||
width: 454
|
||||
height: 320
|
||||
update_interval: never
|
||||
@@ -224,11 +225,13 @@ font:
|
||||
size: 22
|
||||
bpp: 4
|
||||
glyphsets: [GF_Latin_Core]
|
||||
ignore_missing_glyphs: true # Inter has no U+030B (combining double acute)
|
||||
- file: "gfonts://Inter"
|
||||
id: font_s
|
||||
size: 17
|
||||
bpp: 4
|
||||
glyphsets: [GF_Latin_Core]
|
||||
ignore_missing_glyphs: true # Inter has no U+030B (combining double acute)
|
||||
|
||||
- file:
|
||||
type: web
|
||||
@@ -367,16 +370,16 @@ script:
|
||||
auto *wifi = wifi::global_wifi_component;
|
||||
const bool wifi_ok = wifi->is_connected();
|
||||
// diagnostics for slow connects after a cold start: seconds to connect, AP association
|
||||
static uint32_t connected_s = 0;
|
||||
static unsigned connected_s = 0;
|
||||
if (wifi_ok && !connected_s)
|
||||
connected_s = std::max<uint32_t>(1, millis() / 1000);
|
||||
connected_s = std::max<unsigned>(1, millis() / 1000);
|
||||
if (wifi_ok) {
|
||||
set(id(status_wifi), str_sprintf("WiFi: pripojené za %u s (%d dBm)", connected_s, wifi->wifi_rssi()), OK);
|
||||
} else {
|
||||
auto bssid = wifi->wifi_bssid();
|
||||
bool associated = std::any_of(bssid.begin(), bssid.end(), [](uint8_t b) { return b != 0; });
|
||||
set(id(status_wifi),
|
||||
str_sprintf("WiFi: pripájam... %s, %us", associated ? "AP ok, čakám na IP" : "bez AP", millis() / 1000),
|
||||
str_sprintf("WiFi: pripájam... %s, %us", associated ? "AP ok, čakám na IP" : "bez AP", unsigned(millis() / 1000)),
|
||||
WAIT);
|
||||
}
|
||||
|
||||
@@ -401,7 +404,7 @@ script:
|
||||
const bool api_ok = api::global_api_server->is_connected(true);
|
||||
set(id(status_ha), api_ok ? "Home Assistant: pripojený" : "Home Assistant: čakám...", api_ok ? OK : WAIT);
|
||||
|
||||
const uint32_t up = millis() / 1000;
|
||||
const unsigned up = millis() / 1000;
|
||||
static char build[Application::BUILD_TIME_STR_SIZE] = "";
|
||||
if (!build[0])
|
||||
App.get_build_time_string(build);
|
||||
|
||||
+127
-3
@@ -5,15 +5,19 @@
|
||||
# GPIO5 -> display_tft (display mipi_spi cs_pin)
|
||||
# GPIO15 -> display_tft (display mipi_spi dc_pin)
|
||||
# GPIO18 -> spi_bus (spi clk_pin)
|
||||
# GPIO19 M-Bus (modded NSS, stock G33) -> lora (sx127x cs_pin), LoRa868 module (Ra-01H, SX1276)
|
||||
# GPIO21 -> i2c_main (i2c sda), M-Bus SDA
|
||||
# GPIO22 -> i2c_main (i2c scl), M-Bus SCL
|
||||
# GPIO23 -> spi_bus (spi mosi_pin)
|
||||
# GPIO26 M-Bus, Port B -> lora (sx127x rst_pin)
|
||||
# GPIO27 M-Bus (modded DIO1) -> LoRa868 DIO1, unused (sx127x has no dio1)
|
||||
# GPIO35 M-Bus (modded DIO0, stock G36) -> lora (sx127x dio0_pin)
|
||||
# GPIO38 -> spi_bus (spi miso_pin)
|
||||
# GPIO39 -> touch_lcd (touchscreen ft63x6 interrupt_pin)
|
||||
# AXP192 GPIO4 -> LCD reset (on_boot)
|
||||
# Grove (free):
|
||||
# Port A red (Core2) I2C GPIO32 SDA, GPIO33 SCL
|
||||
# Port B black (base) GPIO GPIO26 out/DAC, GPIO36 in/ADC (input only)
|
||||
# Port B black (base) GPIO GPIO26 out/DAC, GPIO36 in/ADC (input only); GPIO26 taken by the LoRa868 RST
|
||||
# Port C blue (base) UART GPIO13 RX, GPIO14 TX -> i2c_port_c (i2c scl GPIO13, sda GPIO14)
|
||||
# Touch buttons (below the LCD, raw y 240-280): A prev page, B keyboard page, C next page
|
||||
# I2C:
|
||||
@@ -63,6 +67,10 @@ esp32:
|
||||
flash_size: 16MB
|
||||
framework:
|
||||
type: esp-idf
|
||||
advanced:
|
||||
flash_chip: generic
|
||||
minimum_chip_revision: 3.0
|
||||
sram1_as_iram: true
|
||||
|
||||
psram:
|
||||
mode: quad
|
||||
@@ -81,7 +89,7 @@ external_components:
|
||||
components: [axp192]
|
||||
refresh: 1h
|
||||
- source: github://randybb/esphome-components
|
||||
components: [m5stack_keyboard, m5stack_st7789v2]
|
||||
components: [m5stack_keyboard, m5stack_st7789v2, meshtastic]
|
||||
refresh: 0s
|
||||
|
||||
api:
|
||||
@@ -121,6 +129,51 @@ spi:
|
||||
mosi_pin: 23
|
||||
miso_pin: 38
|
||||
|
||||
# LoRa868 module on Meshtastic EU LongFast, RSSI/SNR of every packet (relays included)
|
||||
sx127x:
|
||||
id: lora
|
||||
spi_id: spi_bus
|
||||
cs_pin: GPIO19
|
||||
rst_pin: GPIO26
|
||||
dio0_pin: GPIO35 # modded, stock G36
|
||||
modulation: LORA
|
||||
frequency: 869525000 # Meshtastic EU_868 LongFast, slot 0
|
||||
bandwidth: 250_0kHz
|
||||
spreading_factor: 11
|
||||
coding_rate: CR_4_5
|
||||
preamble_size: 16
|
||||
sync_value: 0x2B # Meshtastic
|
||||
crc_enable: true
|
||||
pa_pin: BOOST
|
||||
pa_power: 14
|
||||
on_packet:
|
||||
- lambda: |-
|
||||
id(lora_count) += 1;
|
||||
id(lora_rssi).publish_state(rssi);
|
||||
id(lora_snr).publish_state(snr);
|
||||
- lvgl.label.update:
|
||||
id: lora_stats
|
||||
text: !lambda |-
|
||||
return str_sprintf("%.0f dBm\n%.1f dB\n%u", id(lora_rssi).state, id(lora_snr).state, id(lora_count));
|
||||
|
||||
# Typed lines go to the LongFast channel, received texts to the LoRa page
|
||||
meshtastic:
|
||||
id: mesh
|
||||
long_name: randy_m5c2
|
||||
short_name: M5C2
|
||||
on_message:
|
||||
- text_sensor.template.publish:
|
||||
id: lora_packet
|
||||
state: !lambda 'return from_name + ": " + text;'
|
||||
- lvgl.label.update:
|
||||
id: lora_last
|
||||
text: !lambda 'return from_name + ": " + text;'
|
||||
|
||||
globals:
|
||||
- id: lora_count
|
||||
type: uint32_t
|
||||
initial_value: "0"
|
||||
|
||||
axp192:
|
||||
id: pmu_axp
|
||||
i2c_id: i2c_main
|
||||
@@ -254,6 +307,17 @@ sensor:
|
||||
unit_of_measurement: °C
|
||||
device_class: temperature
|
||||
accuracy_decimals: 1
|
||||
- platform: template
|
||||
id: lora_rssi
|
||||
name: LoRa RSSI
|
||||
unit_of_measurement: dBm
|
||||
device_class: signal_strength
|
||||
accuracy_decimals: 0
|
||||
- platform: template
|
||||
id: lora_snr
|
||||
name: LoRa SNR
|
||||
unit_of_measurement: dB
|
||||
accuracy_decimals: 1
|
||||
|
||||
# RTC holds the time until Home Assistant connects, HA's time is written back on every sync
|
||||
time:
|
||||
@@ -293,6 +357,7 @@ key_collector:
|
||||
- text_sensor.template.publish:
|
||||
id: keyboard_line
|
||||
state: !lambda return x;
|
||||
- meshtastic.send_text: !lambda return x;
|
||||
- id: cardkb_collector
|
||||
source_id: cardkb
|
||||
end_keys: "\r\n"
|
||||
@@ -302,10 +367,34 @@ key_collector:
|
||||
on_progress: *line_progress
|
||||
on_result: *line_result
|
||||
|
||||
switch:
|
||||
- platform: template
|
||||
name: Unit LCD Invert
|
||||
icon: mdi:invert-colors
|
||||
optimistic: true
|
||||
restore_mode: RESTORE_DEFAULT_OFF
|
||||
entity_category: config
|
||||
on_turn_on:
|
||||
- lambda: id(unit_lcd).set_invert(true);
|
||||
on_turn_off:
|
||||
- lambda: id(unit_lcd).set_invert(false);
|
||||
- platform: template
|
||||
name: Unit LCD Sleep
|
||||
icon: mdi:sleep
|
||||
optimistic: true
|
||||
restore_mode: ALWAYS_OFF
|
||||
on_turn_on:
|
||||
- lambda: id(unit_lcd).set_sleep(true);
|
||||
on_turn_off:
|
||||
- lambda: id(unit_lcd).set_sleep(false);
|
||||
|
||||
text_sensor:
|
||||
- platform: template
|
||||
id: keyboard_line
|
||||
name: Keyboard Line
|
||||
- platform: template
|
||||
id: lora_packet
|
||||
name: Meshtastic Message
|
||||
|
||||
script:
|
||||
# same as mcu-lvgl
|
||||
@@ -514,7 +603,42 @@ lvgl:
|
||||
text_font: font_status
|
||||
text: ""
|
||||
|
||||
# 3: status (shown until Home Assistant connects)
|
||||
# 3: LoRa, last received Meshtastic packet
|
||||
- id: lora_page
|
||||
widgets:
|
||||
- label:
|
||||
align: TOP_MID
|
||||
y: 6
|
||||
text_font: font_title
|
||||
text: Meshtastic LongFast
|
||||
- label:
|
||||
x: 16
|
||||
y: 44
|
||||
text_font: font_status
|
||||
text_color: 0x8C8C8C
|
||||
text: "RSSI\nSNR\nPackets"
|
||||
- label:
|
||||
id: lora_stats
|
||||
x: 170
|
||||
y: 44
|
||||
text_font: font_status
|
||||
text: "-\n-\n0"
|
||||
- label:
|
||||
x: 16
|
||||
y: 120
|
||||
text_font: font_status
|
||||
text_color: 0x8C8C8C
|
||||
text: "Last message:"
|
||||
- label:
|
||||
id: lora_last
|
||||
x: 16
|
||||
y: 142
|
||||
width: 288
|
||||
long_mode: WRAP
|
||||
text_font: font_status
|
||||
text: "-"
|
||||
|
||||
# 4: status (shown until Home Assistant connects)
|
||||
- id: status_page
|
||||
on_load:
|
||||
- script.execute: update_status
|
||||
|
||||
Reference in new issue
Block a user