This commit is contained in:
2024-10-13 22:59:09 +02:00
parent 63fb7f8f73
commit e426efb80f
107 changed files with 20616 additions and 5533 deletions

View File

@@ -27,7 +27,7 @@ packages:
connection: !include common/wifi.yaml
status: !include templates/status.yaml
logger: !include templates/nologger.yaml
#bt_proxy: !include common/bluetooth.yaml
bt_proxy: !include common/bluetooth.yaml
#sensors
#mmwave: !include sensors/ld2420.yaml
pmsc: !include sensors/pmsx0003.yaml

View File

@@ -21,7 +21,7 @@ substitutions:
packages:
board: !include boards/esp32_wroom_arduino.yaml
i2c: !include interfaces/i2c_a.yaml
i2c: !include interfaces/i2c_a_slow.yaml
device_base: !include common/common.yaml
connection: !include common/wifi.yaml
status: !include templates/status.yaml
@@ -29,7 +29,7 @@ packages:
bt_proxy: !include common/bluetooth.yaml
#sensors
#mmwave: !include sensors/ld2410.yaml
#mmwave: !include sensors/ld2420.yaml
pms: !include sensors/pm1006.yaml
co2: !include sensors/scd30.yaml
tvoc: !include sensors/sgp30.yaml

View File

@@ -12,10 +12,12 @@ substitutions:
subnet: !secret ip_subnet
ip: !secret badkamerradfan_ip
pin_temp: GPIO3
pin_pwm: GPIO4
pin_tach: GPIO2
pin_pwm: GPIO2
pin_tach1: GPIO6
pin_tach2: GPIO7
pin_tach3: GPIO9
pin_status: GPIO8
ledc_freq: "16000"
ledc_freq: "1000"
packages:
board: !include boards/esp32-C3.yaml
@@ -23,6 +25,7 @@ packages:
connection: !include common/wifi.yaml
status: !include templates/status.yaml
logger: !include templates/logger.yaml
bt_proxy: !include common/bluetooth.yaml
output:
- platform: ledc
@@ -35,7 +38,7 @@ fan:
output: pwm1
name: "Badkamer radiator Fan"
id: badkamerfan
restore_mode: RESTORE_DEFAULT_ON
restore_mode: RESTORE_DEFAULT_OFF
# Example configuration entry
one_wire:
@@ -45,7 +48,7 @@ one_wire:
# Individual sensors
sensor:
- platform: dallas_temp
address: 0x59800000081fd028
address: 0xb1800000081e5a28
name: "Radiataor Temperature"
id: radtemperature
on_value_range:
@@ -56,6 +59,52 @@ sensor:
then:
- fan.turn_off: badkamerfan
- platform: pulse_counter
pin:
number: ${pin_tach1}
mode:
input: true
pullup: true
name: fan1 PWM
id: fan_pulse1
unit_of_measurement: 'RPM'
filters:
- multiply: 0.5
count_mode:
rising_edge: INCREMENT
falling_edge: DISABLE
update_interval: 3s
- platform: pulse_counter
pin:
number: ${pin_tach2}
mode:
input: true
pullup: true
name: fan2 PWM
id: fan_pulse2
unit_of_measurement: 'RPM'
filters:
- multiply: 0.5
count_mode:
rising_edge: INCREMENT
falling_edge: DISABLE
update_interval: 3s
- platform: pulse_counter
pin:
number: ${pin_tach3}
mode:
input: true
pullup: true
name: fan3 PWM
id: fan_pulse3
unit_of_measurement: 'RPM'
filters:
- multiply: 0.5
count_mode:
rising_edge: INCREMENT
falling_edge: DISABLE
update_interval: 3s
number:
- platform: template
name: "Fan on temp"
@@ -75,4 +124,4 @@ number:
max_value: 65
restore_value: True
initial_value: 24
step: 1
step: 1

Submodule esphome/boards/.esphome/external_components/3a17a31a added at 5f1a08c922

View File

@@ -0,0 +1,14 @@
---
esp32:
board: esp32-c3-devkitm-1
framework:
type: esp-idf
sdkconfig_options:
CONFIG_BT_BLE_50_FEATURES_SUPPORTED: y
CONFIG_BT_BLE_42_FEATURES_SUPPORTED: y
CONFIG_ESP_TASK_WDT_TIMEOUT_S: "10"
esphome:
platformio_options:
board_build.mcu: esp32c3
board_build.variant: esp32c3

5
esphome/boards/esp32-gen.yaml Executable file
View File

@@ -0,0 +1,5 @@
---
esp32:
board: ${board}
framework:
type: ${framework}

View File

@@ -0,0 +1,4 @@
esp32:
board: esp32dev
framework:
type: esp-idf

View File

@@ -4,7 +4,7 @@ esp32:
flash_size: 16MB
framework:
type: esp-idf
version: 4.4.6
#version: 4.4.6
sdkconfig_options:
CONFIG_ESP32S3_DEFAULT_CPU_FREQ_240: "y"
CONFIG_ESP32S3_DATA_CACHE_64KB: "y"
@@ -27,6 +27,9 @@ external_components:
- source: github://pr#5230
components: esp_adf
refresh: 0s
- source: github://jesserockz/esphome-components
components: [file]
refresh: 0s
# - source: github://X-Ryl669/esphome@esp-adf-take2 #pr#5230
# components: [esp_adf]
# refresh: 0s

