test for v0.7

This commit is contained in:
pszafer
2024-04-05 20:15:18 +02:00
parent 8cdbbdbfc8
commit 7550791f43
29 changed files with 7816 additions and 1 deletions

9
devices_v0_7/buzzer.yaml Normal file
View File

@@ -0,0 +1,9 @@
switch:
- platform: gpio
id: buzzer
name: 'Buzzer'
pin:
number: GPIO2
mode:
output: true
inverted: false

124
devices_v0_7/display.yaml Normal file
View File

@@ -0,0 +1,124 @@
#i2c address: 0x3C input oled
sensor:
- platform: uptime
id: wt32_uptime_seconds
update_interval: 60s
entity_category: diagnostic
on_raw_value:
then:
- text_sensor.template.publish:
id: wt32_uptime
state: !lambda |-
int seconds = round(id(wt32_uptime_seconds).raw_state);
int days = seconds / (24 * 3600);
seconds = seconds % (24 * 3600);
int hours = seconds / 3600;
seconds = seconds % 3600;
int minutes = seconds / 60;
return (
(days ? to_string(days) + "d " : "") +
(hours ? to_string(hours) + "h " : "") +
(to_string(minutes) + "m")
).c_str();
text_sensor:
- platform: template
name: Uptime
id: wt32_uptime
entity_category: diagnostic
icon: mdi:clock-start
script:
- id: screensaver_script
# screensaver script, turn on screensaver after 30 seconds, restart counter each time when invoked
mode: restart
then:
# set the time after which the screensaver will be activated
- delay: 30s
- display.page.show: screensaver
- component.update: oled_display
esphome:
on_boot:
# by default display show the first page defined in display (which is the logo page) until full initialization
# after that we show the first_page and start the screensaver script
priority: 0
then:
- display.page.show: first_page
- component.update: oled_display
- script.execute: screensaver_script
binary_sensor:
- platform: gpio
entity_category: config
id: boneIO_button
pin:
pcf8574: pcf_inputs_28to35_menu
number: 7
mode:
input: true
inverted: true
on_press:
then:
# woke up when on the screensaver, as well do not include the logo page and screensaver in a loop when pushing a button
- if:
condition:
# on the last page go to the first page skipping the screensaver and logo page
display.is_displaying_page: last_page
then:
- display.page.show: first_page
- component.update: oled_display
else:
- if:
condition:
# on the screensaver, show the logo for a while and display the first page
display.is_displaying_page: screensaver
then:
- display.page.show: first_page
- component.update: oled_display
else:
# not the last page and screensaver go to the next page
- display.page.show_next: oled_display
- component.update: oled_display
# restart screensaver script
- script.execute: screensaver_script
# it.printf(4, 37, id(roboto_9), TextAlign::BASELINE_LEFT ,"IP addr:");
# it.printf(124, 37, id(roboto_9), TextAlign::BASELINE_RIGHT ,"%s", id(eth).get_ip_addresses().str().c_str());
display:
- platform: ssd1306_i2c
id: oled_display
model: 'SH1106 128x64'
address: 0x3C
i2c_id: bus_b
contrast: 0.5
pages:
- id: first_page
lambda: |-
it.rectangle(0, 0, 126, 15);
it.printf(64,11, id(roboto_9), TextAlign::BASELINE_CENTER, "BoneIO");
it.printf(4, 49, id(roboto_9), TextAlign::BASELINE_LEFT ,"Uptime:");
it.printf(124, 49, id(roboto_9), TextAlign::BASELINE_RIGHT ,"%s", id(wt32_uptime).state.c_str());
it.printf(4, 61, id(roboto_9), TextAlign::BASELINE_LEFT ,"Temperature:");
it.printf(124, 61, id(roboto_9), TextAlign::BASELINE_RIGHT ,"%.2f°C", id(boneIO_temp).state);
# additional pages should be defined between the first and last page
- id: last_page
lambda: |-
it.rectangle(0, 0, 126, 15);
it.printf(64,11, id(roboto_9), TextAlign::BASELINE_CENTER, "BoneIO");
it.printf(4, 25, id(roboto_9), TextAlign::BASELINE_LEFT ,"Current:");
it.printf(124, 25, id(roboto_9), TextAlign::BASELINE_RIGHT ,"%.3fA", id(ina_current).state);
it.printf(4, 37, id(roboto_9), TextAlign::BASELINE_LEFT ,"Power:");
it.printf(124, 37, id(roboto_9), TextAlign::BASELINE_RIGHT ,"%.2fW", id(ina_power).state);
it.printf(4, 49, id(roboto_9), TextAlign::BASELINE_LEFT ,"Bus Volt:");
it.printf(124, 49, id(roboto_9), TextAlign::BASELINE_RIGHT ,"%.2fV", id(ina_bus_voltage).state);
it.printf(4, 61, id(roboto_9), TextAlign::BASELINE_LEFT ,"Shunt Volt:");
it.printf(124, 61, id(roboto_9), TextAlign::BASELINE_RIGHT ,"%.2fV", id(ina_shunt_voltage).state);
- id: screensaver
lambda: |-
it.fill(COLOR_OFF);
font:
- file: 'gfonts://Roboto'
id: roboto_9
size: 9

