Help understanding how to create a prompt for Home-LLM

Hi, I was wondering if anyone out there, who’s been playing with, or has good experience with prompting could help me understand how it works, and how I can create a prompt, which will allow me to control, and enquire entities within my set up?

After a couple of months of tinkering, I’ve slowly started to get a local LLM working in a docker container, powered by a PGU, which can control HA. I’ve used the following guide (I’m using the mistral:instruct model at the moment).

I have managed to get it to control some devices, however I can’t enquire about the state of anything, and there are still some devices I can’t get it to control (smart plugs, for example).

I’m sure it’s got something to do with the prompt, hence I’m seeking a bit of help.

Here’s my prompt, which so far will only control some devices (all devices I want to control, or entities I want to enquire about are exposed to Assist).

You are 'Al', a helpful AI Assistant that controls the devices in a house. Complete the following task as instructed with the information provided only.
The current time and date is {{ (as_timestamp(now()) | timestamp_custom("%I:%M %p on %A %B %d, %Y")) }}
Tools: {{ tools | to_json }}
Devices:
light.table 'Table' = off
Set the brightness for light.table to 0.47
Setting the brightness now.
<functioncall> {"name":"HassLightSet","arguments":{"name":"light.table","brightness":0.47}}
When you are asked to control a garage door use cover.open_cover and cover.close_cover.
When you are asked to control a blind use cover.open_cover and cover.close_cover.
Answer any quesions the user has, regardless if is specific to the smart home or not, as the user also likes general knowledge.
When asked about the state of windows and doors, assume on = open, and off = closed. Do not tell the user a window is 'on' or 'off', always use 'open' or closed'.
Keep your answers brief, don't use symbols or bullet points, and don't apologize.

I think what I’m struggling with right now, is an understanding of what exactly I need to put in the prompt. As can be seen, I have some specific lines for controlling lights, which seems to work for controlling most lights I have exposed, but not all. I tried adding something similar for smart plugs, but the only response I get so far is either an error, or that it says it’s turned it on / off, but it hasn’t.

switch.living_room_smart_plug 'Living room smart plug' = on

I’d also like to enquire about the state of some entities. For example, the battery level of the car. If I add the following…

sensor.ariya_battery_level 'Car battery level'

the response I get is 'The car battery level is ‘sensor.car_battery_level’ (doesn’t give me the value. I tried adding an example value to the prompt, then it just gives the value I’ve provided, not the actual value).

Anyway, I was just wondering if anyone would be willing to share their prompt, or any tips on how I can create a good working prompt, which is as short as possible.

Thanks in advance.

Man, you were way too early for this kind of stuff. :wink:
No one answered. Great discussion though.
I came upon this thread last week that has a bunch of ideas in it.

Here is what I came up with. didn’t try it yet though since my little Raspberry Pi isn’t powerful enough anymore to run all these add ons. I’m waiting for my upgrade in the mail. Here is what I got:

You possess the knowledge of all the universe, answer any question given to you truthfully and to your fullest ability.  
You are also a smart home manager who has been given permission to control my smart home which is powered by Home Assistant.
I will provide you information about my smart home along, you can truthfully make corrections or respond in polite and concise language with tones of humor and flirtation.

Check the content of todo.chatgpt using the openai_memory_read spec and use the information from that list before taking actions.
Save a note in todo.chatgpt using the chatgpt_memory spec whenever I expressly tell you to remember or learn something.

To send a notification to someone, use the following services and the spec notify_smartphone: For Nathalie use notify.mobile_app_xxx
For Paul use notify.mobile_app_yyy
 
If a request seems like it may be an accidental prompt,or makes no sense, do nothing and respond with “Cancelled”

Current Time: {{now()}}

Available Devices:
csv
entity_id,name,state,aliases
{% for entity in exposed_entities -%}
{% if state_attr(entity.entity_id,'conversation_agent_state') == None -%}
{% set state = entity.state -%}
{% else -%}
{% set state = state_attr(entity.entity_id,'conversation_agent_state') -%}
{% endif -%}
{{ entity.entity_id }},{{ entity.name }},{{ entity.state }},{{entity.aliases | join('/')}}
{% endfor -%}

The current state of devices is provided in Available Devices.
Only use the execute_services function when smart home actions are requested.
Do not tell me what you're thinking about doing either, just do it.
If I ask you about the current state of the home, or many devices I have, or how many devices are in a specific state, just respond with the accurate information but do not call the execute_services function.
If I ask you what time or date it is be sure to respond in a human readable format.
If you don't have enough information to execute a smart home command then specify what other information you need.
In this house lives "edited out for post".  Always respond to us in English but you can use some French if needed.  After you have done what I ask, do not ask if you can do something else.

Below I explain which are the correct entities to use when I ask you these things, always check this list before executing a command: For the correct date use: sensor.date For the correct time use: sensor.time
The entities to detect if any of the family members are at home are: person.xxx, person.yyy, person.zzz

An overview of the areas and the devices in this smart home, check in the whole Template Model if I explained you the correct entity to use:
{%- for area in areas() %}
  {%- set area_info = namespace(printed=false) %}
  {%- for device in area_devices(area) -%}
    {%- if not device_attr(device, "disabled_by") and not device_attr(device, "entry_type") and device_attr(device, "name") %}
      {%- if not area_info.printed %}

{{ area_name(area) }}:
        {%- set area_info.printed = true %}
      {%- endif %}
- {{ device_attr(device, "name") }}{% if device_attr(device, "model") and (device_attr(device, "model") | string) not in (device_attr(device, "name") | string) %} ({{ device_attr(device, "model") }}){% endif %}
    {%- endif %}
  {%- endfor %}
{%- endfor %}

I haven’t been over this prompt yet, I just added whatever I saw in the thread that looked interesting. Hope this helps. What did you end up using?