View File

@@ -0,0 +1,58 @@
---
esp32:
board: esp32s3box
flash_size: 16MB
framework:
type: esp-idf
sdkconfig_options:
CONFIG_ESP32S3_DEFAULT_CPU_FREQ_240: "y"
CONFIG_ESP32S3_DATA_CACHE_64KB: "y"
CONFIG_ESP32S3_DATA_CACHE_LINE_64B: "y"
CONFIG_AUDIO_BOARD_CUSTOM: "y"
CONFIG_ESP32_S3_BOX_3_BOARD: "y"
components:
- name: esp32_s3_box_3_board
source: github://jesserockz/esp32-s3-box-3-board@main
refresh: 0s
# components:
# - name: esp32_s3_box_3_board
# source: github://X-Ryl669/esp32-s3-box-3-board@main
# refresh: 0s
psram:
mode: octal
speed: 80MHz
external_components:
- source:
type: git
url: https://github.com/gnumpi/esphome_audio
ref: dev-next
components: [ adf_pipeline, i2s_audio ]
refresh: 0s
# - source: github://X-Ryl669/esphome@esp-adf-take2 #pr#5230
# components: [esp_adf]
# refresh: 0s
# - source: github://X-Ryl669/esphome@at581x
# components: at581x
# refresh: 0s
# - source: github://pr#5894 #5198
# components: [ahtxx]
# refresh: 60s
esphome:
name: ${device_name}
friendly_name: ${friendly_name}
min_version: 2024.7.0
platformio_options:
board_build.flash_mode: dio
on_boot:
priority: 600
then:
- light.turn_on:
id: led
brightness: 100%
- display.page.show: loading_page
- component.update: s3_box_lcd
project:
name: "BigBobbas.s3box"
version: ${version}

29
esphome/bt-proxy-hal.yaml Normal file
View File

@@ -0,0 +1,29 @@
substitutions:
device_name: "btproxyhal"
friendly_name: "BT_proxy_hal"
comment: "ESP32-c3 proxy"
location: "hal"
board: "esp32-c3-devkitm-1"
framework: arduino
api_password: !secret bt_proxy_hal_api
ota_password: !secret ota_password
wifi_ssid: !secret wifi_ssid
wifi_password: !secret wifi_password
gateway: !secret ip_gateway
subnet: !secret ip_subnet
ip: !secret bt_proxy_hal_ip
#pin_status: GPIO8
# update_interval: 10s
# pin_sda: GPIO8
# pin_scl: GPIO9
packages:
board: !include boards/esp32-gen.yaml
connection: !include common/wifi_btprox.yaml
device_base: !include common/common.yaml
logger: !include templates/logger.yaml
#status: !include templates/status.yaml
btproxy: !include templates/bt_proxy.yaml
#bme: !include sensors/bme280.yaml
#i2c: !include interfaces/i2c_a.yaml

View File

@@ -0,0 +1,24 @@
substitutions:
device_name: "btproxykeuken"
friendly_name: "BT_proxy_keuken"
comment: "ESP32-c3 proxy"
location: "keuken"
board: "esp32-c3-devkitm-1"
framework: arduino
api_password: !secret bt_proxy_keuken_api
ota_password: !secret ota_password
wifi_ssid: !secret wifi_ssid
wifi_password: !secret wifi_password
gateway: !secret ip_gateway
subnet: !secret ip_subnet
ip: !secret bt_proxy_keuken_ip
pin_status: GPIO8
packages:
board: !include boards/esp32-gen.yaml
connection: !include common/wifi_btprox.yaml
device_base: !include common/common.yaml
logger: !include templates/logger.yaml
btproxy: !include templates/bt_proxy.yaml

View File

@@ -0,0 +1,24 @@
substitutions:
device_name: "btproxyspeelkamer"
friendly_name: "BT_proxy_speelkamer"
comment: "ESP32-c3 proxy"
location: "speelkamer"
board: "esp32-c3-devkitm-1"
framework: arduino
api_password: !secret bt_proxy_speelkamer_api
ota_password: !secret ota_password
wifi_ssid: !secret wifi_ssid
wifi_password: !secret wifi_password
gateway: !secret ip_gateway
subnet: !secret ip_subnet
ip: !secret bt_proxy_speelkamer_ip
pin_status: GPIO8
packages:
board: !include boards/esp32-gen.yaml
connection: !include common/wifi_btprox.yaml
device_base: !include common/common.yaml
logger: !include templates/logger.yaml
btproxy: !include templates/bt_proxy.yaml

View File

