diff --git a/boards/relay32_outputs_PCF.yaml b/boards/32x10_outputs.yaml similarity index 63% rename from boards/relay32_outputs_PCF.yaml rename to boards/32x10_outputs.yaml index b7b5f64..4ddc591 100644 --- a/boards/relay32_outputs_PCF.yaml +++ b/boards/32x10_outputs.yaml @@ -1,4 +1,3 @@ - pcf8574: - id: 'pcf_1' address: 0x21 @@ -7,359 +6,292 @@ pcf8574: - id: 'pcf_2' address: 0x20 pcf8575: true - i2c_id: bus_b + i2c_id: bus_b -switch: - +output: - platform: gpio - id: relay_1 - name: "Relay_01" + id: out_1 pin: pcf8574: pcf_1 - # Use pin number 0 number: 15 mode: output: true inverted: true - platform: gpio - id: relay_2 - name: "Relay_02" + id: out_2 pin: pcf8574: pcf_1 - # Use pin number 1 number: 14 mode: output: true inverted: true - + - platform: gpio - id: relay_3 - name: "Relay_03" + id: out_3 pin: pcf8574: pcf_1 - # Use pin number 2 number: 13 mode: output: true inverted: true - + - platform: gpio - id: relay_4 - name: "Relay_04" + id: out_4 pin: pcf8574: pcf_1 - # Use pin number 3 number: 12 mode: output: true inverted: true - + - platform: gpio - id: relay_5 - name: "Relay_05" + id: out_5 pin: pcf8574: pcf_1 - # Use pin number 4 number: 11 mode: output: true inverted: true - + - platform: gpio - id: relay_6 - name: "Relay_06" + id: out_6 pin: pcf8574: pcf_1 - # Use pin number 5 number: 10 mode: output: true inverted: true - platform: gpio - id: relay_7 - name: "Relay_07" + id: out_7 pin: pcf8574: pcf_1 - # Use pin number 6 number: 9 mode: output: true inverted: true - + - platform: gpio - id: relay_8 - name: "Relay_08" + id: out_8 pin: pcf8574: pcf_1 - # Use pin number 7 number: 8 mode: output: true inverted: true - platform: gpio - id: relay_9 - name: "Relay_09" + id: out_9 pin: pcf8574: pcf_2 - # Use pin number 0 number: 15 mode: output: true inverted: true - + - platform: gpio - id: relay_10 - name: "Relay_10" + id: out_10 pin: pcf8574: pcf_2 - # Use pin number 1 number: 14 mode: output: true inverted: true - + - platform: gpio - id: relay_11 - name: "Relay_11" + id: out_11 pin: pcf8574: pcf_2 - # Use pin number 2 number: 13 mode: output: true inverted: true - + - platform: gpio - id: relay_12 - name: "Relay_12" + id: out_12 pin: pcf8574: pcf_2 - # Use pin number 3 number: 12 mode: output: true inverted: true - + - platform: gpio - id: relay_13 - name: "Relay_13" + id: out_13 pin: pcf8574: pcf_2 - # Use pin number 4 number: 11 mode: output: true inverted: true - + - platform: gpio - id: relay_14 - name: "Relay_14" + id: out_14 pin: pcf8574: pcf_2 - # Use pin number 5 number: 10 mode: output: true inverted: true - + - platform: gpio - id: relay_15 - name: "Relay_15" + id: out_15 pin: pcf8574: pcf_2 - # Use pin number 6 number: 9 mode: output: true inverted: true - + - platform: gpio - id: relay_16 - name: "Relay_16" + id: out_16 pin: pcf8574: pcf_2 - # Use pin number 7 number: 8 mode: output: true inverted: true - + - platform: gpio - id: relay_17 - name: "Relay_17" + id: out_17 pin: pcf8574: pcf_1 - # Use pin number 15 number: 0 mode: output: true inverted: true - platform: gpio - id: relay_18 - name: "Relay_18" + id: out_18 pin: pcf8574: pcf_1 - # Use pin number 14 number: 1 mode: output: true inverted: true - + - platform: gpio - id: relay_19 - name: "Relay_19" + id: out_19 pin: pcf8574: pcf_1 - # Use pin number 13 number: 2 mode: output: true inverted: true - + - platform: gpio - id: relay_20 - name: "Relay_20" + id: out_20 pin: pcf8574: pcf_1 - # Use pin number 12 number: 3 mode: output: true inverted: true - + - platform: gpio - id: relay_21 - name: "Relay_21" + id: out_21 pin: pcf8574: pcf_1 - # Use pin number 11 number: 4 mode: output: true inverted: true - + - platform: gpio - id: relay_22 - name: "Relay_22" + id: out_22 pin: pcf8574: pcf_1 - # Use pin number 10 number: 5 mode: output: true inverted: true - + - platform: gpio - id: relay_23 - name: "Relay_23" + id: out_23 pin: pcf8574: pcf_1 - # Use pin number 9 number: 6 mode: output: true inverted: true - + - platform: gpio - id: relay_24 - name: "Relay_24" + id: out_24 pin: pcf8574: pcf_1 - # Use pin number 8 number: 7 mode: output: true inverted: true - + - platform: gpio - id: relay_25 - name: "Relay_25" + id: out_25 pin: pcf8574: pcf_2 - # Use pin number 15 number: 0 mode: output: true inverted: true - + - platform: gpio - id: relay_26 - name: "Relay_26" + id: out_26 pin: pcf8574: pcf_2 - # Use pin number 14 number: 1 mode: output: true inverted: true - + - platform: gpio - id: relay_27 - name: "Relay_27" + id: out_27 pin: pcf8574: pcf_2 - # Use pin number 13 number: 2 mode: output: true inverted: true - + - platform: gpio - id: relay_28 - name: "Relay_28" + id: out_28 pin: pcf8574: pcf_2 - # Use pin number 12 number: 3 mode: output: true inverted: true - + - platform: gpio - id: relay_29 - name: "Relay_29" + id: out_29 pin: pcf8574: pcf_2 - # Use pin number 11 number: 4 mode: output: true inverted: true - + - platform: gpio - id: relay_30 - name: "Relay_30" + id: out_30 pin: pcf8574: pcf_2 - # Use pin number 10 number: 5 mode: output: true inverted: true - + - platform: gpio - id: relay_31 - name: "Relay_31" + id: out_31 pin: pcf8574: pcf_2 - # Use pin number 9 number: 6 mode: output: true inverted: true - + - platform: gpio - id: relay_32 - name: "Relay_32" + id: out_32 pin: pcf8574: pcf_2 - # Use pin number 8 number: 7 mode: output: true inverted: true - - diff --git a/boneio-lights.yaml b/boneio-lights.yaml new file mode 100644 index 0000000..9ed16a5 --- /dev/null +++ b/boneio-lights.yaml @@ -0,0 +1,63 @@ +substitutions: + name_add_mac_suffix: 'true' + node_name: boneio + +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 + +dashboard_import: + package_import_url: github://boneIO-eu/esphome/boneio-lights.yaml@single_file_test + import_full_config: false + +packages: + internals_packages: + url: https://github.com/boneIO-eu/esphome + ref: single_file_test + files: + [ + 'devices/buzzer.yaml', + 'devices/display.yaml', + 'devices/i2c.yaml', + 'devices/ina219.yaml', + 'devices/lm75b.yaml', + 'devices/one_wire.yaml', + 'devices/pcf_inputs.yaml', + 'devices/uart.yaml', + 'boards/32x10_outputs.yaml', + ] + +logger: + baud_rate: 0 +api: +ota: + password: boneio + +web_server: + port: 80 + local: true + +time: + - platform: homeassistant + timezone: Europe/Warsaw + id: homeassistant_time + +light: + - platform: binary + name: 'Light 1' + output: out_1 + - platform: binary + name: 'Light 2' + output: out_2 diff --git a/boneio_config_for_console.yaml b/boneio_config_for_console.yaml deleted file mode 100644 index d921447..0000000 --- a/boneio_config_for_console.yaml +++ /dev/null @@ -1,57 +0,0 @@ -substitutions: - # set to false if you don't want mac suffix in your device name - name_add_mac_suffix: 'false' - # if you want to change the name of device via OTA you have to set IP first in boneio/devices/wt32_eth01.yaml - node_name: boneio - dir_name: './' - -packages: - # select your input board: - # input: !include boards/relay24_inputs_PCF.yaml - # input: !include boards/relay32_inputs_PCF.yaml - # input: !include boards/relay32_inputs_MCP.yaml - # input: !include boards/dimmer_led8x4_inputs.yaml - # input: !include boards/cover16_inputs_MCP.yaml - # input: !include boards/cover16_inputs_PCF.yaml - input: !include boards/coverMix_inputs_PCF.yaml - - # select your output board: - # output: !include boards/relay24_outputs_MCP.yaml - # output: !include boards/relay32_outputs_PCF.yaml - # output: !include boards/relay32_outputs_MCP.yaml - # output: !include boards/dimmer_led8x4_outputs.yaml - # light: !include boards/monochromatic_lights.yaml - # cover: !include boards/cover.yaml - cover: !include boards/cover_mix.yaml - # output: !include boards/cover16_outputs_PCF.yaml - # output: !include boards/cover16_outputs_MCP.yaml - # output: !include boards/mosfet48_outputs_PCF.yaml - output: !include boards/relay32_outputs_mix_PCF.yaml - - # select your devices: - core: !include devices/wt32_eth01.yaml - internals: !include devices/boneio_board.yaml - temp: !include devices/lm75b.yaml - display: !include devices/display.yaml - # uart: !include devices/uart.yaml - # one_wire: !include devices/one_wire.yaml - -logger: - baud_rate: 0 -api: -ota: - password: boneio -# disable web server - for testing only -web_server: - port: 80 - local: true - -time: - - platform: homeassistant - timezone: Europe/Warsaw - id: homeassistant_time - # instead try to synchronize via network repeatedly ... - on_time_sync: - then: - # ... and update the RTC when the synchronization was successful - ds1307.write_time: diff --git a/boneio_config_for_esphome_addon.yaml b/boneio_config_for_esphome_addon.yaml deleted file mode 100644 index ab0fc17..0000000 --- a/boneio_config_for_esphome_addon.yaml +++ /dev/null @@ -1,58 +0,0 @@ -substitutions: - # set to false if you don't want mac suffix in your device name - name_add_mac_suffix: 'false' - # if you want to change the name of device via OTA you have to set IP first in boneio/devices/wt32_eth01.yaml - node_name: boneio - dir_name: 'boneio/' - -packages: - # select your input board: - # input: !include boneio/boards/relay24_inputs_PCF.yaml - # input: !include boneio/boards/relay32_inputs_PCF.yaml - # input: !include boneio/boards/relay32_inputs_MCP.yaml - # input: !include boneio/boards/dimmer_led8x4_inputs.yaml - # input: !include boneio/boards/cover16_inputs_MCP.yaml - # input: !include boneio/boards/cover16_inputs_PCF.yaml - # input: !include boneio/boards/coverMix_inputs_PCF.yaml - - # select your output board: - # output: !include boneio/boards/relay24_outputs_MCP.yaml - output: !include boneio/boards/relay32_outputs_PCF.yaml - # output: !include boneio/boards/relay32_outputs_MCP.yaml - # output: !include boneio/boards/dimmer_led8x4_outputs.yaml - # light: !include boneio/boards/monochromatic_lights.yaml - # cover: !include boneio/boards/cover.yaml - # cover: !include boneio/boards/cover_mix.yaml - # output: !include boneio/boards/cover16_outputs_PCF.yaml - # output: !include boneio/boards/cover16_outputs_MCP.yaml - # output: !include boneio/mosfet48_outputs_PCF.yaml - # output: !include boneio/relay32_outputs_mix_PCF.yaml - - # select your devices: - core: !include boneio/devices/wt32_eth01.yaml - internals: !include boneio/devices/boneio_board.yaml - temp: !include boneio/devices/lm75b.yaml - display: !include boneio/devices/display.yaml - # uart: !include devices/uart.yaml - # one_wire: !include devices/one_wire.yaml - - -logger: - baud_rate: 0 -api: -ota: - password: boneio -# disable web server - for testing only -web_server: - port: 80 - local: true - -time: - - platform: homeassistant - timezone: Europe/Warsaw - id: homeassistant_time - # instead try to synchronize via network repeatedly ... - on_time_sync: - then: - # ... and update the RTC when the synchronization was successful - ds1307.write_time: diff --git a/devices/buzzer.yaml b/devices/buzzer.yaml new file mode 100644 index 0000000..50bf3e0 --- /dev/null +++ b/devices/buzzer.yaml @@ -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 diff --git a/devices/display.yaml b/devices/display.yaml index 992233f..ba1cc9a 100644 --- a/devices/display.yaml +++ b/devices/display.yaml @@ -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 diff --git a/devices/i2c.yaml b/devices/i2c.yaml new file mode 100644 index 0000000..71cfa66 --- /dev/null +++ b/devices/i2c.yaml @@ -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 diff --git a/devices/boneio_board.yaml b/devices/ina219.yaml similarity index 71% rename from devices/boneio_board.yaml rename to devices/ina219.yaml index fa8ad53..e83ccf7 100644 --- a/devices/boneio_board.yaml +++ b/devices/ina219.yaml @@ -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 - diff --git a/devices/lm75b.yaml b/devices/lm75b.yaml index 8f2925b..79cd306 100644 --- a/devices/lm75b.yaml +++ b/devices/lm75b.yaml @@ -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 diff --git a/devices/pcf_inputs.yaml b/devices/pcf_inputs.yaml new file mode 100644 index 0000000..245649f --- /dev/null +++ b/devices/pcf_inputs.yaml @@ -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 diff --git a/devices/wt32_eth01.yaml b/devices/wt32_eth01.yaml deleted file mode 100644 index 31f5bfb..0000000 --- a/devices/wt32_eth01.yaml +++ /dev/null @@ -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 diff --git a/fonts/DejaVuSans.ttf b/fonts/DejaVuSans.ttf deleted file mode 100644 index e5f7eec..0000000 Binary files a/fonts/DejaVuSans.ttf and /dev/null differ diff --git a/fonts/danube__.ttf b/fonts/danube__.ttf deleted file mode 100644 index b211454..0000000 Binary files a/fonts/danube__.ttf and /dev/null differ