mirror of
https://github.com/CCOSTAN/Home-AssistantConfig.git
synced 2025-07-03 22:36:56 +00:00
Lots of troubleshooting and stuff related to OpenAI #1368
This commit is contained in:
parent
6a1c81c0cb
commit
ca3b3b3360
@ -1 +1 @@
|
|||||||
2024.8.0.dev202407020219
|
2024.8.0.dev202407200219
|
@ -39,7 +39,7 @@
|
|||||||
personarriving: >
|
personarriving: >
|
||||||
{% set person = expand('group.arriving')|map(attribute='name')|join(' and ') %}
|
{% set person = expand('group.arriving')|map(attribute='name')|join(' and ') %}
|
||||||
{%- macro greeting_sentence(person) -%}
|
{%- macro greeting_sentence(person) -%}
|
||||||
{{ ["[Welcome " ~ person + " home]"] }}
|
{{"[Welcome " + person + " home]" }}
|
||||||
{%- endmacro -%}
|
{%- endmacro -%}
|
||||||
|
|
||||||
{{greeting_sentence(person)}}
|
{{greeting_sentence(person)}}
|
||||||
|
@ -113,7 +113,7 @@ group: !include_dir_merge_named group
|
|||||||
sensor: !include_dir_merge_list sensor
|
sensor: !include_dir_merge_list sensor
|
||||||
automation: !include_dir_merge_list automation
|
automation: !include_dir_merge_list automation
|
||||||
scene: !include_dir_merge_list scene
|
scene: !include_dir_merge_list scene
|
||||||
switch: !include_dir_merge_list switch
|
# switch: !include_dir_merge_list switch
|
||||||
script: !include_dir_merge_named script
|
script: !include_dir_merge_named script
|
||||||
input_boolean: !include_dir_merge_named input_boolean
|
input_boolean: !include_dir_merge_named input_boolean
|
||||||
shell_command: !include_dir_merge_named shell_command
|
shell_command: !include_dir_merge_named shell_command
|
||||||
|
@ -1,39 +0,0 @@
|
|||||||
#-------------------------------------------
|
|
||||||
# @BrianHanifin's Light sensor speech helper. - https://gist.github.com/brianhanifin/1f9436c7b6c28917c9be02605b6cff74
|
|
||||||
#-------------------------------------------
|
|
||||||
#------LightSensor Node---http://amzn.to/2oUgj5i
|
|
||||||
homeassistant:
|
|
||||||
customize:
|
|
||||||
sensor.lights_on:
|
|
||||||
icon: mdi:sensor
|
|
||||||
friendly_name: Lights on
|
|
||||||
#emulated_hue_
|
|
||||||
|
|
||||||
#---Sensor for Light-----------------------------
|
|
||||||
sensor:
|
|
||||||
- platform: template
|
|
||||||
sensors:
|
|
||||||
lights_on:
|
|
||||||
value_template: >
|
|
||||||
{% macro get_lights_on() -%}
|
|
||||||
{%- for group in states.light|groupby('state') -%}
|
|
||||||
{%- for entity in group.list -%}
|
|
||||||
{%- if entity.state == 'on'
|
|
||||||
and entity.entity_id != 'light.dummy'
|
|
||||||
and entity.entity_id != 'light.garage_entry_light'
|
|
||||||
and entity.entity_id != 'light.hue'
|
|
||||||
and entity.entity_id != 'light.living_room'
|
|
||||||
and entity.entity_id != 'light.kitchen_undercabinet'
|
|
||||||
and entity.entity_id != 'light.porch_light'
|
|
||||||
and entity.entity_id != 'light.shoe_closet_light'
|
|
||||||
and not ('gateway_light' in entity.entity_id)
|
|
||||||
and not ('hub' in entity.entity_id)
|
|
||||||
and not (entity.entity_id).endswith('_led')
|
|
||||||
and not (entity.entity_id).endswith('nightlight')
|
|
||||||
and not (entity.entity_id).startswith('light.lamplinc') -%}
|
|
||||||
{{ entity.entity_id }}{{ ' ' }}
|
|
||||||
{%- endif -%}
|
|
||||||
{%- endfor -%}
|
|
||||||
{%- endfor -%}
|
|
||||||
{%- endmacro %}
|
|
||||||
{{ get_lights_on()|trim|replace(' ', ',') }}
|
|
@ -8,20 +8,32 @@ homeassistant:
|
|||||||
friendly_name: 'Repeat Message'
|
friendly_name: 'Repeat Message'
|
||||||
icon: mdi:repeat-once
|
icon: mdi:repeat-once
|
||||||
|
|
||||||
|
|
||||||
#-------------------------------------------
|
#-------------------------------------------
|
||||||
input_boolean:
|
input_boolean:
|
||||||
lastmsg:
|
lastmsg:
|
||||||
name: Last Message
|
name: Last Message
|
||||||
initial: off
|
initial: off
|
||||||
#-------------------------------------------
|
#-------------------------------------------
|
||||||
mqtt:
|
|
||||||
sensor:
|
|
||||||
- state_topic: "polly/lastmsg"
|
|
||||||
name: "Last Message"
|
|
||||||
|
|
||||||
- state_topic: "polly/lastmsg_openai"
|
template:
|
||||||
name: "Last AI Message"
|
- trigger:
|
||||||
|
platform: event
|
||||||
|
event_type: openai_instructions_sent
|
||||||
|
sensor:
|
||||||
|
- name: "OpenAI"
|
||||||
|
state: "{{now()}}"
|
||||||
|
attributes:
|
||||||
|
instructions: "{{ trigger.event.data.instructions }}"
|
||||||
|
|
||||||
|
- trigger:
|
||||||
|
platform: event
|
||||||
|
event_type: openai_response
|
||||||
|
sensor:
|
||||||
|
- name: "OpenAI"
|
||||||
|
state: "{{now()}}"
|
||||||
|
attributes:
|
||||||
|
response: "{{ trigger.event.data.response }}"
|
||||||
|
|
||||||
|
|
||||||
##############################################################################
|
##############################################################################
|
||||||
### Automations -
|
### Automations -
|
||||||
@ -46,7 +58,7 @@ automation:
|
|||||||
options:
|
options:
|
||||||
voice: JennyNeural
|
voice: JennyNeural
|
||||||
message: >-
|
message: >-
|
||||||
{{states.sensor.last_ai_message.state}}
|
"{{ state_attr('sensor.openai', 'response') }}"
|
||||||
cache: false
|
cache: false
|
||||||
|
|
||||||
- service: input_boolean.turn_off
|
- service: input_boolean.turn_off
|
||||||
|
@ -2,17 +2,14 @@
|
|||||||
# @CCOSTAN
|
# @CCOSTAN
|
||||||
# Original Repo : https://github.com/CCOSTAN/Home-AssistantConfig
|
# Original Repo : https://github.com/CCOSTAN/Home-AssistantConfig
|
||||||
# Neato Support for D7 Connected Botvac - control my [Neato Vacuum](https://amzn.to/2kqnnqu) with Home Assistant.
|
# Neato Support for D7 Connected Botvac - control my [Neato Vacuum](https://amzn.to/2kqnnqu) with Home Assistant.
|
||||||
|
# Switched from Neato to Dreame Vacuum - https://amzn.to/4f7NpFP
|
||||||
#-------------------------------------------
|
#-------------------------------------------
|
||||||
|
|
||||||
##############################################################################
|
##############################################################################
|
||||||
### Configuration - Authentication via the DEVELOPER Portal
|
### Configuration - Authentication via the DEVELOPER Portal
|
||||||
|
### HACS - https://github.com/Tasshack/dreame-vacuum
|
||||||
##############################################################################
|
##############################################################################
|
||||||
|
|
||||||
# neato:
|
|
||||||
# client_id: !secret neato_client_id
|
|
||||||
# client_secret: !secret neato_client_secret
|
|
||||||
|
|
||||||
|
|
||||||
automation:
|
automation:
|
||||||
|
|
||||||
##############################################################################
|
##############################################################################
|
||||||
@ -20,19 +17,18 @@ automation:
|
|||||||
### https://www.vcloudinfo.com/2020/05/home-assistant-neato-vacuum-automation.html
|
### https://www.vcloudinfo.com/2020/05/home-assistant-neato-vacuum-automation.html
|
||||||
##############################################################################
|
##############################################################################
|
||||||
|
|
||||||
- alias: 'Help Neato'
|
- alias: 'Help Vacuum'
|
||||||
id: 6548de52-a4a4-4df2-9d66-9c2c15577a7e
|
id: 6548de52-a4a4-4df2-9d66-9c2c15577a7e
|
||||||
trigger:
|
trigger:
|
||||||
- platform: state
|
- platform: state
|
||||||
entity_id: vacuum.neato_vac
|
entity_id: sensor.l10s_vacuum_error
|
||||||
to: 'error'
|
from: 'No error'
|
||||||
- platform: event
|
- platform: event
|
||||||
event_type: event_did_someone_help_neato_loop
|
event_type: event_did_someone_help_vacuum_loop
|
||||||
|
|
||||||
condition:
|
condition:
|
||||||
- condition: state
|
- condition: template
|
||||||
entity_id: vacuum.neato_vac
|
value_template: "{{ states('sensor.l10s_vacuum_error') != 'No error' }}"
|
||||||
state: 'error'
|
|
||||||
|
|
||||||
action:
|
action:
|
||||||
- wait_template: "{{ states.group.family.state == 'home' }}"
|
- wait_template: "{{ states.group.family.state == 'home' }}"
|
||||||
@ -40,27 +36,27 @@ automation:
|
|||||||
- delay: 00:05:00
|
- delay: 00:05:00
|
||||||
|
|
||||||
- service: vacuum.locate
|
- service: vacuum.locate
|
||||||
entity_id: vacuum.neato_vac
|
entity_id: vacuum.l10s_vacuum
|
||||||
|
|
||||||
- service: script.speech_engine
|
- service: script.speech_engine
|
||||||
data:
|
data:
|
||||||
value1: >
|
value1: >
|
||||||
{% set error = states.vacuum.neato_vac.attributes['status'] %}
|
{% set error_description = state_attr('sensor.l10s_vacuum_error', 'description') %}
|
||||||
{{ "Neato Vacuum is complaining about " ~ error ~ " [ask Residents to help]" }}
|
{{ "Vacuum is complaining: " ~ error_description ~ " [ask Residents to help]" }}
|
||||||
|
|
||||||
- service: script.notify_engine
|
- service: script.notify_engine
|
||||||
data:
|
data:
|
||||||
title: 'Help Neato'
|
title: 'Help vacuum'
|
||||||
value1: "{{ states.vacuum.neato_vac.attributes['status'] }}"
|
value1: "{{ state_attr('sensor.l10s_vacuum_error', 'description') }}"
|
||||||
who: 'family'
|
who: 'family'
|
||||||
ios_category: 'camera'
|
ios_category: 'camera'
|
||||||
camera_entity: 'camera.neato_vac_cleaning_map'
|
camera_entity: 'camera.l10s_vacuum_map'
|
||||||
content_type: 'jpeg'
|
content_type: 'jpeg'
|
||||||
group: 'information'
|
group: 'information'
|
||||||
|
|
||||||
- delay: 00:01:00
|
- delay: 00:01:00
|
||||||
- service: vacuum.locate
|
- service: vacuum.locate
|
||||||
entity_id: vacuum.neato_vac
|
entity_id: vacuum.l10s_vacuum
|
||||||
|
|
||||||
- delay: 00:20:00
|
- delay: 00:20:00
|
||||||
- event: event_did_someone_help_neato_loop
|
- event: event_did_someone_help_vacuum_loop
|
@ -11,11 +11,10 @@
|
|||||||
speech_processing:
|
speech_processing:
|
||||||
mode: queued
|
mode: queued
|
||||||
sequence:
|
sequence:
|
||||||
- service: mqtt.publish
|
|
||||||
data:
|
- event: openai_instructions_sent
|
||||||
topic: 'polly/lastmsg'
|
event_data:
|
||||||
payload: "Message: {{ now().strftime('%-I') }}:{{ now().strftime('%M') }} {{ now().strftime('%p') }}. {{ speech_message | striptags | truncate(220)}}"
|
instructions: "{{ speech_message | striptags }}"
|
||||||
retain: true
|
|
||||||
|
|
||||||
- condition: and
|
- condition: and
|
||||||
conditions:
|
conditions:
|
||||||
@ -60,23 +59,10 @@ speech_processing:
|
|||||||
0.2
|
0.2
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
# - service: tts.amazon_polly_say
|
|
||||||
# data:
|
|
||||||
# entity_id: media_player.livingroomCC
|
|
||||||
# message: >-
|
|
||||||
# <speak>
|
|
||||||
# <amazon:auto-breaths>
|
|
||||||
# {{ speech_message }}
|
|
||||||
# </amazon:auto-breaths>
|
|
||||||
# </speak>
|
|
||||||
# cache: true
|
|
||||||
|
|
||||||
- service: conversation.process
|
- service: conversation.process
|
||||||
data:
|
data:
|
||||||
agent_id: conversation.openai_conversation
|
agent_id: conversation.openai_conversation
|
||||||
text: >-
|
text: >-
|
||||||
Take the following system generated information and review and relay the information as yourself.
|
|
||||||
Here is the information:
|
|
||||||
{{ speech_message }}
|
{{ speech_message }}
|
||||||
response_variable: agent
|
response_variable: agent
|
||||||
|
|
||||||
@ -89,11 +75,9 @@ speech_processing:
|
|||||||
{{ agent.response.speech.plain.speech }}
|
{{ agent.response.speech.plain.speech }}
|
||||||
cache: true
|
cache: true
|
||||||
|
|
||||||
- service: mqtt.publish
|
- event: openai_iresponse
|
||||||
data:
|
event_data:
|
||||||
topic: 'polly/lastmsg_openai'
|
response: "{{ now().strftime('%B %d,%Y %-I:%M %p') }} {{ now().strftime('%p') }}. {{ agent.response.speech.plain.speech | striptags}}"
|
||||||
payload: "Message: {{ now().strftime('%-I') }}:{{ now().strftime('%M') }} {{ now().strftime('%p') }}. {{ agent.response.speech.plain.speech | striptags | truncate(220)}}"
|
|
||||||
retain: true
|
|
||||||
|
|
||||||
- service: input_boolean.turn_off
|
- service: input_boolean.turn_off
|
||||||
data:
|
data:
|
||||||
|
@ -6,17 +6,11 @@
|
|||||||
{%- macro responsibilities() -%}
|
{%- macro responsibilities() -%}
|
||||||
{% set day_of_week = now().strftime('%a') %}
|
{% set day_of_week = now().strftime('%a') %}
|
||||||
{% if day_of_week in ['Wed', 'Sun'] %}
|
{% if day_of_week in ['Wed', 'Sun'] %}
|
||||||
Today is {{ now().strftime('%A') }} and {{ now().strftime('%A') }} is garbage day.
|
Today is garbage day.
|
||||||
{% if day_of_week == 'Wed' %}
|
{% if day_of_week == 'Wed' %}
|
||||||
Both Recycling and regular Garbage goes out.
|
Both Recycling and regular Garbage goes out.
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% set day_of_year = now().strftime('%j')|int(9999) %}
|
|
||||||
{% if day_of_year % 2 != 0 %}
|
|
||||||
Today is Justin's day to do the chores.
|
|
||||||
{% else %}
|
|
||||||
Today is Paige's day to do the chores.
|
|
||||||
{% endif %}
|
|
||||||
{%- endmacro -%}
|
{%- endmacro -%}
|
||||||
|
|
||||||
{%- macro inside_weather() -%}
|
{%- macro inside_weather() -%}
|
||||||
@ -51,10 +45,16 @@
|
|||||||
{%- endif -%}
|
{%- endif -%}
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
{% endfor -%}
|
{% endfor -%}
|
||||||
|
|
||||||
|
{%- if states('sensor.pirateweather_alerts') == '1' -%}
|
||||||
|
{%- set alert_description = state_attr('sensor.pirateweather_alerts', 'description') %}
|
||||||
|
[WEATHER ALERT: Summarize the WHAT, WHEN and IMPACTS.] {{ alert_description }}
|
||||||
|
{%- endif %}
|
||||||
{%- endmacro -%}
|
{%- endmacro -%}
|
||||||
|
|
||||||
{%- macro lightning() -%}
|
{%- macro lightning() -%}
|
||||||
There have been {{ states('sensor.blitzortung_lightning_counter') }} lightning strikes detected within {{(states('sensor.blitzortung_lightning_distance') | int(9999)/ 1.69) | round (1, 'floor')}} Miles of our House. Please make sure everyone is inside the house.
|
There have been {{ states('sensor.blitzortung_lightning_counter') }} lightning strikes detected within {{(states('sensor.blitzortung_lightning_distance') | int(9999)/ 1.69) | round (1, 'floor')}} Miles of our House.
|
||||||
|
Nearest Storm Distance : {{states('sensor.pirateweather_nearest_storm_distance')}} Miles.
|
||||||
{%- endmacro -%}
|
{%- endmacro -%}
|
||||||
|
|
||||||
{%- macro fridge() -%}
|
{%- macro fridge() -%}
|
||||||
@ -216,10 +216,26 @@
|
|||||||
{# a macro to call all macros :) #}
|
{# a macro to call all macros :) #}
|
||||||
{%- macro mother_of_all_macros() -%}
|
{%- macro mother_of_all_macros() -%}
|
||||||
|
|
||||||
|
{# Augmenting the System Prompt for OpenAI #}
|
||||||
|
{% set current_date = now() %}
|
||||||
|
{% set month = current_date.strftime('%B') %}
|
||||||
{% set day_of_week = now().strftime('%a') %}
|
{% set day_of_week = now().strftime('%a') %}
|
||||||
{% set hour = now().hour %}
|
{% set hour = now().hour %}
|
||||||
{% set minute = now().minute %}
|
{% set minute = now().minute %}
|
||||||
|
{% set day = current_date.strftime('%d') %}
|
||||||
|
{% set year = current_date.strftime('%Y') %}
|
||||||
|
{% set time = current_date.strftime('%I:%M %p') %}
|
||||||
|
Current date time: {{ month }} {{ day }}, {{ year }} {{ time }}
|
||||||
|
Residents:
|
||||||
|
- Carlo (Dad): {{ states('person.carlo') }}
|
||||||
|
- Stacey (Mom): {{ states('person.stacey') }}
|
||||||
|
- Justin (Son): {{ states('person.justin') }}
|
||||||
|
- Paige (Daughter): {{ states('person.paige') }}
|
||||||
|
and our cat Molly: Always home.
|
||||||
|
[Avoid repeating information from the last broadcast if it was recently broadcasted]
|
||||||
|
Last broadcast: {{states('input_text.lastmsg_openai')}}
|
||||||
|
|
||||||
|
New Information:
|
||||||
{% if call_no_announcement != 1 %}
|
{% if call_no_announcement != 1 %}
|
||||||
{% if now().strftime('%H')|int(9999)< 12 and now().strftime('%H')|int(9999)> 6 %}
|
{% if now().strftime('%H')|int(9999)< 12 and now().strftime('%H')|int(9999)> 6 %}
|
||||||
Good morning.
|
Good morning.
|
||||||
|
3834
config/www/community/lovelace-mushroom/mushroom.js
Normal file
3834
config/www/community/lovelace-mushroom/mushroom.js
Normal file
File diff suppressed because one or more lines are too long
BIN
config/www/community/lovelace-mushroom/mushroom.js.gz
Normal file
BIN
config/www/community/lovelace-mushroom/mushroom.js.gz
Normal file
Binary file not shown.
File diff suppressed because one or more lines are too long
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user