@@ -0,0 +1,26 @@
substitutions:
device_name: "btproxywoonkamer"
friendly_name: "BT_proxy_woonkamer"
comment: "ESP32-c3 proxy"
location: "woonkamer"
board: "esp32-c3-devkitm-1"
framework: arduino
api_password: !secret bt_proxy_woonkamer_api
ota_password: !secret ota_password
wifi_ssid: !secret wifi_ssid
wifi_password: !secret wifi_password
gateway: !secret ip_gateway
subnet: !secret ip_subnet
ip: !secret bt_proxy_woonkamer_ip
pin_status: GPIO8
packages:
board: !include boards/esp32-gen.yaml
connection: !include common/wifi_btprox.yaml
device_base: !include common/common.yaml
logger: !include templates/logger.yaml
#status: !include templates/status.yaml
btproxy: !include templates/bt_proxy.yaml

View File

@@ -0,0 +1,27 @@
substitutions:
device_name: "btproxyzolder"
friendly_name: "BT_proxy_zolder"
comment: "ESP32-c3 proxy"
location: "zolder"
board: "esp32-c3-devkitm-1"
#framework: esp-idf
framework: arduino
api_password: !secret bt_proxy_zolder_api
ota_password: !secret ota_password
wifi_ssid: !secret wifi_ssid
wifi_password: !secret wifi_password
gateway: !secret ip_gateway
subnet: !secret ip_subnet
ip: !secret bt_proxy_zolder_ip
pin_status: GPIO8
packages:
board: !include boards/esp32-gen.yaml
connection: !include common/wifi_btprox.yaml
device_base: !include common/common.yaml
logger: !include templates/logger.yaml
#status: !include templates/status.yaml
btproxy: !include templates/bt_proxy.yaml

File diff suppressed because it is too large Load Diff

View File

@@ -5,8 +5,15 @@
# window: 1100ms # default 30ms
# active: true
bluetooth_proxy:
esp32_ble_tracker:
scan_parameters:
interval: 1100ms
window: 1100ms
active: true
bluetooth_proxy:
active: true
#cache_services: true #needs idf
# binary_sensor:
# - platform: ble_presence

View File

@@ -0,0 +1,30 @@
---
# esp32_ble_tracker:
# scan_parameters:
# interval: 1100ms # default 320ms
# window: 1100ms # default 30ms
# active: true
esp32_ble_tracker:
scan_parameters:
interval: 1100ms
window: 1100ms
active: true
bluetooth_proxy:
active: true
cache_services: true
# binary_sensor:
# - platform: ble_presence
# mac_address: C8:B8:49:1F:07:7C
# name: "BLE tracker 1"
# sensor:
# - platform: ble_rssi
# mac_address: C8:B8:49:1F:07:7C
# name: "BLE tracker 1"
# text_sensor:
# - platform: ble_scanner
# name: "BLE Devices Scanner"

View File

@@ -1,5 +1,7 @@
ota:
password: ${ota_password}
- platform: esphome
id: my_ota
password: ${ota_password}
api:
encryption:

View File

@@ -19,7 +19,7 @@ wifi:
subnet: ${subnet}
dns1: 192.169.2.15
dns2: 1.1.1.1
# use_address: 192.168.2.63 #when changing fixed IP
#use_address: 192.168.2.235 #when changing fixed IP
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:

59
esphome/common/wifi_btprox.yaml Executable file
View File

@@ -0,0 +1,59 @@
# Enable Home Assistant API
api:
encryption:
key: ${api_password}
ota:
- platform: esphome
id: my_ota
password: ${ota_password}
wifi:
ssid: ${wifi_ssid}
password: ${wifi_password}
fast_connect: True
output_power: "8.5"
manual_ip:
static_ip: ${ip}
gateway: ${gateway}
subnet: ${subnet}
dns1: 192.169.2.15
dns2: 1.1.1.1
#use_address: 192.168.2.235 #when changing fixed IP
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: ${device_name}
password: ${wifi_password}
captive_portal:
sensor:
- platform: wifi_signal
name: "WiFi Signal "
update_interval: 10s
text_sensor:
- platform: wifi_info
ip_address:
name: IP Address
icon: mdi:wifi-strength-2
id: ipaddr
ssid:
name: "Connected SSID"
id: ssid
icon: mdi:wifi-strength-2
entity_category: diagnostic
bssid:
name: "Connected BSSID"
id: bssid
icon: mdi:wifi-strength-2
entity_category: diagnostic
mac_address:
name: "WiFi Mac Address"
id: macaddress
icon: mdi:wifi-strength-2
entity_category: diagnostic

View File

