Convert to 1.0 and proper package, control

This commit is contained in:
Joshua Boniface 2024-04-23 00:33:45 -04:00
parent 755bd307e6
commit 5741701854

View File

@ -26,7 +26,7 @@ esphome:
friendly_name: "Supersensor" friendly_name: "Supersensor"
project: project:
name: joshuaboniface.supersensor name: joshuaboniface.supersensor
version: "0.1" version: "1.0"
on_boot: on_boot:
- priority: 600 - priority: 600
then: then:
@ -34,6 +34,7 @@ esphome:
id(supersensor_occupancy).publish_state(false); id(supersensor_occupancy).publish_state(false);
id(pir_presence).publish_state(false); id(pir_presence).publish_state(false);
id(light_presence).publish_state(false); id(light_presence).publish_state(false);
id(radar_presence).publish_state(false);
- light.turn_on: - light.turn_on:
id: output_led id: output_led
effect: flash_white effect: flash_white
@ -42,11 +43,15 @@ esphome:
- wait_until: - wait_until:
api.connected: api.connected:
- delay: 5s - delay: 5s
- switch.turn_on: use_wake_word - if:
condition:
and:
- switch.is_on: enable_voice_support
then:
- switch.turn_on: voice_support_active
dashboard_import: dashboard_import:
package_import_url: github://joshuaboniface/supersensor/supersensor.yaml package_import_url: github://joshuaboniface/supersensor/supersensor.yaml
import_full_config: false
esp32: esp32:
board: esp32dev board: esp32dev
@ -201,35 +206,20 @@ script:
} }
logger: logger:
level: DEBUG level: INFO
baud_rate: 115200 baud_rate: 115200
api: api:
encryption:
key: !secret api_encryption_key
on_client_connected:
- logger.log:
format: "Client %s connected to API with IP %s"
args: ["client_info.c_str()", "client_address.c_str()"]
on_client_disconnected:
- logger.log:
format: "Client %s connected to API with IP %s"
args: ["client_info.c_str()", "client_address.c_str()"]
ota: ota:
password: !secret ota_password
safe_mode: false
web_server: web_server:
port: 80 port: 80
auth:
username: !secret web_auth_username
password: !secret web_auth_password
wifi: wifi:
ssid: !secret wifi_ssid ap: {}
password: !secret wifi_password domain: ""
domain: !secret wifi_domain fast_connect: false
reboot_timeout: 15min reboot_timeout: 15min
uart: uart:
@ -263,7 +253,7 @@ interval:
- if: - if:
condition: condition:
and: and:
- switch.is_on: use_wake_word - switch.is_on: voice_support_active
- not: voice_assistant.is_running - not: voice_assistant.is_running
then: then:
- logger.log: "voice assistant not running; restarting" - logger.log: "voice assistant not running; restarting"
@ -280,7 +270,7 @@ voice_assistant:
- logger.log: "voice error" - logger.log: "voice error"
- if: - if:
condition: condition:
switch.is_on: use_wake_word switch.is_on: voice_support_active
then: then:
- voice_assistant.stop: - voice_assistant.stop:
- delay: 1s - delay: 1s
@ -291,7 +281,7 @@ voice_assistant:
- if: - if:
condition: condition:
and: and:
- switch.is_on: use_wake_word - switch.is_on: voice_support_active
- not: voice_assistant.is_running - not: voice_assistant.is_running
then: then:
- voice_assistant.start_continuous: - voice_assistant.start_continuous:
@ -300,7 +290,7 @@ voice_assistant:
on_client_disconnected: on_client_disconnected:
- if: - if:
condition: condition:
switch.is_on: use_wake_word switch.is_on: voice_support_active
then: then:
- voice_assistant.stop: - voice_assistant.stop:
- light.turn_on: - light.turn_on:
@ -663,10 +653,23 @@ button:
entity_category: diagnostic entity_category: diagnostic
switch: switch:
# Global enable/disable for voice support
- platform: template - platform: template
name: "Enable Wake Word" name: "Enable Voice Support"
icon: mdi:account-voice icon: mdi:account-voice
id: use_wake_word id: enable_voice_support
optimistic: true
restore_mode: RESTORE_DEFAULT_OFF
entity_category: config
on_turn_on:
- switch.turn_on: voice_support_active
on_turn_off:
- switch.turn_off: voice_support_active
# Active voice support flag/switch
- platform: template
name: "Voice Support Active"
icon: mdi:account-voice
id: voice_support_active
optimistic: true optimistic: true
restore_mode: ALWAYS_OFF restore_mode: ALWAYS_OFF
entity_category: config entity_category: config