Lots of troubleshooting and stuff related to OpenAI #1368

This commit is contained in:
CCOSTAN
2024-07-24 05:48:36 +00:00
parent 6a1c81c0cb
commit ca3b3b3360
12 changed files with 5606 additions and 105 deletions

View File

@@ -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(' ', ',') }}

View File

@@ -7,22 +7,34 @@ homeassistant:
input_boolean.lastmsg:
friendly_name: 'Repeat Message'
icon: mdi:repeat-once
#-------------------------------------------
input_boolean:
lastmsg:
name: Last Message
initial: off
#-------------------------------------------
mqtt:
sensor:
- state_topic: "polly/lastmsg"
name: "Last Message"
- state_topic: "polly/lastmsg_openai"
name: "Last AI Message"
template:
- 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 -
##############################################################################
@@ -46,7 +58,7 @@ automation:
options:
voice: JennyNeural
message: >-
{{states.sensor.last_ai_message.state}}
"{{ state_attr('sensor.openai', 'response') }}"
cache: false
- service: input_boolean.turn_off

View File

@@ -2,17 +2,14 @@
# @CCOSTAN
# 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.
# Switched from Neato to Dreame Vacuum - https://amzn.to/4f7NpFP
#-------------------------------------------
##############################################################################
### 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:
##############################################################################
@@ -20,19 +17,18 @@ automation:
### https://www.vcloudinfo.com/2020/05/home-assistant-neato-vacuum-automation.html
##############################################################################
- alias: 'Help Neato'
- alias: 'Help Vacuum'
id: 6548de52-a4a4-4df2-9d66-9c2c15577a7e
trigger:
- platform: state
entity_id: vacuum.neato_vac
to: 'error'
entity_id: sensor.l10s_vacuum_error
from: 'No error'
- platform: event
event_type: event_did_someone_help_neato_loop
event_type: event_did_someone_help_vacuum_loop
condition:
- condition: state
entity_id: vacuum.neato_vac
state: 'error'
- condition: template
value_template: "{{ states('sensor.l10s_vacuum_error') != 'No error' }}"
action:
- wait_template: "{{ states.group.family.state == 'home' }}"
@@ -40,27 +36,27 @@ automation:
- delay: 00:05:00
- service: vacuum.locate
entity_id: vacuum.neato_vac
entity_id: vacuum.l10s_vacuum
- service: script.speech_engine
data:
value1: >
{% set error = states.vacuum.neato_vac.attributes['status'] %}
{{ "Neato Vacuum is complaining about " ~ error ~ " [ask Residents to help]" }}
value1: >
{% set error_description = state_attr('sensor.l10s_vacuum_error', 'description') %}
{{ "Vacuum is complaining: " ~ error_description ~ " [ask Residents to help]" }}
- service: script.notify_engine
data:
title: 'Help Neato'
value1: "{{ states.vacuum.neato_vac.attributes['status'] }}"
title: 'Help vacuum'
value1: "{{ state_attr('sensor.l10s_vacuum_error', 'description') }}"
who: 'family'
ios_category: 'camera'
camera_entity: 'camera.neato_vac_cleaning_map'
camera_entity: 'camera.l10s_vacuum_map'
content_type: 'jpeg'
group: 'information'
- delay: 00:01:00
- service: vacuum.locate
entity_id: vacuum.neato_vac
entity_id: vacuum.l10s_vacuum
- delay: 00:20:00
- event: event_did_someone_help_neato_loop
- event: event_did_someone_help_vacuum_loop