@@ -0,0 +1,72 @@
# Enable Home Assistant API
api:
encryption:
key: ${api_password}
on_client_connected:
- lambda: |-
id(api_connection) = true;
- component.update: s3_box_lcd
- script.execute: saver_enabled
on_client_disconnected:
- lambda: |-
id(api_connection) = false;
ota:
password: ${ota_password}
platform: esphome
wifi:
ssid: ${wifi_ssid}
password: ${wifi_password}
fast_connect: True
manual_ip:
static_ip: ${ip}
gateway: ${gateway}
subnet: ${subnet}
dns1: 192.169.2.15
dns2: 1.1.1.1
# use_address: 192.168.2.63 #when changing fixed IP
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: ${device_name}
password: ${wifi_password}
on_connect:
- lambda: |-
id(wifi_connection) = true;
- display.page.show: idle_page
- component.update: s3_box_lcd
on_disconnect:
- lambda: |-
id(wifi_connection) = false;
sensor:
- platform: wifi_signal
name: "WiFi Signal "
update_interval: 10s
text_sensor:
- platform: wifi_info
ip_address:
name: IP Address
icon: mdi:wifi-strength-2
id: ipaddr
ssid:
name: "Connected SSID"
id: ssid
icon: mdi:wifi-strength-2
entity_category: diagnostic
bssid:
name: "Connected BSSID"
id: bssid
icon: mdi:wifi-strength-2
entity_category: diagnostic
mac_address:
name: "WiFi Mac Address"
id: macaddress
icon: mdi:wifi-strength-2
entity_category: diagnostic

View File

@@ -17,6 +17,7 @@ packages:
connection: !include common/wifi_nosens.yaml
logger: !include templates/logger.yaml
#add include
esphome:
includes:

View File

@@ -34,6 +34,7 @@ packages:
logger: !include templates/logger.yaml
i2c: !include interfaces/i2c_a.yaml
bluetooth: !include common/bluetooth.yaml
bt_proxy: !include common/bluetooth.yaml
improv_serial:

View File

