Mam text sensor.
Macek pisałem że chodzi o OLED.
Na ktorym wyświetlam ,date, godzine itp…
Nadajnik temp jest na esp01 ,odbiornik na drugim esp01 który jest podłączony do uart nodemcu.
Oba esp01 łączą się niezależnie czy jest wifi czy nie (espnow).
taki mamm yaml.
includes:
- uart_read_line_sensor.h
......
.....
.....
captive_portal:
status_led:
pin:
number: D4 #GPIO2, LED_BUILTIN
inverted: false
text_sensor:
- platform: custom
lambda: |-
auto my_custom_sensor = new UartReadLineSensor(id(uart_bus));
App.register_component(my_custom_sensor);
return {my_custom_sensor};
text_sensors:
id: uart_readline
display:
- platform: ssd1306_i2c
model: "SSD1306 128x64"
reset_pin: D0
address: 0x3C
id: my_display
pages:
- id: page1
lambda: |-
// Print time in HH:MM format
it.strftime(0,16, id(font1), TextAlign::BASELINE_LEFT, "%d-%m-%Y", id(sntp_time).now());
it.strftime(0, 40, id(font2), TextAlign::BASELINE_LEFT, "%X", id(sntp_time).now());
it.strftime(0, 62, id(font2), TextAlign::BASELINE_LEFT, "%A", id(sntp_time).now());
it.printf(0, 15, id(font1), "%s", id(uart_readline).state.c_str());
co dziwne raz na jakiś czas oled wyświetli dane z uartu.
czasem po resecie czasem po pół godziny.
w logach lecą cały czas
[21:15:38][C][uart.arduino_esp8266:100]: UART Bus:
[21:15:38][C][uart.arduino_esp8266:101]: TX Pin: GPIO16
[21:15:38][C][uart.arduino_esp8266:102]: RX Pin: GPIO5
[21:15:38][C][uart.arduino_esp8266:104]: RX Buffer Size: 256
[21:15:38][C][uart.arduino_esp8266:106]: Baud Rate: 9600 baud
[21:15:38][C][uart.arduino_esp8266:107]: Data Bits: 8
[21:15:38][C][uart.arduino_esp8266:108]: Parity: NONE
[21:15:38][C][uart.arduino_esp8266:109]: Stop bits: 1
[21:15:38][C][uart.arduino_esp8266:113]: Using software serial
[21:15:38][C][ssd1306_i2c:023]: I2C SSD1306
[21:15:38][C][ssd1306_i2c:023]: Rotations: 0 °
[21:15:38][C][ssd1306_i2c:023]: Dimensions: 128px x 64px
[21:15:38][C][ssd1306_i2c:024]: Address: 0x3C
[21:15:38][C][ssd1306_i2c:025]: Model: SSD1306 128x64
[21:15:38][C][ssd1306_i2c:026]: Reset Pin: GPIO16
[21:15:38][C][ssd1306_i2c:027]: External VCC: NO
[21:15:38][C][ssd1306_i2c:028]: Flip X: YES
[21:15:38][C][ssd1306_i2c:029]: Flip Y: YES
[21:15:38][C][ssd1306_i2c:030]: Offset X: 0
[21:15:38][C][ssd1306_i2c:031]: Offset Y: 0
[21:15:38][C][ssd1306_i2c:032]: Inverted Color: NO
[21:15:38][C][ssd1306_i2c:033]: Update Interval: 1.0s
[21:15:38][C][captive_portal:144]: Captive Portal:
[21:15:38][C][web_server:162]: Web Server:
[21:15:38][C][web_server:163]: Address: node4.local:80
[21:15:38][C][api:134]: API Server:
[21:15:38][C][api:135]: Address: node4.local:6053
[21:15:38][C][api:139]: Using noise encryption: NO
[21:15:38][C][sntp:050]: SNTP Time:
[21:15:38][C][sntp:051]: Server 1: ‘0.pool.ntp.org’
[21:15:38][C][sntp:052]: Server 2: ‘1.pool.ntp.org’
[21:15:38][C][sntp:053]: Server 3: ‘2.pool.ntp.org’
[21:15:38][C][sntp:054]: Timezone: ‘CET-1CEST,M3.5.0,M10.5.0/3’
[21:15:38][C][mdns:084]: mDNS:
[21:15:38][C][mdns:085]: Hostname: node4
[21:15:39][D][uart_debug:158]: <<< "Transmitter MacAddr: dc:4f:22:58:65:f9, Temperature: 25.62, Humidity: 26.25, "
[21:15:41][D][uart_debug:158]: <<< "Transmitter MacAddr: dc:4f:22:58:65:f9, Temperature: 25.69, Humidity: 26.38, "
[21:15:43][D][uart_debug:158]: <<< "Transmitter MacAddr: dc:4f:22:58:65:f9, Temperature: 25.69, Humidity: 26.44, "
[21:15:44][D][uart_debug:158]: <<< "Transmitter MacAddr: dc:4f:22:58:65:f9, Temperature: 25.75, Humidity: 26.50, "
[21:15:46][D][uart_debug:158]: <<< "Transmitter MacAddr: dc:4f:22:58:65:f9, Temperature: 25.81, Humidity: 26.56, "
[21:15:48][D][uart_debug:158]: <<< "Transmitter MacAddr: dc:4f:22:58:65:f9, Temperature: 25.81, Humidity: 26.56, "
[21:15:50][D][uart_debug:158]: <<< "Transmitter MacAddr: dc:4f:22:58:65:f9, Temperature: 25.81, "
[21:15:50][D][uart_debug:158]: <<< "Humidity: 26.50, "
[21:15:51][D][uart_debug:158]: <<< "Transmitter MacAddr: dc:4f:22:58:65:f9, Temperature: 25.75, Humidity: 26.44, "
[21:15:53][D][uart_debug:158]: <<< "Transmitter MacAddr: dc:4f:22:58:65:f9, Temperature: 25.75, Humidity: 26.44, "
[21:15:55][D][uart_debug:158]: <<< "Transmitter MacAddr: dc:4f:22:58:65:f9, Temperature: 25.75, Humidity: 26.38, "
[21:15:57][D][uart_debug:158]: <<< "Transmitter MacAddr: dc:4f:22:58:65:f9, Temperature: 25.75, Humidity: 26.38, "
[21:15:59][D][uart_debug:158]: <<< "Transmitter MacAddr: dc:4f:22:58:65:f9, Temp