test boneio lights

This commit is contained in:
pszafer
2024-03-28 20:24:58 +01:00
parent 0a05c6c561
commit afc20b8a48
13 changed files with 205 additions and 326 deletions

26
devices/buzzer.yaml Normal file
View File

@@ -0,0 +1,26 @@
#i2c address: 0x26 input pcf io
#i2c address: 0x27 input pcf io
#i2c address: 0x40 input ina219 power
#i2c address: 0x68 input rtc ds1307
switch:
- platform: gpio
id: buzzer
name: 'Buzzer'
pin:
number: GPIO2
mode:
output: true
inverted: false
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

View File

@@ -23,7 +23,7 @@ sensor:
text_sensor:
- platform: template
name: ${node_name} Uptime
name: Uptime
id: wt32_uptime
entity_category: diagnostic
icon: mdi:clock-start
@@ -74,9 +74,6 @@ binary_sensor:
# on the screensaver, show the logo for a while and display the first page
display.is_displaying_page: screensaver
then:
- display.page.show: logo_page
- component.update: oled_display
- delay: 500ms
- display.page.show: first_page
- component.update: oled_display
else:
@@ -86,8 +83,8 @@ binary_sensor:
# restart screensaver script
- script.execute: screensaver_script
# it.printf(4, 37, id(dejaVuSmall), TextAlign::BASELINE_LEFT ,"IP addr:");
# it.printf(124, 37, id(dejaVuSmall), TextAlign::BASELINE_RIGHT ,"%s", id(eth).get_ip_addresses().str().c_str());
# 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
@@ -96,44 +93,33 @@ display:
i2c_id: bus_b
contrast: 0.5
pages:
- id: logo_page
lambda: |-
it.printf(64,25, id(danubeBig), TextAlign::BASELINE_CENTER, "BoneIO");
it.printf(64,40, id(dejaVuSmall), TextAlign::BASELINE_CENTER, "take control");
it.printf(64,50, id(dejaVuSmall), TextAlign::BASELINE_CENTER, "of your home");
- id: first_page
lambda: |-
it.rectangle(0, 0, 126, 15);
it.printf(64,11, id(danubeSmall), TextAlign::BASELINE_CENTER, "BoneIO");
it.strftime(64, 25, id(dejaVuSmall), TextAlign::BASELINE_CENTER ,"%c", id(ds1307_time).now());
it.printf(4, 49, id(dejaVuSmall), TextAlign::BASELINE_LEFT ,"Uptime:");
it.printf(124, 49, id(dejaVuSmall), TextAlign::BASELINE_RIGHT ,"%s", id(wt32_uptime).state.c_str());
it.printf(4, 61, id(dejaVuSmall), TextAlign::BASELINE_LEFT ,"Temperature:");
it.printf(124, 61, id(dejaVuSmall), TextAlign::BASELINE_RIGHT ,"%.2f°C", id(boneIO_temp).state);
it.printf(64,11, id(roboto_9), TextAlign::BASELINE_CENTER, "BoneIO");
it.strftime(64, 25, id(roboto_9), TextAlign::BASELINE_CENTER ,"%c", id(ds1307_time).now());
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(danubeSmall), TextAlign::BASELINE_CENTER, "BoneIO");
it.printf(4, 25, id(dejaVuSmall), TextAlign::BASELINE_LEFT ,"Current:");
it.printf(124, 25, id(dejaVuSmall), TextAlign::BASELINE_RIGHT ,"%.3fA", id(ina_current).state);
it.printf(4, 37, id(dejaVuSmall), TextAlign::BASELINE_LEFT ,"Power:");
it.printf(124, 37, id(dejaVuSmall), TextAlign::BASELINE_RIGHT ,"%.2fW", id(ina_power).state);
it.printf(4, 49, id(dejaVuSmall), TextAlign::BASELINE_LEFT ,"Bus Volt:");
it.printf(124, 49, id(dejaVuSmall), TextAlign::BASELINE_RIGHT ,"%.2fV", id(ina_bus_voltage).state);
it.printf(4, 61, id(dejaVuSmall), TextAlign::BASELINE_LEFT ,"Shunt Volt:");
it.printf(124, 61, id(dejaVuSmall), TextAlign::BASELINE_RIGHT ,"%.2fV", id(ina_shunt_voltage).state);
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: '${dir_name}/fonts/DejaVuSans.ttf'
id: dejaVuSmall
size: 9
- file: '${dir_name}/fonts/danube__.ttf'
id: danubeBig
size: 20
- file: '${dir_name}/fonts/danube__.ttf'
id: danubeSmall
- file: 'gfonts://Roboto'
id: roboto_9
size: 9

