GithubHelp home page GithubHelp logo

Comments (5)

jekalmin avatar jekalmin commented on May 26, 2024 2

There are several ways to get it work, but the easist way might be following:

  • add "get_attributes" function
    - spec:
        name: get_attributes
        description: Get attributes of any home assistant entity
        parameters:
          type: object
          properties:
            entity_id:
              type: string
              description: entity_id
          required:
          - entity_id
      function:
        type: template
        value_template: "{{states[entity_id]}}"
  • expose your weather.xxxxxx entity.

In my case, I had to increase max token to 200 to avoid JsonDecodeError.
I will probably add more examples like this soon.

Reference

from extended_openai_conversation.

dancwilliams avatar dancwilliams commented on May 26, 2024 1

This works great for me! I can ask for the forecast today, tomorrow, etc and it works very well.

from extended_openai_conversation.

momoz avatar momoz commented on May 26, 2024 1

thanks the max tokens to 200 is what fixed it for me too.

from extended_openai_conversation.

jekalmin avatar jekalmin commented on May 26, 2024

Before this, I exposed entities of weather, humidity, temperature separately for current weather and registered a function for forecasts like below.

- spec:
    name: get_weather_forecasts
    description: Get the weather forecasts between two dates.
    parameters:
      type: object
      properties:
        start:
          type: string
          description: The start date.
        end:
          type: string
          description: The end date.
      required:
      - start
      - end
  function:
    type: template
    value_template: >
      {% set data = states['weather.naver_weather'].attributes['forecast'] | selectattr('datetime', '>=', strptime(start, "%Y-%m-%d")) | selectattr('datetime', '<=', strptime(end + " 23:59:59", "%Y-%m-%d %H:%M:%S")) | list %}
      ```csv
      datetime,templow,temperature,condition,condition_am,condition_pm,rain_rate_am,rain_rate_pm
      {% for forecast in data -%}
      {{ forecast['datetime'] }},{{ forecast['templow'] }},{{ forecast['temperature'] }},{{ forecast['condition'] }},{{ forecast['condition_am'] }},{{ forecast['condition_pm'] }},{{ forecast['rain_rate_am'] }},{{ forecast['rain_rate_pm'] }}
      {% endfor -%}
      ```

from extended_openai_conversation.

jekalmin avatar jekalmin commented on May 26, 2024

Feel free to reopen the issue.

from extended_openai_conversation.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.