Update more speech logic to use OpenAI. #1368

This commit is contained in:
CCOSTAN
2024-05-25 00:23:12 +00:00
parent 1ce3d22013
commit 12104c2e83
12 changed files with 29 additions and 232 deletions

View File

@@ -261,18 +261,8 @@ automation:
value1: >-
{% set opening = state_attr(trigger.entity_id, "friendly_name")%}
{%- macro opening_sentence(opening) -%}
{{ [
"The " ~ opening +" has been opened for about 5 minutes. I will shut down the Air Conditioner so you can enjoy the fresh air.",
"Since the " ~ opening +" is still open, I will turn off the air conditioners until you close it",
"The " ~ opening +" has been left open, I will turn off the AC to save some money for you.",
"We cant have the Air Conditioning running AND have " ~ opening +" open so I will turn off the AC.",
"Since running the AC while " ~ opening +" is open, I will turn off the Air Conditioner.",
"Once the " ~ opening +" is closed, I will turn the Air Conditioner back on",
"So we dont waste money, I will turn off the AC until " ~ opening +" has been closed.",
"The " ~ opening +" is open and we are cooling the outside. I will fix that by turning off the AC for now.",
"The fresh Air from the " ~ opening +" is great so I will turn off the AC until it is closed again.",
"When Doors and windows are left open like the " ~ opening +", I will remember to turn off the AC."
] | random }}
{{"Since the " ~ opening +" has been left open, I will turn off the air conditioners until you close it" }}
[Give a snarky reason for this action]
{%- endmacro -%}
{{opening_sentence(opening)}}
call_outside_weather: 1
@@ -294,10 +284,9 @@ automation:
value_template: "{{ states('climate.downstairs') == 'off' }}"
action:
- service: climate.set_hvac_mode
- service: climate.turn_on
data:
entity_id: climate.downstairs
hvac_mode: 'auto'
#-------------------------------------------#-------------------------------------------
- alias: 'Alarm lights in Living room'

View File

@@ -235,10 +235,10 @@ automation:
conditions:
- condition: state
entity_id: cover.large_garage_door
state: 'opened'
state: 'open'
- condition: state
entity_id: cover.small_garage_door
state: 'opened'
state: 'open'
action:
- service: input_boolean.turn_on
@@ -264,19 +264,6 @@ automation:
{%- endif %} The small Garage Door is open.
{% endif %}"
- service: script.tweet_engine_image
data:
tweet: >
{{ [
"Wind speed is {{ states('sensor.pirateweather_wind_speed')|round}} miles per hour. For safety, I'm going to close the @garadget doors.",
"Getting pretty windy! {{ states('sensor.pirateweather_wind_speed')|round}}MPH. Time to ask @Garadget to close the garage doors."
] | random + "(https://amzn.to/2jQLpVQ)"}}
image: >-
{{ [
"/config/www/custom_ui/floorplan/images/branding/windy.png"
] | random }}
##############################################################################
- alias: Is the Garage door Open at night - Checks every 30 minutes or 5 minutes after we drive away.
@@ -306,9 +293,9 @@ automation:
- condition: or
conditions:
- condition: template
value_template: "{{ states('cover.large_garage_door') == 'opened' }}"
value_template: "{{ states('cover.large_garage_door') == 'open' }}"
- condition: template
value_template: "{{ states('cover.small_garage_door') == 'opened' }}"
value_template: "{{ states('cover.small_garage_door') == 'open' }}"
- condition: and
conditions:
- condition: state
@@ -317,9 +304,9 @@ automation:
- condition: or
conditions:
- condition: template
value_template: "{{ states('cover.large_garage_door') == 'opened' }}"
value_template: "{{ states('cover.large_garage_door') == 'open' }}"
- condition: template
value_template: "{{ states('cover.small_garage_door') == 'opened'}}"
value_template: "{{ states('cover.small_garage_door') == 'open'}}"
action:
- service: script.notify_engine
@@ -333,5 +320,5 @@ automation:
- service: script.speech_engine
data:
value1: "Please check the garage doors. The Small garage is {{ states('cover.small_garage_door')}} and the large garage is {{ states('cover.large_garage_door')}}"
value1: "Please check the garage doors. The Small garage is {{ states('cover.small_garage_door')}} and the large garage is {{ states('cover.large_garage_door')}} [Only mention the garage door that is open]"

View File

@@ -46,7 +46,6 @@ automation:
{{ [
"Neato is asking for help. The error reported is " ~ error + " . Please find him and help him.",
"Please be nice and help Neato. He is complaining about " ~ error + ".",
"If you don't want to vacuum, you need to help Neato. He is complaining about " ~ error +" and needs help.",
"Something is wrong with Neato. Please find him and help him. I have detected a " ~ error + " error."
] | random }}

View File

@@ -55,7 +55,5 @@ automation:
- service: script.speech_engine
data:
value1: >
{{ [
"I have been asked to Turn the House Water back on. Please verify there are no leaks in the house. "
] | random }}
I have been asked to Turn the House Water back on. Please verify there are no leaks in the house.
call_no_announcement: 1

View File

@@ -56,13 +56,13 @@ automation:
group: 'information'
- service: script.speech_engine
data:
value1: "Please be aware that the hot water has dropped below 30% availability. Please consider taking a shower at another time."
value1: "Please be aware that the hot water has dropped below 30% availability. Please consider taking a shower at another time. Gallons used today: {{sensor.phyn_daily_water_usage}}"
- wait_template: "{{ states('sensor.rheem_wh_available_hot_water')|float > 50 }}"
timeout: '01:00:00' # Adjust timeout as needed
- service: script.speech_engine
data:
value1: "The available hot water is now above 50%. Normal showering can resume."
value1: "The available hot water is now above 50%. Normal showering can resume. Gallons used today: {{sensor.phyn_daily_water_usage}}"