Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
1.2 kB
273
Indexable
Never
sensor:

  - platform: template
    sensors:
      outside_temperature:
        value_template: "{{ states.weather.forecast_home.attributes.temperature }}"
        friendly_name: "Outside Temperature"

  - platform: time_date
    display_options:
      - "time"
      - "date"
      - "date_time"
      - "date_time_utc"
      - "date_time_iso"
      - "time_date"
      - "time_utc"
      - "beat"

  - platform: command_line
    name: GPT Response
    command: 'curl -XPOST https://api.openai.com/v1/chat/completions -H ''Content-Type: application/json'' -H ''Authorization: Bearer AUTH_TOKEN_HERE'' -d ''{"model": "gpt-3.5-turbo", "messages": [{"role": "user", "content": "Imagine you are greeting a friend into his own house. The current time is {{ states("sensor.time") }}, and the current day is {{ now().strftime("%A") }}. The weather is {{ states("weather.forecast_home") }} and the outside temperature in degrees is {{ states("sensor.outside_temperature") }}. Use this information to craft your greeting message." }], "top_p": 1, "temperature": 0.7, "max_tokens": 320, "presence_penalty": 1}'''
    value_template: "{{ value_json.choices[0].message.content }}"
    scan_interval: 100