From ebbcc61699ce619cb6e34ccd1a66b5a99cba7a97 Mon Sep 17 00:00:00 2001 From: pszafer Date: Tue, 17 Jun 2025 14:35:44 +0200 Subject: [PATCH] Dimmer gen2 dev0_4 --- .vscode/settings.json | 3 + boneio-dimmer_g2_8ch-dev0_4.yaml | 302 ++++++++++++++++++ configuration/.gitignore | 5 + .../dimmer-dev2.yaml | 27 +- create_firmware.py | 4 +- 5 files changed, 326 insertions(+), 15 deletions(-) create mode 100644 .vscode/settings.json create mode 100644 boneio-dimmer_g2_8ch-dev0_4.yaml create mode 100644 configuration/.gitignore rename dimmer-dev2.yaml => configuration/dimmer-dev2.yaml (94%) diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..ff5300e --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "python.languageServer": "None" +} \ No newline at end of file diff --git a/boneio-dimmer_g2_8ch-dev0_4.yaml b/boneio-dimmer_g2_8ch-dev0_4.yaml new file mode 100644 index 0000000..04d30bc --- /dev/null +++ b/boneio-dimmer_g2_8ch-dev0_4.yaml @@ -0,0 +1,302 @@ +substitutions: + name: boneio-dr-gen2-8ch-dev04 + friendly_name: 'BoneIO Dimmer dev0.4' + serial_prefix: 'dim' #Don't change it. + firmware_manifest: 'https://boneio.eu/esp/boneio-dr-gen2-8ch-dev04.json' +esphome: + name: '${name}' + friendly_name: '${friendly_name}' + name_add_mac_suffix: false + project: + name: boneio.dimmer-led-gen2 + version: 'dev0.4' + +esp32: + board: esp32-s3-devkitc-1 + +ethernet: + id: eth + type: W5500 + clk_pin: GPIO12 + mosi_pin: GPIO39 + miso_pin: GPIO38 + cs_pin: GPIO13 + interrupt_pin: GPIO2 + reset_pin: GPIO1 + # Enable fallback hotspot (captive portal) in case wifi connection fails + +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] + +i2c: + sda: GPIO10 + scl: GPIO11 + scan: True + frequency: 400kHz + +uart: + id: boneio_uart + rx_pin: GPIO21 + tx_pin: GPIO14 + baud_rate: 9600 + stop_bits: 1 + +output: + - platform: ledc + pin: GPIO18 + frequency: 1000Hz + inverted: false + id: chl01 + - platform: ledc + pin: GPIO17 + frequency: 1000Hz + inverted: false + id: chl02 + - platform: ledc + pin: GPIO16 + frequency: 1000Hz + inverted: false + id: chl03 + - platform: ledc + pin: GPIO15 + frequency: 1000Hz + inverted: false + id: chl04 + + - platform: ledc + pin: GPIO7 + frequency: 1000Hz + inverted: false + id: chr01 + - platform: ledc + pin: GPIO6 + frequency: 1000Hz + inverted: false + id: chr02 + - platform: ledc + pin: GPIO5 + frequency: 1000Hz + inverted: false + id: chr03 + - platform: ledc + pin: GPIO4 + frequency: 1000Hz + inverted: false + id: chr04 + + ##CAN gpio1 - tx, gpio2 rx + +modbus: + send_wait_time: 200ms + uart_id: boneio_uart + id: boneio_modbus + +packages: + internals_packages: + url: https://github.com/boneIO-eu/esphome + ref: v1.6.0 + files: [ + 'devices/serial_no.yaml', + # 'devices/dimmer_i2c.yaml', + ] + boneiopackages: + url: https://github.com/boneIO-eu/esphome_packages + ref: main + refresh: 1min + files: + - path: sdm630/package.yaml + +dashboard_import: + package_import_url: github://boneIO-eu/esphome/boneio-dimmer_g2_8ch-dev0_4.yaml@latest + import_full_config: true + +pcf8574: + - id: 'pcf_inputs' + address: 0x38 + +logger: + hardware_uart: UART0 +api: + reboot_timeout: 0s +ota: + - platform: esphome + - platform: http_request + +update: + - id: update_std + platform: http_request + name: Firmware Update + source: ${firmware_manifest} + +web_server: + port: 80 + local: true + + +light: + - platform: monochromatic + output: chl01 + name: 'CHL 01' + id: chl_01 + default_transition_length: 2s + gamma_correct: 0 + - platform: monochromatic + output: chl02 + name: 'CHL 02' + id: chl_02 + default_transition_length: 2s + gamma_correct: 0 + - platform: monochromatic + output: chl03 + name: 'CHL 03' + id: chl_03 + default_transition_length: 2s + gamma_correct: 0 + - platform: monochromatic + output: chl04 + name: 'CHL 04' + id: chl_04 + default_transition_length: 2s + gamma_correct: 0 + + - platform: monochromatic + output: chr01 + name: 'CHR 01' + id: chr_01 + default_transition_length: 2s + gamma_correct: 0 + - platform: monochromatic + output: chr02 + name: 'CHR 02' + id: chr_02 + default_transition_length: 2s + gamma_correct: 0 + - platform: monochromatic + output: chr03 + name: 'CHR 03' + id: chr_03 + default_transition_length: 2s + gamma_correct: 0 + - platform: monochromatic + output: chr04 + name: 'CHR 04' + id: chr_04 + default_transition_length: 2s + gamma_correct: 0 + +debug: + update_interval: 15s + +sensor: + - platform: debug + free: + name: "Heap Free" + block: + name: "Heap Max Block" + loop_time: + name: "Loop Time" + - platform: lm75 + id: boneIO_temp + name: 'Temperature' + update_interval: 30s + entity_category: diagnostic + on_value_range: + - above: 70.0 + then: + - switch.turn_on: buzzer + - below: 70.0 + then: + - switch.turn_off: buzzer + +switch: + - platform: gpio + id: buzzer + name: 'Buzzer' + pin: + number: GPIO9 + mode: + output: true + inverted: false + +binary_sensor: + - platform: gpio + name: 'IN_01' + id: in_01 + pin: + pcf8574: pcf_inputs + number: 0 + mode: + input: true + inverted: true + + - platform: gpio + name: 'IN_02' + id: in_02 + pin: + pcf8574: pcf_inputs + number: 1 + mode: + input: true + inverted: true + + - platform: gpio + name: 'IN_03' + id: in_03 + pin: + pcf8574: pcf_inputs + number: 2 + mode: + input: true + inverted: true + + - platform: gpio + name: 'IN_04' + id: in_04 + pin: + pcf8574: pcf_inputs + number: 3 + mode: + input: true + inverted: true + + - platform: gpio + name: 'IN_05' + id: in_05 + pin: + pcf8574: pcf_inputs + number: 4 + mode: + input: true + inverted: true + + - platform: gpio + name: 'IN_06' + id: in_06 + pin: + pcf8574: pcf_inputs + number: 5 + mode: + input: true + inverted: true + + - platform: gpio + name: 'IN_07' + id: in_07 + pin: + pcf8574: pcf_inputs + number: 6 + mode: + input: true + inverted: true + + - platform: gpio + name: 'IN_08' + id: in_08 + pin: + pcf8574: pcf_inputs + number: 7 + mode: + input: true + inverted: true + diff --git a/configuration/.gitignore b/configuration/.gitignore new file mode 100644 index 0000000..d8b4157 --- /dev/null +++ b/configuration/.gitignore @@ -0,0 +1,5 @@ +# Gitignore settings for ESPHome +# This is an example and may include too much for your use-case. +# You can modify this file to suit your needs. +/.esphome/ +/secrets.yaml diff --git a/dimmer-dev2.yaml b/configuration/dimmer-dev2.yaml similarity index 94% rename from dimmer-dev2.yaml rename to configuration/dimmer-dev2.yaml index d2de43b..87ee982 100644 --- a/dimmer-dev2.yaml +++ b/configuration/dimmer-dev2.yaml @@ -37,7 +37,7 @@ i2c: frequency: 400kHz uart: - id: uart_pin + id: boneio_uart rx_pin: GPIO14 tx_pin: GPIO21 baud_rate: 9600 @@ -88,19 +88,19 @@ output: ##CAN gpio1 - tx, gpio2 rx -# modbus: -# send_wait_time: 200ms -# uart_id: uart_pin8_9 -# id: boneio_modbus +modbus: + send_wait_time: 200ms + uart_id: boneio_uart + id: boneio_modbus packages: - internals_packages: - url: https://github.com/boneIO-eu/esphome - ref: v1.5.0 - files: [ - 'devices/serial_no.yaml', - # 'devices/dimmer_i2c.yaml', - ] + boneio_packages: + url: "https://github.com/boneIO-eu/esphome_packages" + refresh: 1min + files: + - path: "sdm630.yaml" + vars: + device_name: "MySDM" # dashboard_import: # package_import_url: github://boneIO-eu/esphome/boneio-dimmer_8ch-v0_3.yaml@latest @@ -111,6 +111,7 @@ pcf8574: address: 0x38 logger: + hardware_uart: UART0 api: reboot_timeout: 0s ota: @@ -286,4 +287,4 @@ binary_sensor: mode: input: true inverted: true - \ No newline at end of file + diff --git a/create_firmware.py b/create_firmware.py index 216d699..09948a8 100644 --- a/create_firmware.py +++ b/create_firmware.py @@ -1,10 +1,10 @@ #!/usr/bin/python -import subprocess import glob +import json import os import re -import json import shutil +import subprocess from pathlib import Path home = str(Path.home())