@@ -47,67 +47,89 @@ api:
esphome:
on_boot:
- priority: -200.0
then:
# - stepper.report_position: # Set stepper to global variable
# id: stepper_motor
# position: !lambda return id(stepper_motor_global);
# - stepper.set_target: # Set stepper to global variable
# id: stepper_motor
# target: !lambda return id(stepper_motor_global);
# # - sensor.template.publish:
# # id: motor_hal
# # state: !lambda return id(hall_pos_global);
# - if: # If blind is Closed
# condition:
# - lambda: 'return id(stepper_motor_global) == 0;'
# then: # Publish state etc.
# - cover.template.publish:
# id: ${blinds_name}
# state: CLOSED
# current_operation: IDLE
# - if: # If blind is Open
# condition:
# - lambda: 'return id(stepper_motor_global) == id(endstop).state;'
# then: # Publish state etc.
# - cover.template.publish:
# id: ${blinds_name}
# state: OPEN
# current_operation: IDLE
# - if: # If blind is Neither
# condition:
# - lambda: 'return (id(stepper_motor_global) != 0) && (id(stepper_motor_global) != id(endstop).state);'
# then: # # Publish state etc.
# - cover.template.publish:
# id: ${blinds_name}
# position: !lambda 'return (float(float(id(stepper_motor).current_position) / float(id(endstop).state)));'
# current_operation: IDLE
priority: -100
then:
- number.set:
id: endstop_open
value: !lambda "return id(endstop_open_global);"
- number.set:
id: endstop_closed
value: !lambda "return id(endstop_close_global);"
- number.set:
id: calibration_max
value: !lambda "return id(calibration_max_global);"
globals:
# - id: stepper_motor_global # Integer for storing the stepper position in case of reboot
# type: int
# restore_value: True
# initial_value: '0'
# - id: openclosed # Boolean to store OPEN/CLOSED state
# type: bool
# restore_value: True
# initial_value: '0'
- id: hall_pos_global
type: int
restore_value: True
initial_value: '0'
- id: hall_pos_old
- id: endstop_open_global
type: int
restore_value: False
restore_value: True
initial_value: '0'
- id: endstop_close_global
type: int
restore_value: True
initial_value: '0'
- id: calibration_max_global
type: int
restore_value: True
initial_value: '250'
number:
- platform: template
id: endstop_open
min_value: -50
max_value: 50
step: 1
name: endstop open
optimistic: true
on_value:
then:
- globals.set:
id: endstop_open_global
value: !lambda "return x;"
- logger.log: "endstop open stored"
- platform: template
id: endstop_closed
min_value: -50
max_value: 50
step: 1
name: enstop closed
optimistic: true
on_value:
then:
- globals.set:
id: endstop_close_global
value: !lambda "return x;"
- logger.log: "endstop open stored"
- platform: template
id: calibration_max
min_value: 0
max_value: 1000
step: 1
name: calibration max
optimistic: true
on_value:
then:
- globals.set:
id: calibration_max_global
value: !lambda "return x;"
- logger.log: "calirbation max stored"
- platform: template
name: Stepper Control
min_value: -100
max_value: 100
step: 1
set_action:
then:
- stepper.set_target:
id: stepper_motor
target: !lambda 'return x;'
sensor:
# - platform: template
# id: stepper_pos
# name: stepper_pos
- platform: template
id: motor_hal
name: motor_hal
@@ -134,7 +156,7 @@ binary_sensor:
on_release:
- then:
- lambda: |-
static int motorvalue;
static int motorvalue = id(hall_pos_global);
if(id(halldirection).state){
motorvalue += 1;
}
@@ -146,177 +168,148 @@ binary_sensor:
ESP_LOGD("on sensor", "motor hall: %d", motorvalue);
# number:
# - platform: template
# name: endstop Control
# id: endstop
# min_value: 0
# max_value: 2000
# step: 1
# mode: slider
# unit_of_measurement: steps
# restore_value: True
# optimistic: True
stepper:
- platform: a4988
id: stepper_motor
step_pin: ${pin_mot_stp}
dir_pin: ${pin_mot_dir}
max_speed: 200
# Optional:
sleep_pin: ${pin_mot_slp}
acceleration: inf
deceleration: inf
cover:
button:
- platform: template
name: Dining Room Blinds
id: ${blinds_name}
open_action:
then:
- logger.log: "Opening"
- stepper.set_target:
id: stepper_motor
target: 750
- while:
condition:
lambda: 'return id(stepper_motor).current_position < id(endstop).state;'
then:
- cover.template.publish:
id: ${blinds_name}
position: !lambda 'return (float(float(id(stepper_motor).current_position) / float(id(endstop).state)));'
current_operation: OPENING
- delay: 1000 ms
- globals.set: # Set global to current position
id: stepper_motor_global
value: !lambda return id(stepper_motor).current_position;
- sensor.template.publish:
id: stepper_pos
state: !lambda return id(stepper_motor).current_position;
- globals.set: # Set toggle to OPEN (No need for 'optimistic mode')
id: openclosed
value: '1'
- cover.template.publish:
id: ${blinds_name}
state: OPEN
current_operation: IDLE
id: Calibrate_blinds
name: Calibrate blinds
on_press:
# reset all params
- globals.set:
id: hall_pos_global
value: "0"
#tell stepper that he is in the middle
- stepper.report_position:
id: stepper_motor
position: !lambda "return uint32_t(id(calibration_max));"
# It's best to call set_target directly after report_position, so that the stepper doesn't move
- stepper.set_target:
id: stepper_motor
target: !lambda "return uint32_t(id(calibration_max));"
#calibrate closed_endstop
- stepper.set_target:
id: stepper_motor
target: 0
- while:
condition:
lambda: 'return id(hall_pos_global) > -10;'
then:
- logger.log:
format: "hal pos = %i; stepper pos = %i"
args: [id(hall_pos_global), id(stepper_motor).current_position]
# cover:
# - platform: template
# name: Dining Room Blinds
# id: ${blinds_name}
# open_action:
# then:
# - logger.log: "Opening"
# - stepper.set_target:
# id: stepper_motor
# target: 750
# - while:
# condition:
# lambda: 'return id(stepper_motor).current_position < id(endstop).state;'
# then:
# - cover.template.publish:
# id: ${blinds_name}
# position: !lambda 'return (float(float(id(stepper_motor).current_position) / float(id(endstop).state)));'
# current_operation: OPENING
# - delay: 1000 ms
# - globals.set: # Set global to current position
# id: stepper_motor_global
# value: !lambda return id(stepper_motor).current_position;
# - sensor.template.publish:
# id: stepper_pos
# state: !lambda return id(stepper_motor).current_position;
# - globals.set: # Set toggle to OPEN (No need for 'optimistic mode')
# id: openclosed
# value: '1'
# - cover.template.publish:
# id: ${blinds_name}
# state: OPEN
# current_operation: IDLE
close_action:
then:
- logger.log: "Closing"
- stepper.set_target: # Send stepper to 0
id: stepper_motor
target: '0'
- while:
condition:
lambda: 'return id(stepper_motor).current_position > 0;'
then:
- cover.template.publish:
id: ${blinds_name}
position: !lambda 'return (float(float(id(stepper_motor).current_position) / float(id(endstop).state)));'
current_operation: CLOSING
- delay: 1000 ms
- globals.set: # Set global to current position
id: stepper_motor_global
value: !lambda return id(stepper_motor).current_position;
- sensor.template.publish:
id: stepper_pos
state: !lambda return id(stepper_motor).current_position;
- globals.set: # Set toggle to CLOSED (No need for 'optimistic mode')
id: openclosed
value: '0'
- cover.template.publish:
id: ${blinds_name}
state: CLOSED
current_operation: IDLE
position_action:
then:
- stepper.set_target:
id: stepper_motor
target: !lambda return int(id(endstop).state * pos);
- while:
condition:
lambda: 'return id(stepper_motor).current_position != int(id(endstop).state * pos);'
then:
- cover.template.publish:
id: ${blinds_name}
position: !lambda 'return (float(float(id(stepper_motor).current_position) / float(id(endstop).state)));'
- delay: 1000 ms
- globals.set: # Set global to current position
id: stepper_motor_global
value: !lambda return id(stepper_motor).current_position;
- sensor.template.publish:
id: stepper_pos
state: !lambda return id(stepper_motor).current_position;
- cover.template.publish:
id: ${blinds_name}
position: !lambda 'return (float(float(id(stepper_motor).current_position) / float(id(endstop).state)));'
current_operation: IDLE
stop_action:
then:
- stepper.set_target:
id: stepper_motor
target: !lambda return id(stepper_motor).current_position;
- globals.set: # Set global to current position
id: stepper_motor_global
value: !lambda return id(stepper_motor).current_position;
- sensor.template.publish:
id: stepper_pos
state: !lambda return id(stepper_motor).current_position;
- cover.template.publish:
id: ${blinds_name}
position: !lambda 'return (float(float(id(stepper_motor).current_position) / float(id(endstop).state)));'
current_operation: IDLE
has_position: true
device_class: blind
# - while:
# condition:
# lambda: 'return id(stepper_motor).current_position > 0;'
# then:
# - cover.template.publish:
# id: ${blinds_name}
# position: !lambda 'return (float(float(id(stepper_motor).current_position) / float(id(endstop).state)));'
# current_operation: CLOSING
# - delay: 1000 ms
# - globals.set: # Set global to current position
# id: stepper_motor_global
# value: !lambda return id(stepper_motor).current_position;
# - sensor.template.publish:
# id: stepper_pos
# state: !lambda return id(stepper_motor).current_position;
# - globals.set: # Set toggle to CLOSED (No need for 'optimistic mode')
# id: openclosed
# value: '0'
# - cover.template.publish:
# id: ${blinds_name}
# state: CLOSED
# current_operation: IDLE
# position_action:
# then:
# - stepper.set_target:
# id: stepper_motor
# target: !lambda return int(id(endstop).state * pos);
# - while:
# condition:
# lambda: 'return id(stepper_motor).current_position != int(id(endstop).state * pos);'
# then:
# - cover.template.publish:
# id: ${blinds_name}
# position: !lambda 'return (float(float(id(stepper_motor).current_position) / float(id(endstop).state)));'
# - delay: 1000 ms
# - globals.set: # Set global to current position
# id: stepper_motor_global
# value: !lambda return id(stepper_motor).current_position;
# - sensor.template.publish:
# id: stepper_pos
# state: !lambda return id(stepper_motor).current_position;
# - cover.template.publish:
# id: ${blinds_name}
# position: !lambda 'return (float(float(id(stepper_motor).current_position) / float(id(endstop).state)));'
# current_operation: IDLE
# stop_action:
# then:
# - stepper.set_target:
# id: stepper_motor
# target: !lambda return id(stepper_motor).current_position;
# - globals.set: # Set global to current position
# id: stepper_motor_global
# value: !lambda return id(stepper_motor).current_position;
# - sensor.template.publish:
# id: stepper_pos
# state: !lambda return id(stepper_motor).current_position;
# - cover.template.publish:
# id: ${blinds_name}
# position: !lambda 'return (float(float(id(stepper_motor).current_position) / float(id(endstop).state)));'
# current_operation: IDLE
# has_position: true
# device_class: blind
# switch:
# - platform: template
# name: Reset Blinds
# id: calibrate
# turn_on_action:
# - lambda: |-
# bool stall = false;
# long steps = 40;
# int oldpos = id(hall_pos_global);
# while(!stall)
# {
# id(stepper_motor).set_target(steps);
# if(oldpos != id(hall_pos_global)){
# steps+=40;
# }else{
# stall = true;
# ESP_LOGD("reset", "end_pos1 %d", steps);
# }
# oldpos = id(hall_pos_global);
# }
# id(calibrate).publish_state(false);
# //rotate to stall
# - stepper.set_target:
# id: stepper_motor
# target: !lambda 'return id(endstop).state * 2;'
# - wait_until:
# lambda: 'return id(stepper_motor).current_position == id(endstop).state*2;'
# - delay: 1s
# - stepper.set_target:
# id: stepper_motor
# target: '0'
# - globals.set: # Set global to current position
# id: stepper_motor_global
# value: !lambda return id(stepper_motor).current_position;
# - sensor.template.publish:
# id: stepper_pos
# state: !lambda return id(stepper_motor).current_position;
# - globals.set: # Set toggle to CLOSED (No need for 'optimistic mode')
# id: openclosed
# value: '0'
# - cover.template.publish:
# id: ${blinds_name}
# state: CLOSED
# current_operation: IDLE
# - globals.set:
# id: hall_pos_global
# value: '0'