6
devices_v0_7/i2c.yaml Normal file
View File

@@ -0,0 +1,6 @@
i2c:
- id: i2c_bus
sda: GPIO17
scl: GPIO33
scan: True
frequency: 400kHz

21
devices_v0_7/ina219.yaml Normal file
View File

@@ -0,0 +1,21 @@
sensor:
# Module power consmption
- platform: ina219
address: 0x40
i2c_id: i2c_bus
shunt_resistance: 0.1 ohm
current:
id: ina_current
name: 'INA219 Current'
power:
id: ina_power
name: 'INA219 Power'
bus_voltage:
id: ina_bus_voltage
name: 'INA219 Bus Voltage'
shunt_voltage:
id: ina_shunt_voltage
name: 'INA219 Shunt Voltage'
max_voltage: 32.0V
max_current: 3.2A
update_interval: 30s

13
devices_v0_7/lm75b.yaml Normal file
View File

@@ -0,0 +1,13 @@
#i2c address: 0x48 output lm75b temp
#LM75B
external_components:
- source: github://boneIO-eu/esphome-LM75@main #Original source and thank you note for BTomala https://github.com/boneIO-eu/esphome-lm75
components: [lm75]
sensor:
# Lower board temperature
- platform: lm75
id: boneIO_temp
name: 'LM75B Temperature'
update_interval: 30s
i2c_id: i2c_bus

View File

@@ -0,0 +1,15 @@
dallas:
- pin: GPIO32
# sensor:
# - platform: dallas
# address: 0x283c01d607d4df28
# name: "Dallas Sensor 1"
#
# - platform: dallas
# address: 0xdfe67a061e64ff28
# name: "Dallas Sensor 2"
#
# - platform: dallas
# address: 0xa7a89f071e64ff28
# name: "Dallas Sensor 3"

21
devices_v0_7/pcf.yaml Normal file
View File

@@ -0,0 +1,21 @@
pcf8574:
- id: 'pcf_inputs_1to14'
i2c_id: bus_a
address: 0x20
pcf8575: true
- id: 'pcf_inputs_15to28'
i2c_id: bus_a
address: 0x21
pcf8575: true
- id: 'pcf_inputs_28to35_menu'
i2c_id: bus_a
address: 0x22
pcf8575: false
- id: 'pcf_right'
address: 0x23
pcf8575: true
i2c_id: bus_b
- id: 'pcf_left'
address: 0x24
pcf8575: true
i2c_id: bus_b

6
devices_v0_7/uart.yaml Normal file
View File

@@ -0,0 +1,6 @@
uart:
id: uart_pin3_1
rx_pin: GPIO3
tx_pin: GPIO1
baud_rate: 9600
stop_bits: 1