11
devices/i2c.yaml Normal file
View File

@@ -0,0 +1,11 @@
i2c:
- id: bus_a
sda: GPIO14
scl: GPIO15
scan: True
frequency: 400kHz
- id: bus_b
sda: GPIO17
scl: GPIO33
scan: True
frequency: 400kHz

View File

@@ -2,30 +2,24 @@
#i2c address: 0x27 input pcf io
#i2c address: 0x40 input ina219 power
#i2c address: 0x68 input rtc ds1307
time:
- platform: ds1307
id: ds1307_time
address: 0x68
i2c_id: bus_a
sensor:
# Module power consmption
# Module power consmption
- platform: ina219
address: 0x40
i2c_id: bus_a
shunt_resistance: 0.1 ohm
current:
id: ina_current
name: "${node_name} INA219 Current"
name: 'INA219 Current'
power:
id: ina_power
name: "${node_name} INA219 Power"
name: 'INA219 Power'
bus_voltage:
id: ina_bus_voltage
name: "${node_name} INA219 Bus Voltage"
name: 'INA219 Bus Voltage'
shunt_voltage:
id: ina_shunt_voltage
name: "${node_name} INA219 Shunt Voltage"
name: 'INA219 Shunt Voltage'
max_voltage: 32.0V
max_current: 3.2A
update_interval: 30s
@@ -33,7 +27,7 @@ sensor:
switch:
- platform: gpio
id: buzzer
name: "Buzzer"
name: 'Buzzer'
pin:
number: GPIO2
mode:
@@ -47,9 +41,8 @@ pcf8574:
- id: 'pcf_inputs_15to28'
i2c_id: bus_a
address: 0x21
pcf8575: true
pcf8575: true
- id: 'pcf_inputs_28to35_menu'
i2c_id: bus_a
address: 0x22
pcf8575: false

View File

@@ -1,13 +1,13 @@
#i2c address: 0x48 output lm75b temp
#LM75B
external_components:
- source: github://btomala/esphome-LM75@v1.0
components: [ lm75 ]
- 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
# Lower board temperature
- platform: lm75
id: boneIO_temp
name: "${node_name} LM75B Temperature"
name: 'LM75B Temperature'
update_interval: 30s
i2c_id: bus_b

13
devices/pcf_inputs.yaml Normal file
View File

@@ -0,0 +1,13 @@
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

View File

@@ -1,30 +0,0 @@
i2c:
- id: bus_a
sda: GPIO14
scl: GPIO15
scan: True
frequency: 400kHz
- id: bus_b
sda: GPIO17
scl: GPIO33
scan: True
frequency: 400kHz
esphome:
name: ${node_name}
platform: ESP32
board: nodemcu-32s
# set to false if you already added this device to ESPHOME add-on
name_add_mac_suffix: ${name_add_mac_suffix}
ethernet:
id: eth
type: LAN8720
mdc_pin: GPIO23
mdio_pin: GPIO18
clk_mode: GPIO0_IN
phy_addr: 1
power_pin: GPIO16
# uncomment this line and set your actual IP address before changing name of device
# use_address: xxx.xxx.xxx.xxx