View File

@@ -0,0 +1,27 @@
substitutions:
name: "esp32-s3-box-3-voiceasist"
friendly_name: ESP32 S3 Box 3 5a7a54
gateway: !secret ip_gateway
subnet: !secret ip_subnet
ip: !secret esp32-s3-box-3_ip
packages:
esphome.voice-assistant: github://esphome/wake-word-voice-assistants/esp32-s3-box-3/esp32-s3-box-3.yaml@main
esphome:
name: ${name}
name_add_mac_suffix: false
friendly_name: ${friendly_name}
api:
encryption:
key: GKxKZNt/5rJJNTEoAvh1PLVESiUQRGnf1zWSHWZAnUw=
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
manual_ip:
static_ip: ${ip}
gateway: ${gateway}
subnet: ${subnet}
dns1: 192.169.2.15
dns2: 1.1.1.1

View File

@@ -22,9 +22,9 @@ packages:
connection: !include common/wifi.yaml
device_base: !include common/common.yaml
climate: !include templates/climate_nosens.yaml
#status: !include templates/status.yaml
status: !include templates/nostatus.yaml
logger: !include templates/nologger.yaml
button: !include templates/button.yaml
#button: !include templates/button.yaml
light:
- platform: neopixelbus
@@ -39,12 +39,12 @@ light:
effects:
- random:
name: "Random"
transition_length: 4s
update_interval: 5s
transition_length: 2s
update_interval: 7s
- addressable_rainbow:
name: Rainbow Effect
speed: 20
width: 17
speed: 16
width: 4
#GPIO4 - status

