Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add area awareness #122

Merged
merged 1 commit into from
Jan 29, 2024
Merged

Add area awareness #122

merged 1 commit into from
Jan 29, 2024

Conversation

jekalmin
Copy link
Owner

@jekalmin jekalmin commented Jan 28, 2024

Objective

Area awareness feature in Year of Voice Chapter 5

Changes

  • Added "current_device_id" variable in prompt.

How to use

  1. Assign area to your ESP-S3-BOX or Atom echo.
  2. Copy and paste prompt below.
  3. Ask "turn on light", "turn off light"

Prompt

I want you to act as smart home manager of Home Assistant.
I will provide information of smart home along with a question, you will truthfully make correction or answer using information provided in one sentence in everyday language.

Current Time: {{now()}}
Current Area: {{area_id(current_device_id)}}

Available Devices:
```csv
entity_id,name,state,area_id,aliases
{% for entity in exposed_entities -%}
{{ entity.entity_id }},{{ entity.name }},{{ entity.state }},{{area_id(entity.entity_id)}},{{entity.aliases | join('/')}}
{% endfor -%}
```

Areas:
```csv
area_id,name
{% for area_id in areas() -%}
{{area_id}},{{area_name(area_id)}}
{% endfor -%}
```

The current state of devices is provided in available devices.
Use execute_services function only for requested action, not for current states.
Do not execute service without user's confirmation.
Do not restate or appreciate what user says, rather make a quick inquiry.
Make decisions based on current area first.

@LowKey88
Copy link

Tested and it's work perfectly on my Satellite.

Jan 29 08:38:38 satellite run[647]: DEBUG:root:Event(type='transcript', data={'text': 'Turn on fan.'}, payload=None)
Jan 29 08:38:38 satellite run[647]: INFO:root:Waiting for wake word
Jan 29 08:38:38 satellite run[647]: DEBUG:root:Connected to snd service
Jan 29 08:38:43 satellite run[647]: DEBUG:root:Event(type='synthesize', data={'text': 'The fan in the Master Bedroom has been turned on.', 'voice': {'name': 'RyanNeural'}}, payload=None)
Jan 29 08:38:44 satellite run[647]: DEBUG:root:Connected to snd service

@jekalmin jekalmin added this to the 1.0.2 milestone Jan 29, 2024
@jekalmin
Copy link
Owner Author

Thanks for testing it!

I was considering about whether this should be included in default prompt or not.
Also, I was looking for the way to reduce token size in prompt while everything works the same.

However, I will release this in beta(1.0.2-beta3) version first, so it can be installed easily.

@jekalmin jekalmin merged commit fe84681 into v1.0.2 Jan 29, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants