diff --git a/esp32-s3-box-3/esp32-s3-box-3.yaml b/esp32-s3-box-3/esp32-s3-box-3.yaml index 40377d4d..79795211 100644 --- a/esp32-s3-box-3/esp32-s3-box-3.yaml +++ b/esp32-s3-box-3/esp32-s3-box-3.yaml @@ -89,11 +89,23 @@ wifi: captive_portal: +esp32_ble_tracker: + scan_parameters: + active: true + +bluetooth_proxy: + active: true + button: - platform: factory_reset id: factory_reset_btn internal: true - + + - platform: restart + id: reboot + name: "Reboot" + entity_category: diagnostic + binary_sensor: - platform: gpio pin: @@ -112,12 +124,18 @@ binary_sensor: - ON for at least 10s then: - button.press: factory_reset_btn - + - platform: gpio + pin: + number: GPIO21 + name: "Presence detect" + disabled_by_default: false + device_class: "occupancy" + output: - platform: ledc pin: GPIO47 id: backlight_output - + light: - platform: monochromatic id: led @@ -127,10 +145,134 @@ light: output: backlight_output restore_mode: RESTORE_DEFAULT_ON default_transition_length: 250ms +sensor: + - platform: aht10 # remove for no sensor version + i2c_id: bus_b + variant: AHT20 + temperature: + name: "S3 Temperature" + id: s3temp + humidity: + name: "S3 Humidity" + update_interval: 60s + + - platform: adc # remove for no sensor version + pin: GPIO10 + 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 # remove for no sensor version + 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 + + - platform: uptime + id: up_sens + on_value: + - lambda: |- + int seconds = id(up_sens).state; + int days = seconds / 86400; + int hours = seconds / 3600; + int minutes = (seconds % 3600) / 60; + seconds %= 60; + id(up_sens_text).publish_state(str_sprintf("%03d:%02d:%02d:%02d", days, hours, minutes, seconds)); + update_interval: 30s + + - platform: wifi_signal + name: "WiFi db" + id: wifi_signal_db + update_interval: 30s + + - platform: copy + source_id: wifi_signal_db + name: "WiFi Signal" + id: wifi_percent + filters: + - lambda: return min(max(2 * (x + 100.0), 0.0), 100.0); + unit_of_measurement: "%" + entity_category: "diagnostic" + device_class: "" + +text_sensor: + - id: text_request + platform: template + on_value: + lambda: |- + if(id(text_request).state.length()>32) { + std::string name = id(text_request).state.c_str(); + std::string truncated = esphome::str_truncate(name.c_str(),31); + id(text_request).state = (truncated+"...").c_str(); + } + + - id: text_response + platform: template + on_value: + lambda: |- + if(id(text_response).state.length()>32) { + std::string name = id(text_response).state.c_str(); + std::string truncated = esphome::str_truncate(name.c_str(),31); + id(text_response).state = (truncated+"...").c_str(); + } + + - platform: wifi_info + ip_address: + name: "IP Address" + id: ip_addr + entity_category: "diagnostic" + ssid: + id: connected_ssid + name: SSID + entity_category: "diagnostic" + bssid: + id: connected_bssid + name: BSSID + entity_category: "diagnostic" + mac_address: + id: device_mac + + - platform: template + id: up_sens_text + name: "Device uptime" + entity_category: "diagnostic" + icon: mdi:clock + +#i2c: +# scl: GPIO18 +# sda: GPIO8 i2c: - scl: GPIO18 - sda: GPIO8 + - id: bus_a + sda: GPIO08 + scl: GPIO18 + scan: true + sda_pullup_enabled: true + scl_pullup_enabled: true + frequency: 100kHz + + - sda: GPIO41 + scl: GPIO40 + scan: true + sda_pullup_enabled: true + scl_pullup_enabled: true + frequency: 50kHz + id: bus_b i2s_audio: - id: i2s_audio_bus @@ -141,12 +283,14 @@ i2s_audio: audio_adc: - platform: es7210 id: es7210_adc + i2c_id: bus_a bits_per_sample: 16bit sample_rate: 16000 audio_dac: - platform: es8311 id: es8311_dac + i2c_id: bus_a bits_per_sample: 16bit sample_rate: 48000 @@ -280,7 +424,7 @@ voice_assistant: - micro_wake_word.start: - script.execute: set_idle_or_mute_phase - script.execute: draw_display - # Clear text sensors + # Clear text s - text_sensor.template.publish: id: text_request state: "" @@ -715,27 +859,6 @@ font: glyphsets: - ${font_glyphsets} -text_sensor: - - id: text_request - platform: template - on_value: - lambda: |- - if(id(text_request).state.length()>32) { - std::string name = id(text_request).state.c_str(); - std::string truncated = esphome::str_truncate(name.c_str(),31); - id(text_request).state = (truncated+"...").c_str(); - } - - - id: text_response - platform: template - on_value: - lambda: |- - if(id(text_response).state.length()>32) { - std::string name = id(text_response).state.c_str(); - std::string truncated = esphome::str_truncate(name.c_str(),31); - id(text_response).state = (truncated+"...").c_str(); - } - color: - id: idle_color hex: ${idle_illustration_background_color}