View File

@@ -31,6 +31,7 @@ packages:
#status: !include templates/status.yaml
logger: !include templates/logger.yaml
sht3x: !include sensors/sht3x.yaml
smsl: !include templates/remote_smsl.yaml

View File

@@ -11,4 +11,5 @@ ethernet:
gateway: ${gateway}
subnet: ${subnet}
dns1: ${dns1}
dns2: ${dns2}
dns2: ${dns2}
#use_address: 192.168.2.235 #when changing fixed IP

View File

@@ -0,0 +1,6 @@
i2c:
- id: bus_a
sda: ${pin_sda}
scl: ${pin_scl}
frequency: 50kHz
scan: true

View File

@@ -0,0 +1,17 @@
---
i2c:
- id: bus_a
sda: ${pin_sda_a}
scl: ${pin_scl_a}
scan: false
sda_pullup_enabled: true
scl_pullup_enabled: true
frequency: 100kHz
- sda: ${pin_sda_b}
scl: ${pin_scl_b}
scan: false
sda_pullup_enabled: true
scl_pullup_enabled: true
frequency: 50kHz
id: bus_b

View File

@@ -0,0 +1,31 @@
---
switch:
- platform: gpio
id: enable_ir
name: "IR Power"
pin:
number: GPIO44
inverted: true
restore_mode: ALWAYS_ON
remote_receiver:
id: rcvr
pin:
number: 38
inverted: true
dump: all
rmt_channel: 4
memory_blocks: 4
# on_pronto:
# then:
# - lambda: 'id(ir_signals_vector).push_back(x.data);'
# - component.update: s3_box_lcd
remote_transmitter:
id: irtx
pin:
number: 39
inverted: false
carrier_duty_percent: 50%
rmt_channel: 0

View File

@@ -18,6 +18,7 @@ packages:
connection: !include common/wifi.yaml
device_base: !include common/common.yaml
logger: !include templates/logger.yaml
#parameter list: https://tools.remeha.nl/wp-content/uploads/sites/3/2020/08/Lijst-van-parameters-voor-GTW08.pdf
#modbus registers

View File

@@ -20,12 +20,6 @@ packages:
bt_proxy: !include common/bluetooth.yaml
logger: !include templates/nologger.yaml
web_server:
port: 80
local: true
js_include: "include/www.js"
js_url: ""
binary_sensor:
- platform: gpio
pin:
@@ -60,7 +54,7 @@ light:
variant: ws2812X
pin: ${pin_leds}
num_leds: 1
name: "${device_name}_RGB_Light"
name: moon
id: RGB_Light
effects:
- random:

View File

@@ -1,59 +1,48 @@
uart:
- !include ../interfaces/uart_ld2420.yaml
external_components:
- source: github://descipher/esphome@component.ld2420
#github://pr#4847
components: [ ld2420 ]
refresh: 1days
# Example configuration entry
ld2420:
uart_id: uart_ld
presence_time_window: 120s
detection_gate_min: 1
detection_gate_max: 12
g0_move_threshold: 60000
g0_still_threshold: 40000
g1_move_threshold: 30000
g1_still_threshold: 20000
g2_move_threshold: 400
g2_still_threshold: 200
g3_move_threshold: 250
g3_still_threshold: 200
g4_move_threshold: 250
g4_still_threshold: 200
g5_move_threshold: 250
g5_still_threshold: 200
g6_move_threshold: 250
g6_still_threshold: 200
g7_move_threshold: 250
g7_still_threshold: 150
g8_move_threshold: 250
g8_still_threshold: 150
g9_move_threshold: 250
g9_still_threshold: 100
g10_move_threshold: 250
g10_still_threshold: 100
g11_move_threshold: 250
g11_still_threshold: 100
g12_move_threshold: 250
g12_still_threshold: 100
g13_move_threshold: 200
g13_still_threshold: 100
g14_move_threshold: 200
g14_still_threshold: 100
g15_move_threshold: 200
g15_still_threshold: 100
text_sensor:
- platform: ld2420
fw_version:
name: LD2420 Firmware
sensor:
- platform: ld2420
moving_distance:
name : Moving Distance
binary_sensor:
- platform: ld2420
has_target:
name: Presence
name: Presence
select:
- platform: ld2420
operating_mode:
name: Operating Mode
number:
- platform: ld2420
presence_timeout:
name: Detection Presence Timeout
min_gate_distance:
name: Detection Gate Minimum
max_gate_distance:
name: Detection Gate Maximum
# See "Number" section below for detail
gate_select:
name: Select Gate to Set
still_threshold:
name: Set Still Threshold Value
move_threshold:
name: Set Move Threshold Value
button:
- platform: ld2420
apply_config:
name: Apply Config
factory_reset:
name: Factory Reset
restart_module:
name: Restart Module
revert_config:
name: Undo Edits

