Comments (3)
Hi Jekal, it worked!!!
I use home assistant from internet (using ngrok) so I use rest.
To get all the entities I tried with postman using {{base_url}}/states
Is it correct to configure the call like this?
- spec:
name: get_states
description: Get entity list
parameters:
type: object
function:
type: rest
resource_template: "https://myid.ngrok-free.app/api/states"
value_template: "{{ value_json.states }}"
headers:
Authorization: ""
from extended_openai_conversation.
Thanks for reporting an issue!
How can I map a particular prompt to use REST function?
You can register a function to gpt, and it automatically decides what data or function to use. There are a few function types (including REST) you can use in this integration.
What I want to achieve is to get temperature from a particular sensor, in your docs I see that is possible to use REST
Are you trying to get sensor from another remote HA or local HA?
-
If local, you can access the state of sensor easily just by exposing entities.
-
If it's remote, you will have to add a rest function like below.
- spec:
name: get_state
description: Get state of entity
parameters:
type: object
properties:
entity_id:
type: string
description: The entity id.
function:
type: rest
resource_template: "https://YOUR_BASE_URL/api/states/{{entity_id}}"
value_template: "{{ value_json.state }}"
headers:
Authorization: "Bearer YOUR_TOKEN"
You have to replace YOUR_BASE_URL
and YOUR_TOKEN
with your data.
Since only spec
part is passed to OpenAI, you don't have to let OpenAI know what url and token are.
Let OpenAI decide what entity_id from what you asked, which enables you to use entity_id
from rest function.
from extended_openai_conversation.
Since /api/states
returns a list of entities, you have to iterate over value_json
.
Also, since all entities are returned, maybe you have to limit the number of entities.
The more entities returned, the more costs.
- spec:
name: get_entities
description: Get entity list
parameters:
type: object
properties:
dummy:
type: string
description: Nothing
function:
type: rest
resource_template: "YOUR_BASE_URL/api/states"
headers:
Authorization: "Bearer YOUR_TOKEN"
value_template: >-
```csv
entity_id,name,state
{% for entity in value_json -%}
{% if loop.index < 3 -%}
{{ entity['entity_id'] }},"{{ entity['attributes']['friendly_name'] }}",{{ entity['state'] }}
{% endif -%}
{% endfor -%}
```
from extended_openai_conversation.
Related Issues (20)
- Calendar: Ask about specific events HOT 2
- Google Search Error HOT 6
- Custom Functions & Retrival of Documents, Notes... with PrivateGPT or Anything LLM HOT 5
- llama_cpp.server -- Input should be [...] and 500 Internal Server Error HOT 2
- Example Function "is_valid_entity" verifies given entity_ids if they are exposed, visible, etc.
- Expose service to call AI assistant to generate message in automatisation (Feature) HOT 1
- [Feature Request] Make helper function is_exposed() more available
- Something went wrong. Service call requested response data but did not match any entities. HOT 7
- What "expected_output" for open interpreter?
- Converting Llama3/Ollama to CrewAI creates an unusable (and angry) LLM
- No context history HOT 5
- Internet Access? HOT 8
- panic: Unrecognized schema: map[] HOT 6
- "Unexpected exception" error during integration suggests a problem with the OpenAI server URL
- Something went wrong service sensor.read not found HOT 2
- [Request] Schedule things ("turn off fan in 20 minutes") HOT 1
- Blocking call to open inside event loop warnings on 2024.6 dev HOT 2
- get_attributes function only pulls current day from weather.forecast_home HOT 1
- How to upgrade to gpt-4o HOT 5
- Migrate to native LLM API support in Home Assistant
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from extended_openai_conversation.