View File

@@ -0,0 +1,11 @@
---
sensor:
- platform: aht10
i2c_id: bus_b
variant: AHT20
temperature:
name: "Temperature"
id: temp_local
humidity:
name: "Humidity"
update_interval: 60s

View File

@@ -0,0 +1,29 @@
---
sensor:
- platform: adc
pin: ${pin_vbatt}
name: "Battery voltage"
id: battery_voltage
unit_of_measurement: "V"
accuracy_decimals: 1
device_class: "voltage"
entity_category: "diagnostic"
disabled_by_default: true
update_interval: 30s
attenuation: auto
filters:
- multiply: 4.11
- platform: copy
id: battery_percent
source_id: battery_voltage
name: "Battery level"
unit_of_measurement: "%"
accuracy_decimals: 0
device_class: "battery"
entity_category: "diagnostic"
filters:
- lambda: return (x - 2.7) / (4.2 - 2.7) * 100;
- clamp:
min_value: 0
max_value: 100

View File

@@ -11,7 +11,7 @@ sensor:
accuracy_decimals: 1
temperature_offset: 1.5 °C
address: 0x61
update_interval: 1s
update_interval: 5s
button:
- platform: template

View File

@@ -0,0 +1,20 @@
---
esp32_ble_tracker:
id: ble_tracker
scan_parameters:
continuous: false
bluetooth_proxy:
active: true
esphome:
on_boot: #this is to avoid slow startup time because of BT and WiFi "interactions?" , check https://github.com/esphome/issues/issues/2941#issuecomment-1331851692
priority: 250
then:
- wait_until:
condition:
wifi.connected:
- lambda: >
id(ble_tracker).set_scan_continuous(true);
id(ble_tracker).start_scan();

View File

@@ -6,4 +6,6 @@ logger:
sensor: ERROR
cover: ERROR
switch: ERROR
wifi: ERROR
wifi: ERROR
pulse_counter: ERROR
remote_receiver: DEBUG

View File

@@ -1,3 +1,9 @@
# disable logging
logger:
baud_rate: 0
baud_rate: 0
logs:
display: ERROR
sensor: ERROR
cover: ERROR
switch: ERROR
wifi: ERROR

12
esphome/templates/nostatus.yaml Executable file
View File

@@ -0,0 +1,12 @@
output:
- platform: gpio
pin: ${pin_status}
id: status_led
light:
- platform: binary
name: "status_led"
output: status_led
restore_mode: Restore_and_off

View File

@@ -0,0 +1,62 @@
---
button:
- platform: template
name: SMSL Source
id: smsl_source
icon: mdi:audio-input-stereo-minijack
on_press:
- remote_transmitter.transmit_nec:
address: 0x3412
command: 0xF807
command_repeats: 1
# - remote_transmitter.transmit_pronto:
# data: "0000 006D 0022 0000 0159 00AE 0015 0016 0015 0043 0014 0016 0015 0016 0015 0043 0014 0016 0015 0016 0015 0017 0015 0016 0015 0016 0015 0043 0014 0016 0015 0043 0014 0043 0014 0017 0015 0017 0015 0043 0014 0043 0014 0043 0014 0016 0016 0015 0016 0015 0016 0015 0016 0016 0016 0015 0016 0015 0016 0015 0016 0042 0015 0041 0016 0041 0016 0042 0015 0042 0015 0181"
- platform: template
name: SMSL power
id: smsl_power
icon: mdi:power
on_press:
- remote_transmitter.transmit_nec:
address: 0x3412
command: 0xFE01
command_repeats: 1
- platform: template
name: SMSL up
id: smsl_up
icon: mdi:volume-plus
on_press:
- remote_transmitter.transmit_nec:
address: 0x3412
command: 0xFD02
command_repeats: 1
- platform: template
name: SMSL down
id: smsl_down
icon: mdi:volume-minus
on_press:
- remote_transmitter.transmit_nec:
address: 0x3412
command: 0xF906
command_repeats: 1
- platform: template
name: SMSL mute
id: smsl_mute
icon: mdi:volume-mute
on_press:
- remote_transmitter.transmit_nec:
address: 0x3412
command: 0xF609
command_repeats: 1
# smsl amp
# NEC: address=0x3412
# source 0xF807 - wierdness :/
# up 0xFD02
# down 0xF906
# power 0xFE01
# mute 0xF609
# function 0xF708
# ok 0xFB04
# left 0xFC03
# right 0xFA05

View File

@@ -28,7 +28,8 @@ packages:
# connection: !include common/wifi.yaml
device_base: !include common/common.yaml
ethernet: !include interfaces/eth_LAN8720A.yaml
# bt_proxy: !include templates/ble_proxy.yaml
bt_proxy: !include common/bluetooth.yaml
ota: !include common/ota.yaml
logger: !include templates/nologger.yaml
uptimesensor: !include sensors/uptime.yaml