Perplexity custom integration

Perplexity custom integration

Installation

You can install this integration manually or via HACS if you add the repository to the custom repository list (three dot menu >> Custom repositories)

Repository: https://github.com/bieniu/ha-perplexity

Configuration

To configure integration in Home Assistant, go to Settings >> Devices & services >> Add integration >> Perplexity or use My Home Assistant link.

Open your Home Assistant instance and start setting up a new integration.

To generate API key go to https://www.perplexity.ai/account/api/keys

Features

Perplexity integration supports:

2 Likes

great, will give it a try. Can this replace my google gemini limited api? As this is limited and I have perplexity pro, so would like to use it for AI tasks like analyze video and images.

Yes, if you need only an AI task platform, no if you need a conversation platform.

1 Like

My automation is this with a prompt to describe what is shown in the snapshot of a camera:

` - alias: Analyse camera image

action: ai_task.generate_data

data: `

Yes, the integration supports the generate_data action and structured output is also supported.

1 Like

Perplexity 1.1.0

:sparkles: New features

  • #30 Support Sonar Reasoning Pro model
  • #33 Add web search option

Perplexity 1.3.0

:sparkles: New features

  • #66 Support conversation platform

Perplexity 1.4.0

:sparkles: New features

  • #87 Support delayed actions @bieniu

Now you can ask the assistant to perform an action (for example, turn on the light) after some time or at a specific time.

Hi,
I’m using your ha-perplexity integration and would like to use Perplexity as an assistant in the “Assist microphone – Wyoming Protocol,” just like OpenAI ChatGPT or Google Gemini.

Currently, when I select Perplexity in the Wyoming → Assistant configuration, I get an HTTP 400 error. It seems that Assist/Wyoming sends requests in its own format (just like to OpenAI/Gemini), and the Perplexity integration doesn’t yet support this invocation method.

Would it be possible to:

add a mode in which the integration acts as an LLM assistant for Home Assistant Assist, similar to OpenAI or Gemini,

or integrate with “Assist pipeline” as an LLM provider (so that Perplexity can be selected as a model in the Pipelines configuration)?

The idea is for Perplexity to act as a full LLM backend for Home Assistant Assist (understanding “OK Nabu” commands and responding vocally), just like ChatGPT and Gemini.

Thanks for the great integration and for considering this feature!

That’s exactly how this integration works. It uses HA LLM API and it’s the backend for assist.

Thanks for the explanation.

A little clarification from me:
The ha-perplexity integration works correctly for me as a standard Conversation agent in Home Assistant – when I enter text, I get the correct text response from Perplexity (Sonar model) .

The problem only occurs in the voice scenario with the Assist Microphone (Wyoming Protocol) and the “OK Nabu” command.

The configuration looks like this:
Assist Microphone → Wyoming Protocol,
in Wyoming → Assistant, I select Perplexity as the assistant and then the call ends with an HTTP 400 on the integration side.

I understand that the integration uses the standard HA LLM API and thus acts as a backend for Conversation/Assist, but it seems that Wyoming sends a slightly different request format than the one the integration currently supports (possibly similar to OpenAI/Gemini), resulting in this 400.

Could you:
confirm whether the “Assist Microphone (Wyoming, OK Nabu) → Perplexity as Assistant” scenario is currently supported,
or consider adding an adapter/mode specifically for Wyoming Assistant (as is the case for OpenAI/Gemini)? If you need the detailed error code 400 I can attach it.

I think we should start this conversation with this.

Add this to your configuration.yaml file

logger:
  default: warning
  logs:
    custom_components.perplexity: debug
    perplexity: debug

restart HA and catch the problem in the log.

Error 400 is only announced by the assistant, but does not appear in the logs.

Below is the error from the log:

Rejestrator: custom_components.perplexity
Źródło: custom_components/perplexity/entity.py:105
integracja: Perplexity (dokumentacja, Problemy)
Pierwsze zdarzenie: 13:30:58 (1 wystąpienie)
Ostatnio zalogowany: 13:30:58

Could not convert message to Perplexity API: ToolResultContent(role='tool_result', agent_id='conversation.sonar', tool_call_id='01KMT6SW9VF6QCRDAW9YM64YNJ', tool_name='HassGetCurrentTime', tool_result={'speech': {'plain': {'speech': 'Jest godzina trzynasta trzydzieści', 'extra_data': None}}, 'response_type': 'action_done', 'speech_slots': {'time': datetime.time(13, 30, 48, 123243)}, 'data': {'targets': [], 'success': [], 'failed': []}}, created=datetime.datetime(2026, 3, 28, 12, 30, 48, 133841, tzinfo=datetime.timezone.utc))

and information from the “Download Diagnostics” option for Perplexity:

{
  "home_assistant": {
    "installation_type": "Home Assistant OS",
    "version": "2026.2.3",
    "dev": false,
    "hassio": true,
    "virtualenv": false,
    "python_version": "3.13.11",
    "docker": true,
    "arch": "x86_64",
    "timezone": "Europe/Warsaw",
    "os_name": "Linux",
    "os_version": "6.12.67-haos",
    "container_arch": "amd64",
    "supervisor": "2026.03.2",
    "host_os": "Home Assistant OS 17.1",
    "docker_version": "29.1.3",
    "chassis": "vm",
    "run_as_root": true
  },
  "custom_components": {
    "burze_dzis_net": {
      "documentation": "https://github.com/PiotrMachowski/Home-Assistant-custom-components-Burze.dzis.net",
      "version": "v2.0.1",
      "requirements": [
        "suds"
      ]
    },
    "hacs": {
      "documentation": "https://hacs.xyz/docs/use/",
      "version": "2.0.5",
      "requirements": [
        "aiogithubapi>=22.10.1"
      ]
    },
    "perplexity": {
      "documentation": "https://github.com/bieniu/ha-perplexity",
      "version": "1.6.1",
      "requirements": [
        "perplexityai==0.30.1",
        "aiofiles>=24.0.0"
      ]
    }
  },
  "integration_manifest": {
    "domain": "perplexity",
    "name": "Perplexity",
    "after_dependencies": [
      "assist_pipeline",
      "intent"
    ],
    "codeowners": [
      "bieniu"
    ],
    "config_flow": true,
    "dependencies": [
      "conversation"
    ],
    "documentation": "https://github.com/bieniu/ha-perplexity",
    "integration_type": "service",
    "iot_class": "cloud_polling",
    "issue_tracker": "https://github.com/bieniu/ha-perplexity",
    "requirements": [
      "perplexityai==0.30.1",
      "aiofiles>=24.0.0"
    ],
    "version": "1.6.1",
    "is_built_in": false,
    "overwrites_built_in": false
  },
  "setup_times": {
    "null": {
      "setup": 2.1970999998899288e-05
    },
    "01KMR7FE5G4FB0XGS3MJ0JR5Z7": {
      "wait_import_platforms": -1.7243024309999981,
      "config_entry_setup": 2.3851236050000004
    }
  },
  "data": {
    "title": "Perplexity",
    "data": {
      "api_key": "**REDACTED**"
    },
    "subentries": {
      "01KMR7T126RW2VHQG8H9C9ZEC4": {
        "data": {
          "include_home_location": true,
          "llm_hass_api": [
            "assist"
          ],
          "model": "sonar",
          "prompt": "Jeste\u015b asystentem g\u0142osowym w Home Assistant.\nOdpowiadaj szczerze na pytania o \u015bwiecie.\nOdpowiadaj zwyk\u0142ym tekstem. Niech b\u0119dzie prosto i na temat.",
          "web_search": true
        },
        "subentry_id": "01KMR7T126RW2VHQG8H9C9ZEC4",
        "subentry_type": "conversation",
        "title": "Sonar",
        "unique_id": null
      }
    }
  },
  "issues": []
}

That’s why I provided you with the logger configuration to capture a debug log containing all the information about what’s happening. Without the log, I can’t help.

Environment and integration

  • Home Assistant Core – up-to-date, other integrations working fine.
  • Perplexity custom integration from GitHub (bieniu/ha-perplexity).
  • Voice assistant with wake word “OK Nabu” (Assist / Nabu + Assist Microphone).
  • USB microphone and speaker.

What works correctly

  1. After restarting HA, when I use Perplexity only for internet questions, everything is stable:
  • “OK Nabu” → “What is the weather in Warsaw today?” – correct answer.
  • “OK Nabu” → “How much is 25 times 13?” – correct answer.
  • “OK Nabu” → “What is the capital of France?” – correct answer.Each question is preceded by a separate “OK Nabu”, with a few seconds pause between answers. In this scenario there is no 400 error and Perplexity behaves as expected.
  1. Light control itself also works:
  • “OK Nabu” → “Turn on Światło nad stołem” – the light turns on.
  • “OK Nabu” → “Turn off Światło nad stołem” – the light turns off.Logs show correct action execution, for example:
2026-03-29 13:19:47.594 DEBUG (MainThread) [custom_components.perplexity] Executing action: light.turn_on on light.shelly2_5_4_channel_1 with data {}
2026-03-29 13:20:11.728 DEBUG (MainThread) [custom_components.perplexity] Executing action: light.turn_off on light.shelly2_5_4_channel_1 with data {}

The problem – mixing internet questions and light control

The problem occurs only when I mix internet questions and light control in one conversation (one Perplexity context), even though each command is started with its own “OK Nabu”.

Reproducible test scenario:

  1. Restart HA, wait 1–2 minutes.

  2. “OK Nabu” → “What is the weather in Warsaw today?” – correct answer.

  3. “OK Nabu” → “Turn on Światło nad stołem.”

The light really turns on (e.g. around 13:50:44–13:50:47).

  1. “OK Nabu” → “What is the capital of France?”

Now I hear an error message about 400 (HTTP 400 – Bad Request) instead of a normal answer.

At this point, the logs show entries like (examples from different times):

2026-03-29 13:06:44.385 WARNING (MainThread) [custom_components.perplexity] Could not convert message to Perplexity API: ToolResultContent(role='tool_result', agent_id='conversation.sonar', tool_call_id='01KMWMC47Q2ZTZKH2038D2PYBS', tool_name='HassTurnOn', tool_result={'speech': {'plain': {'speech': 'Włączono światło', 'extra_data': None}}, 'response_type': 'action_done', 'data': {'targets': [], 'success': [{'name': 'Światło nad stołem', 'type': <IntentResponseTargetType.ENTITY: 'entity'>, 'id': 'light.shelly2_5_4_channel_2'}], 'failed': []}}, created=datetime.datetime(2026, 3, 29, 11, 6, 26, 579474, tzinfo=datetime.timezone.utc))

2026-03-29 13:06:44.386 WARNING (MainThread) [custom_components.perplexity] Could not convert message to Perplexity API: ToolResultContent(role='tool_result', agent_id='conversation.sonar', tool_call_id='01KMWMCC114VGHJ7RSKDQCE22N', tool_name='HassTurnOn', tool_result={'speech': {'plain': {'speech': 'Włączono światło', 'extra_data': None}}, 'response_type': 'action_done', 'data': {'targets': [], 'success': [{'name': 'Światło w korytarzu', 'type': <IntentResponseTargetType.ENTITY: 'entity'>, 'id': 'light.shelly1_3_przekaznik_shelly1_3'}], 'failed': []}}, created=datetime.datetime(2026, 3, 29, 11, 6, 34, 405560, tzinfo=datetime.timezone.utc))

2026-03-29 13:34:17.733 WARNING (MainThread) [custom_components.perplexity] Could not convert message to Perplexity API: ToolResultContent(role='tool_result', agent_id='conversation.sonar', tool_call_id='01KMWNYE37YZFG8K5WSKYD1RKS', tool_name='HassTurnOn', tool_result={'speech': {'plain': {'speech': 'Włączono światło', 'extra_data': None}}, 'response_type': 'action_done', 'data': {'targets': [], 'success': [{'name': 'Światło nad telewizorem', 'type': <IntentResponseTargetType.ENTITY: 'entity'>, 'id': 'light.shelly2pm_1_switch_1'}], 'failed': []}}, created=datetime.datetime(2026, 3, 29, 11, 33, 54, 946415, tzinfo=datetime.timezone.utc))

2026-03-29 13:34:17.733 WARNING (MainThread) [custom_components.perplexity] Could not convert message to Perplexity API: ToolResultContent(role='tool_result', agent_id='conversation.sonar', tool_call_id='01KMWNYTTDHM0YMMPVJ67P72B7', tool_name='HassTurnOff', tool_result={'speech': {'plain': {'speech': 'Wyłączono światło', 'extra_data': None}}, 'response_type': 'action_done', 'data': {'targets': [], 'success': [{'name': 'Światło nad telewizorem', 'type': <IntentResponseTargetType.ENTITY: 'entity'>, 'id': 'light.shelly2pm_1_switch_1'}], 'failed': []}}, created=datetime.datetime(2026, 3, 29, 11, 34, 7, 978105, tzinfo=datetime.timezone.utc))

2026-03-29 13:51:27.879 WARNING (MainThread) [custom_components.perplexity] Could not convert message to Perplexity API: ToolResultContent(role='tool_result', agent_id='conversation.sonar', tool_call_id='01KMWPX82JKAV23TJSQT1B665W', tool_name='HassTurnOn', tool_result={'speech': {'plain': {'speech': 'Włączono światło', 'extra_data': None}}, 'response_type': 'action_done', 'data': {'targets': [], 'success': [{'name': 'Światło nad stołem', 'type': <IntentResponseTargetType.ENTITY: 'entity'>, 'id': 'light.shelly2_5_4_channel_2'}], 'failed': []}}, created=datetime.datetime(2026, 3, 29, 11, 50, 44, 587691, tzinfo=datetime.timezone.utc))

Summary of the behavior:

Only internet questions → stable, no 400 error.

Only light control → lights are switched on/off correctly.

Internet → HassTurnOn/HassTurnOff → internet (each step with its own “OK Nabu”) → log shows Could not convert message to Perplexity API: ToolResultContent(…), and the next internet question returns a 400 error from Perplexity.

It looks like the integration tries to include ToolResultContent (with IntentResponseTargetType.ENTITY enum etc.) into the messages history sent to the Perplexity API and fails to convert it into a supported format, which then leads to HTTP 400.

I think you forgot to attach the log file.

Below:

The sequence was:
– “OK Nabu” → “What is the capital of France?” (works, 200 OK),
– “OK Nabu” again → “What is the capital of France?” (works),
– “OK Nabu” → “Turn on the light in the hallway.” (the light turns on, ToolResultContent for HassTurnOn appears in the log),
– “OK Nabu” → “What is the capital of Spain?” (I can already hear the 400 error here).

2026-03-29 19:02:29.697 DEBUG (MainThread) [perplexity._base_client] Request options: {'method': 'post', 'url': '/chat/completions', 'files': None, 'idempotency_key': 'stainless-python-retry-14d8eab3-c66c-4ac5-b440-78e4bf8d5c1c', 'content': None, 'json_data': {'messages': [{'role': 'user', 'content': 'hi'}], 'model': 'sonar', 'disable_search': True, 'max_tokens': 1}}
2026-03-29 19:02:29.698 DEBUG (MainThread) [perplexity._base_client] Sending HTTP Request: POST https://api.perplexity.ai/chat/completions
2026-03-29 19:02:30.233 DEBUG (MainThread) [perplexity._base_client] HTTP Response: POST https://api.perplexity.ai/chat/completions "200 OK" Headers([('date', 'Sun, 29 Mar 2026 17:02:30 GMT'), ('content-type', 'application/json'), ('transfer-encoding', 'chunked'), ('connection', 'keep-alive'), ('content-encoding', 'gzip'), ('x-ppl-region', 'us-east-1'), ('cf-cache-status', 'DYNAMIC'), ('set-cookie', '__cf_bm=uDFt_tVlmr_si2QX3uuWxEpcJ3RbzYq0YBVrATUUPwU-1774803750-1.0.1.1-lTcrD3F5KQBAPWC7ySkpHNm5L2vbr4.ymHN_wlnHZYHdM2AONWZ.ShpeRauakRTkZnc.P9r9Xrjc9N8FwDozPNAKksx60G9wimTNcubGXYI; path=/; expires=Sun, 29-Mar-26 17:32:30 GMT; domain=.perplexity.ai; HttpOnly; Secure; SameSite=None'), ('set-cookie', '__cflb=04dToWaRite5R1fQA5HfyWsXiTjNxDHdSkxknorPvD; SameSite=None; Secure; path=/; expires=Sun, 29-Mar-26 17:32:30 GMT; HttpOnly'), ('strict-transport-security', 'max-age=15552000; includeSubDomains; preload'), ('server', 'cloudflare'), ('cf-ray', '9e40714c0fed0985-WAW')])
2026-03-29 19:18:53.631 DEBUG (MainThread) [perplexity._base_client] Request options: {'method': 'post', 'url': '/chat/completions', 'files': None, 'idempotency_key': 'stainless-python-retry-f2d49ced-d93c-4681-bb48-c8aebdd78d01', 'content': None, 'json_data': {'messages': [{'role': 'system', 'content': 'Jesteś asystentem głosowym w Home Assistant.\nOdpowiadaj szczerze na pytania o świecie.\nOdpowiadaj zwykłym tekstem. Niech będzie prosto i na temat.\nCurrent time is 19:18:53. Today\'s date is 2026-03-29.\nUser\'s home location information:\nCoordinates: xx.xx,xx.007\nCountry: PL\n\nControl Home Assistant devices by including actions in your response.\n\nRespond with JSON: {"response":"<text>","actions":[<action>,...]|null}\nAction format: {"domain":"<str>","service":"<str>","target":"<entity_id>","data":<obj>|null,"delay_seconds":<num>|null}\n\ndelay_seconds: null/0=immediate. For timed requests, use two actions:\n"turn on fan for 30min" => turn_on(delay:null) + turn_off(delay:1800)\n"turn off light in 10min" => turn_off(delay:600)\nTime: 1min=60s, 1h=3600s.\n\nDomains/services (data params):\nclimate: turn_on,turn_off,set_temperature(temperature)\ncover: open_cover,close_cover,set_cover_position(position 0-100)\nfan: turn_on,turn_off,set_percentage(percentage 0-100)\nhumidifier: turn_on,turn_off,set_humidity(humidity 0-100)\nlight: turn_on(brightness 0-255,color_temp,rgb_color),turn_off\nlock: lock,unlock,open\nmedia_player: media_play,media_pause,volume_set(volume_level 0-1)\nscene: turn_on\nscript: turn_on\nsiren: turn_on,turn_off\nswitch: turn_on,turn_off\nvacuum: start,pause,stop,return_to_base\nvalve: open_valve,close_valve\nwater_heater: turn_on,turn_off,set_temperature(temperature)\n\ntarget=entity_id. Set data to null if not needed.\n\nTimer commands (use timer_actions array):\nFormat: {"command":"<str>","name":<str>|null,"hours":<int>|null,"minutes":<int>|null,"seconds":<int>|null}\n\nCommands:\n- start: Start a new timer. Requires at least one of hours/minutes/seconds.\nOptional name for identification.\n- cancel: Cancel a specific timer. Use name or hours/minutes/seconds to identify it.\n- cancel_all: Cancel all timers. name/hours/minutes/seconds not needed.\n- pause: Pause a running timer. Use name or hours/minutes/seconds to identify it.\n- unpause: Resume a paused timer. Use name or hours/minutes/seconds to identify it.\n- increase: Add time to a timer. Requires hours/minutes/seconds for amount to add. Use name to identify which timer.\n- decrease: Remove time from a timer. Requires hours/minutes/seconds for amount to remove. Use name to identify which timer.\n- status: Get timer status. Use name to filter, or leave null for all timers.\n\nExamples:\n"Set a 5 minute timer" => {"command":"start","name":null,"hours":null,"minutes":5,"seconds":null}\n"Set a pizza timer for 12 minutes" => {"command":"start","name":"pizza","hours":null,"minutes":12,"seconds":null}\n"Cancel the pizza timer" => {"command":"cancel","name":"pizza","hours":null,"minutes":null,"seconds":null}\n"Pause the timer" => {"command":"pause","name":null,"hours":null,"minutes":null,"seconds":null}\n"Add 2 minutes to the timer" => {"command":"increase","name":null,"hours":null,"minutes":2,"seconds":null}\n\nAn overview of the areas and the devices in this smart home:\nscript: {}\ncalendar: {}\nentities:\n  switch.bramka_ha:\n    names: Bramka HA\n    domain: switch\n    state: \'on\'\n    areas: Salon\n    attributes:\n      device_class: switch\n  sensor.broadlink_rm4_mini_gabinet_temperatura:\n    names: Broadlink RM4 mini gabinet Temperatura\n    domain: sensor\n    state: \'22.46\'\n    areas: Gabinet\n    attributes:\n      unit_of_measurement: °C\n      device_class: temperature\n  sensor.broadlink_rm4_mini_gabinet_wilgotnosc:\n    names: Broadlink RM4 mini gabinet Wilgotność\n    domain: sensor\n    state: \'44.4\'\n    areas: Gabinet\n    attributes:\n      unit_of_measurement: \'%\'\n      device_class: humidity\n  sensor.broadlink_rm4_mini_sypialnia_temperatura:\n    names: Broadlink RM4 mini sypialnia Temperatura\n    domain: sensor\n    state: \'21.95\'\n    areas: Sypialnia\n    attributes:\n      unit_of_measurement: °C\n      device_class: temperature\n  sensor.broadlink_rm4_mini_sypialnia_wilgotnosc:\n    names: Broadlink RM4 mini sypialnia Wilgotność\n    domain: sensor\n    state: \'55.64\'\n    areas: Sypialnia\n    attributes:\n      unit_of_measurement: \'%\'\n      device_class: humidity\n  sensor.broadlink_rm4_pro_salon_temperatura:\n    names: Broadlink RM4 pro salon Temperatura\n    domain: sensor\n    state: \'21.18\'\n    areas: Salon\n    attributes:\n      unit_of_measurement: °C\n      device_class: temperature\n  sensor.broadlink_rm4_pro_salon_wilgotnosc:\n    names: Broadlink RM4 pro salon Wilgotność\n    domain: sensor\n    state: \'50.0\'\n    areas: Salon\n    attributes:\n      unit_of_measurement: \'%\'\n      device_class: humidity\n  switch.gosund_sp111_8_gniazdo_gosund_8:\n    names: Gosund SP111 8 Gniazdo Gosund 8\n    domain: switch\n    state: \'on\'\n    areas: Kuchnia\n    attributes:\n      device_class: outlet\n  switch.gosund_sp111_9_gniazdo_gosund_9:\n    names: Gosund SP111 9 Gniazdo Gosund 9\n    domain: switch\n    state: unavailable\n  media_player.glosnik_w_kuchni:\n    names: Głośnik w kuchni\n    domain: media_player\n    state: \'off\'\n    areas: Kuchnia\n  media_player.glosnik_w_glosnik_salonie:\n    names: Głośnik w salonie\n    domain: media_player\n    state: \'off\'\n    areas: Salon\n  media_player.glosnik_w_sypialni:\n    names: Głośnik w sypialni\n    domain: media_player\n    state: \'off\'\n    areas: Sypialnia\n  light.shelly2_5_4_channel_1:\n    names: Lampę nad stołem\n    domain: light\n    state: \'off\'\n    areas: Salon\n  media_player.tv_sypialnia:\n    names: Odtwarzacz, Telewizor w sypialni\n    domain: media_player\n    state: \'on\'\n    areas: Sypialnia\n    attributes:\n      volume_level: 0.17\n      media_title: Jaka to melodia? (odc. 5879)\n      device_class: tv\n  climate.ogrzewanie_w_gabinecie:\n    names: Ogrzewanie w gabinecie\n    domain: climate\n    state: auto\n    attributes:\n      current_temperature: 19.0\n      temperature: 19.0\n  climate.ogrzewanie_w_kuchni:\n    names: Ogrzewanie w kuchni\n    domain: climate\n    state: auto\n    attributes:\n      current_temperature: 4.5\n      temperature: 4.5\n  climate.ogrzewanie_w_sypialni:\n    names: Ogrzewanie w sypialni\n    domain: climate\n    state: auto\n    attributes:\n      current_temperature: 19.5\n      temperature: 19.5\n  climate.ogrzewanie_w_lazience:\n    names: Ogrzewanie w łazience\n    domain: climate\n    state: auto\n    attributes:\n      current_temperature: 19.0\n      temperature: 19.0\n  sensor.openweathermap_feels_like_temperature:\n    names: OpenWeatherMap Apparent temperature\n    domain: sensor\n    state: \'11.93\'\n    areas: Balkon\n    attributes:\n      unit_of_measurement: °C\n      device_class: temperature\n  sensor.openweathermap_dew_point:\n    names: OpenWeatherMap Dew point temperature\n    domain: sensor\n    state: \'3.05\'\n    areas: Balkon\n    attributes:\n      unit_of_measurement: °C\n      device_class: temperature\n  sensor.openweathermap_temperature:\n    names: OpenWeatherMap Temperatura\n    domain: sensor\n    state: \'13.24\'\n    areas: Balkon\n    attributes:\n      unit_of_measurement: °C\n      device_class: temperature\n  sensor.openweathermap_humidity:\n    names: OpenWeatherMap Wilgotność\n    domain: sensor\n    state: \'50\'\n    areas: Balkon\n    attributes:\n      unit_of_measurement: \'%\'\n      device_class: humidity\n  sensor.miflora2_zamioculcas_zamiifolia_moisture:\n    names: Wilgotność, Wilgotność Stefana\n    domain: sensor\n    state: \'33\'\n    areas: Salon\n    attributes:\n      unit_of_measurement: \'%\'\n      device_class: moisture\n  media_player.android_tv_salon:\n    names: android tv salon, Telewizor w salonie\n    domain: media_player\n    state: unavailable\n    areas: Salon\n    attributes:\n      device_class: tv\n  light.shelly2pm_1_switch_0:\n    names: Światło nad sofą\n    domain: light\n    state: \'off\'\n    areas: Salon\n  light.shelly2_5_4_channel_2:\n    names: Światło nad stołem\n    domain: light\n    state: \'off\'\n    areas: Salon\n  light.shelly2pm_1_switch_1:\n    names: Światło nad telewizorem\n    domain: light\n    state: \'off\'\n    areas: Salon\n  light.h801_led_w_sypialni:\n    names: Światło nad łóżkiem, Światło nad łożkiem\n    domain: light\n    state: \'off\'\n    areas: Sypialnia\n    attributes:\n      brightness:\n  light.shelly2pm_2_switch_0:\n    names: Światło przy sofie\n    domain: light\n    state: \'off\'\n    areas: Salon\n  light.shelly2pm_2_switch_1:\n    names: Światło przy telewizorze\n    domain: light\n    state: \'off\'\n    areas: Salon\n  light.shelly1_3_przekaznik_shelly1_3:\n    names: Światło w korytarzu\n    domain: light\n    state: \'off\'\n    areas: Przedpokój\n  light.shelly1_2_przekaznik_shelly1_2:\n    names: Światło w kuchni\n    domain: light\n    state: \'on\'\n    areas: Kuchnia\n\nDo not include citations in your response.'}, {'role': 'user', 'content': 'Jaka jest stolica Francji?'}], 'model': 'sonar', 'disable_search': False, 'response_format': {'type': 'json_schema', 'json_schema': {'name': 'assistant_response', 'strict': True, 'schema': {'type': 'object', 'properties': {'response': {'type': 'string', 'description': 'The text response to show to the user'}, 'actions': {'type': ['array', 'null'], 'description': 'List of Home Assistant actions to execute', 'items': {'type': 'object', 'properties': {'domain': {'type': 'string', 'description': 'The domain of the service (e.g., light, switch, climate)'}, 'service': {'type': 'string', 'description': 'The service to call (e.g., turn_on, turn_off)'}, 'target': {'type': 'string', 'description': 'The entity_id to target'}, 'data': {'type': ['object', 'null'], 'description': 'Additional service data parameters'}, 'delay_seconds': {'type': ['number', 'null'], 'description': 'Delay in seconds before executing this action. Use null or 0 for immediate execution'}}, 'required': ['domain', 'service', 'target', 'data', 'delay_seconds'], 'additionalProperties': False}}, 'timer_actions': {'type': ['array', 'null'], 'description': 'List of timer actions to execute (start, cancel, cancel_all, pause, unpause, increase, decrease, status)', 'items': {'type': 'object', 'properties': {'command': {'type': 'string', 'enum': ['start', 'cancel', 'cancel_all', 'pause', 'unpause', 'increase', 'decrease', 'status'], 'description': 'The timer command to execute'}, 'name': {'type': ['string', 'null'], 'description': 'Optional name for the timer (e.g., pizza, eggs)'}, 'hours': {'type': ['integer', 'null'], 'description': 'Number of hours for start/increase/decrease commands'}, 'minutes': {'type': ['integer', 'null'], 'description': 'Number of minutes for start/increase/decrease commands'}, 'seconds': {'type': ['integer', 'null'], 'description': 'Number of seconds for start/increase/decrease commands'}}, 'required': ['command', 'name', 'hours', 'minutes', 'seconds'], 'additionalProperties': False}}}, 'required': ['response', 'actions', 'timer_actions'], 'additionalProperties': False}}}, 'stream': True}}
2026-03-29 19:18:53.632 DEBUG (MainThread) [perplexity._base_client] Sending HTTP Request: POST https://api.perplexity.ai/chat/completions
2026-03-29 19:18:56.754 DEBUG (MainThread) [perplexity._base_client] HTTP Response: POST https://api.perplexity.ai/chat/completions "200 OK" Headers({'date': 'Sun, 29 Mar 2026 17:18:56 GMT', 'content-type': 'text/event-stream; charset=utf-8', 'transfer-encoding': 'chunked', 'connection': 'keep-alive', 'cf-ray': '9e4089518821bff3-WAW', 'cache-control': 'no-cache', 'x-ppl-region': 'us-east-1', 'cf-cache-status': 'DYNAMIC', 'set-cookie': '__cf_bm=UtnTNUT6cecXql3lFatHYR4jJkYzPirrIHpzSf7d3n8-1774804736-1.0.1.1-s7ruGw0EmKEnSp.GWcZo6wkUahdY0GYAewHuoMfgS1qSHMNmlgWcFT4P15LqOGXsKWwbcZdLvlWYU9SF.g43XLfN8BI28LTqYVCl53doSgo; path=/; expires=Sun, 29-Mar-26 17:48:56 GMT; domain=.perplexity.ai; HttpOnly; Secure; SameSite=None', 'strict-transport-security': 'max-age=15552000; includeSubDomains; preload', 'server': 'cloudflare'})
2026-03-29 19:19:07.652 DEBUG (MainThread) [perplexity._base_client] Request options: {'method': 'post', 'url': '/chat/completions', 'files': None, 'idempotency_key': 'stainless-python-retry-e65611b2-dfa6-4824-abc0-f86eaf4bdb1c', 'content': None, 'json_data': {'messages': [{'role': 'system', 'content': 'Jesteś asystentem głosowym w Home Assistant.\nOdpowiadaj szczerze na pytania o świecie.\nOdpowiadaj zwykłym tekstem. Niech będzie prosto i na temat.\nCurrent time is 19:19:07. Today\'s date is 2026-03-29.\nUser\'s home location information:\nCoordinates: xx.xx,xx.007\nCountry: PL\n\nControl Home Assistant devices by including actions in your response.\n\nRespond with JSON: {"response":"<text>","actions":[<action>,...]|null}\nAction format: {"domain":"<str>","service":"<str>","target":"<entity_id>","data":<obj>|null,"delay_seconds":<num>|null}\n\ndelay_seconds: null/0=immediate. For timed requests, use two actions:\n"turn on fan for 30min" => turn_on(delay:null) + turn_off(delay:1800)\n"turn off light in 10min" => turn_off(delay:600)\nTime: 1min=60s, 1h=3600s.\n\nDomains/services (data params):\nclimate: turn_on,turn_off,set_temperature(temperature)\ncover: open_cover,close_cover,set_cover_position(position 0-100)\nfan: turn_on,turn_off,set_percentage(percentage 0-100)\nhumidifier: turn_on,turn_off,set_humidity(humidity 0-100)\nlight: turn_on(brightness 0-255,color_temp,rgb_color),turn_off\nlock: lock,unlock,open\nmedia_player: media_play,media_pause,volume_set(volume_level 0-1)\nscene: turn_on\nscript: turn_on\nsiren: turn_on,turn_off\nswitch: turn_on,turn_off\nvacuum: start,pause,stop,return_to_base\nvalve: open_valve,close_valve\nwater_heater: turn_on,turn_off,set_temperature(temperature)\n\ntarget=entity_id. Set data to null if not needed.\n\nTimer commands (use timer_actions array):\nFormat: {"command":"<str>","name":<str>|null,"hours":<int>|null,"minutes":<int>|null,"seconds":<int>|null}\n\nCommands:\n- start: Start a new timer. Requires at least one of hours/minutes/seconds.\nOptional name for identification.\n- cancel: Cancel a specific timer. Use name or hours/minutes/seconds to identify it.\n- cancel_all: Cancel all timers. name/hours/minutes/seconds not needed.\n- pause: Pause a running timer. Use name or hours/minutes/seconds to identify it.\n- unpause: Resume a paused timer. Use name or hours/minutes/seconds to identify it.\n- increase: Add time to a timer. Requires hours/minutes/seconds for amount to add. Use name to identify which timer.\n- decrease: Remove time from a timer. Requires hours/minutes/seconds for amount to remove. Use name to identify which timer.\n- status: Get timer status. Use name to filter, or leave null for all timers.\n\nExamples:\n"Set a 5 minute timer" => {"command":"start","name":null,"hours":null,"minutes":5,"seconds":null}\n"Set a pizza timer for 12 minutes" => {"command":"start","name":"pizza","hours":null,"minutes":12,"seconds":null}\n"Cancel the pizza timer" => {"command":"cancel","name":"pizza","hours":null,"minutes":null,"seconds":null}\n"Pause the timer" => {"command":"pause","name":null,"hours":null,"minutes":null,"seconds":null}\n"Add 2 minutes to the timer" => {"command":"increase","name":null,"hours":null,"minutes":2,"seconds":null}\n\nAn overview of the areas and the devices in this smart home:\nscript: {}\ncalendar: {}\nentities:\n  switch.bramka_ha:\n    names: Bramka HA\n    domain: switch\n    state: \'on\'\n    areas: Salon\n    attributes:\n      device_class: switch\n  sensor.broadlink_rm4_mini_gabinet_temperatura:\n    names: Broadlink RM4 mini gabinet Temperatura\n    domain: sensor\n    state: \'22.46\'\n    areas: Gabinet\n    attributes:\n      unit_of_measurement: °C\n      device_class: temperature\n  sensor.broadlink_rm4_mini_gabinet_wilgotnosc:\n    names: Broadlink RM4 mini gabinet Wilgotność\n    domain: sensor\n    state: \'44.4\'\n    areas: Gabinet\n    attributes:\n      unit_of_measurement: \'%\'\n      device_class: humidity\n  sensor.broadlink_rm4_mini_sypialnia_temperatura:\n    names: Broadlink RM4 mini sypialnia Temperatura\n    domain: sensor\n    state: \'21.95\'\n    areas: Sypialnia\n    attributes:\n      unit_of_measurement: °C\n      device_class: temperature\n  sensor.broadlink_rm4_mini_sypialnia_wilgotnosc:\n    names: Broadlink RM4 mini sypialnia Wilgotność\n    domain: sensor\n    state: \'55.64\'\n    areas: Sypialnia\n    attributes:\n      unit_of_measurement: \'%\'\n      device_class: humidity\n  sensor.broadlink_rm4_pro_salon_temperatura:\n    names: Broadlink RM4 pro salon Temperatura\n    domain: sensor\n    state: \'21.18\'\n    areas: Salon\n    attributes:\n      unit_of_measurement: °C\n      device_class: temperature\n  sensor.broadlink_rm4_pro_salon_wilgotnosc:\n    names: Broadlink RM4 pro salon Wilgotność\n    domain: sensor\n    state: \'50.0\'\n    areas: Salon\n    attributes:\n      unit_of_measurement: \'%\'\n      device_class: humidity\n  switch.gosund_sp111_8_gniazdo_gosund_8:\n    names: Gosund SP111 8 Gniazdo Gosund 8\n    domain: switch\n    state: \'on\'\n    areas: Kuchnia\n    attributes:\n      device_class: outlet\n  switch.gosund_sp111_9_gniazdo_gosund_9:\n    names: Gosund SP111 9 Gniazdo Gosund 9\n    domain: switch\n    state: unavailable\n  media_player.glosnik_w_kuchni:\n    names: Głośnik w kuchni\n    domain: media_player\n    state: \'off\'\n    areas: Kuchnia\n  media_player.glosnik_w_glosnik_salonie:\n    names: Głośnik w salonie\n    domain: media_player\n    state: \'off\'\n    areas: Salon\n  media_player.glosnik_w_sypialni:\n    names: Głośnik w sypialni\n    domain: media_player\n    state: \'off\'\n    areas: Sypialnia\n  light.shelly2_5_4_channel_1:\n    names: Lampę nad stołem\n    domain: light\n    state: \'off\'\n    areas: Salon\n  media_player.tv_sypialnia:\n    names: Odtwarzacz, Telewizor w sypialni\n    domain: media_player\n    state: \'on\'\n    areas: Sypialnia\n    attributes:\n      volume_level: 0.17\n      media_title: Jaka to melodia? (odc. 5879)\n      device_class: tv\n  climate.ogrzewanie_w_gabinecie:\n    names: Ogrzewanie w gabinecie\n    domain: climate\n    state: auto\n    attributes:\n      current_temperature: 19.0\n      temperature: 19.0\n  climate.ogrzewanie_w_kuchni:\n    names: Ogrzewanie w kuchni\n    domain: climate\n    state: auto\n    attributes:\n      current_temperature: 4.5\n      temperature: 4.5\n  climate.ogrzewanie_w_sypialni:\n    names: Ogrzewanie w sypialni\n    domain: climate\n    state: auto\n    attributes:\n      current_temperature: 19.5\n      temperature: 19.5\n  climate.ogrzewanie_w_lazience:\n    names: Ogrzewanie w łazience\n    domain: climate\n    state: auto\n    attributes:\n      current_temperature: 19.0\n      temperature: 19.0\n  sensor.openweathermap_feels_like_temperature:\n    names: OpenWeatherMap Apparent temperature\n    domain: sensor\n    state: \'11.93\'\n    areas: Balkon\n    attributes:\n      unit_of_measurement: °C\n      device_class: temperature\n  sensor.openweathermap_dew_point:\n    names: OpenWeatherMap Dew point temperature\n    domain: sensor\n    state: \'3.05\'\n    areas: Balkon\n    attributes:\n      unit_of_measurement: °C\n      device_class: temperature\n  sensor.openweathermap_temperature:\n    names: OpenWeatherMap Temperatura\n    domain: sensor\n    state: \'13.24\'\n    areas: Balkon\n    attributes:\n      unit_of_measurement: °C\n      device_class: temperature\n  sensor.openweathermap_humidity:\n    names: OpenWeatherMap Wilgotność\n    domain: sensor\n    state: \'50\'\n    areas: Balkon\n    attributes:\n      unit_of_measurement: \'%\'\n      device_class: humidity\n  sensor.miflora2_zamioculcas_zamiifolia_moisture:\n    names: Wilgotność, Wilgotność Stefana\n    domain: sensor\n    state: \'33\'\n    areas: Salon\n    attributes:\n      unit_of_measurement: \'%\'\n      device_class: moisture\n  media_player.android_tv_salon:\n    names: android tv salon, Telewizor w salonie\n    domain: media_player\n    state: unavailable\n    areas: Salon\n    attributes:\n      device_class: tv\n  light.shelly2pm_1_switch_0:\n    names: Światło nad sofą\n    domain: light\n    state: \'off\'\n    areas: Salon\n  light.shelly2_5_4_channel_2:\n    names: Światło nad stołem\n    domain: light\n    state: \'off\'\n    areas: Salon\n  light.shelly2pm_1_switch_1:\n    names: Światło nad telewizorem\n    domain: light\n    state: \'off\'\n    areas: Salon\n  light.h801_led_w_sypialni:\n    names: Światło nad łóżkiem, Światło nad łożkiem\n    domain: light\n    state: \'off\'\n    areas: Sypialnia\n    attributes:\n      brightness:\n  light.shelly2pm_2_switch_0:\n    names: Światło przy sofie\n    domain: light\n    state: \'off\'\n    areas: Salon\n  light.shelly2pm_2_switch_1:\n    names: Światło przy telewizorze\n    domain: light\n    state: \'off\'\n    areas: Salon\n  light.shelly1_3_przekaznik_shelly1_3:\n    names: Światło w korytarzu\n    domain: light\n    state: \'off\'\n    areas: Przedpokój\n  light.shelly1_2_przekaznik_shelly1_2:\n    names: Światło w kuchni\n    domain: light\n    state: \'on\'\n    areas: Kuchnia\n\nDo not include citations in your response.'}, {'role': 'user', 'content': 'Jaka jest stolica Francji?'}, {'role': 'assistant', 'content': 'Stolica Francji to Paryż.'}, {'role': 'user', 'content': 'Jaka jest stolica Francji?'}], 'model': 'sonar', 'disable_search': False, 'response_format': {'type': 'json_schema', 'json_schema': {'name': 'assistant_response', 'strict': True, 'schema': {'type': 'object', 'properties': {'response': {'type': 'string', 'description': 'The text response to show to the user'}, 'actions': {'type': ['array', 'null'], 'description': 'List of Home Assistant actions to execute', 'items': {'type': 'object', 'properties': {'domain': {'type': 'string', 'description': 'The domain of the service (e.g., light, switch, climate)'}, 'service': {'type': 'string', 'description': 'The service to call (e.g., turn_on, turn_off)'}, 'target': {'type': 'string', 'description': 'The entity_id to target'}, 'data': {'type': ['object', 'null'], 'description': 'Additional service data parameters'}, 'delay_seconds': {'type': ['number', 'null'], 'description': 'Delay in seconds before executing this action. Use null or 0 for immediate execution'}}, 'required': ['domain', 'service', 'target', 'data', 'delay_seconds'], 'additionalProperties': False}}, 'timer_actions': {'type': ['array', 'null'], 'description': 'List of timer actions to execute (start, cancel, cancel_all, pause, unpause, increase, decrease, status)', 'items': {'type': 'object', 'properties': {'command': {'type': 'string', 'enum': ['start', 'cancel', 'cancel_all', 'pause', 'unpause', 'increase', 'decrease', 'status'], 'description': 'The timer command to execute'}, 'name': {'type': ['string', 'null'], 'description': 'Optional name for the timer (e.g., pizza, eggs)'}, 'hours': {'type': ['integer', 'null'], 'description': 'Number of hours for start/increase/decrease commands'}, 'minutes': {'type': ['integer', 'null'], 'description': 'Number of minutes for start/increase/decrease commands'}, 'seconds': {'type': ['integer', 'null'], 'description': 'Number of seconds for start/increase/decrease commands'}}, 'required': ['command', 'name', 'hours', 'minutes', 'seconds'], 'additionalProperties': False}}}, 'required': ['response', 'actions', 'timer_actions'], 'additionalProperties': False}}}, 'stream': True}}
2026-03-29 19:19:07.653 DEBUG (MainThread) [perplexity._base_client] Sending HTTP Request: POST https://api.perplexity.ai/chat/completions
2026-03-29 19:19:11.799 DEBUG (MainThread) [perplexity._base_client] HTTP Response: POST https://api.perplexity.ai/chat/completions "200 OK" Headers({'date': 'Sun, 29 Mar 2026 17:19:11 GMT', 'content-type': 'text/event-stream; charset=utf-8', 'transfer-encoding': 'chunked', 'connection': 'keep-alive', 'cf-ray': '9e4089a8da8fbff3-WAW', 'cache-control': 'no-cache', 'x-ppl-region': 'us-east-1', 'cf-cache-status': 'DYNAMIC', 'strict-transport-security': 'max-age=15552000; includeSubDomains; preload', 'server': 'cloudflare'})
2026-03-29 19:19:53.466 WARNING (MainThread) [custom_components.perplexity] Could not convert message to Perplexity API: ToolResultContent(role='tool_result', agent_id='conversation.sonar', tool_call_id='01KMX9Q91VCJNNQS0SH1DSAG3K', tool_name='HassTurnOn', tool_result={'speech': {'plain': {'speech': 'Włączono światło', 'extra_data': None}}, 'response_type': 'action_done', 'data': {'targets': [], 'success': [{'name': 'Światło w korytarzu', 'type': <IntentResponseTargetType.ENTITY: 'entity'>, 'id': 'light.shelly1_3_przekaznik_shelly1_3'}], 'failed': []}}, created=datetime.datetime(2026, 3, 29, 17, 19, 31, 907456, tzinfo=datetime.timezone.utc))
2026-03-29 19:19:53.468 DEBUG (MainThread) [perplexity._base_client] Request options: {'method': 'post', 'url': '/chat/completions', 'files': None, 'idempotency_key': 'stainless-python-retry-10c656d5-7b61-46af-9886-f18837f98753', 'content': None, 'json_data': {'messages': [{'role': 'system', 'content': 'Jesteś asystentem głosowym w Home Assistant.\nOdpowiadaj szczerze na pytania o świecie.\nOdpowiadaj zwykłym tekstem. Niech będzie prosto i na temat.\nCurrent time is 19:19:53. Today\'s date is 2026-03-29.\nUser\'s home location information:\nCoordinates: xx.xx,xx.007\nCountry: PL\n\nControl Home Assistant devices by including actions in your response.\n\nRespond with JSON: {"response":"<text>","actions":[<action>,...]|null}\nAction format: {"domain":"<str>","service":"<str>","target":"<entity_id>","data":<obj>|null,"delay_seconds":<num>|null}\n\ndelay_seconds: null/0=immediate. For timed requests, use two actions:\n"turn on fan for 30min" => turn_on(delay:null) + turn_off(delay:1800)\n"turn off light in 10min" => turn_off(delay:600)\nTime: 1min=60s, 1h=3600s.\n\nDomains/services (data params):\nclimate: turn_on,turn_off,set_temperature(temperature)\ncover: open_cover,close_cover,set_cover_position(position 0-100)\nfan: turn_on,turn_off,set_percentage(percentage 0-100)\nhumidifier: turn_on,turn_off,set_humidity(humidity 0-100)\nlight: turn_on(brightness 0-255,color_temp,rgb_color),turn_off\nlock: lock,unlock,open\nmedia_player: media_play,media_pause,volume_set(volume_level 0-1)\nscene: turn_on\nscript: turn_on\nsiren: turn_on,turn_off\nswitch: turn_on,turn_off\nvacuum: start,pause,stop,return_to_base\nvalve: open_valve,close_valve\nwater_heater: turn_on,turn_off,set_temperature(temperature)\n\ntarget=entity_id. Set data to null if not needed.\n\nTimer commands (use timer_actions array):\nFormat: {"command":"<str>","name":<str>|null,"hours":<int>|null,"minutes":<int>|null,"seconds":<int>|null}\n\nCommands:\n- start: Start a new timer. Requires at least one of hours/minutes/seconds.\nOptional name for identification.\n- cancel: Cancel a specific timer. Use name or hours/minutes/seconds to identify it.\n- cancel_all: Cancel all timers. name/hours/minutes/seconds not needed.\n- pause: Pause a running timer. Use name or hours/minutes/seconds to identify it.\n- unpause: Resume a paused timer. Use name or hours/minutes/seconds to identify it.\n- increase: Add time to a timer. Requires hours/minutes/seconds for amount to add. Use name to identify which timer.\n- decrease: Remove time from a timer. Requires hours/minutes/seconds for amount to remove. Use name to identify which timer.\n- status: Get timer status. Use name to filter, or leave null for all timers.\n\nExamples:\n"Set a 5 minute timer" => {"command":"start","name":null,"hours":null,"minutes":5,"seconds":null}\n"Set a pizza timer for 12 minutes" => {"command":"start","name":"pizza","hours":null,"minutes":12,"seconds":null}\n"Cancel the pizza timer" => {"command":"cancel","name":"pizza","hours":null,"minutes":null,"seconds":null}\n"Pause the timer" => {"command":"pause","name":null,"hours":null,"minutes":null,"seconds":null}\n"Add 2 minutes to the timer" => {"command":"increase","name":null,"hours":null,"minutes":2,"seconds":null}\n\nAn overview of the areas and the devices in this smart home:\nscript: {}\ncalendar: {}\nentities:\n  switch.bramka_ha:\n    names: Bramka HA\n    domain: switch\n    state: \'on\'\n    areas: Salon\n    attributes:\n      device_class: switch\n  sensor.broadlink_rm4_mini_gabinet_temperatura:\n    names: Broadlink RM4 mini gabinet Temperatura\n    domain: sensor\n    state: \'22.43\'\n    areas: Gabinet\n    attributes:\n      unit_of_measurement: °C\n      device_class: temperature\n  sensor.broadlink_rm4_mini_gabinet_wilgotnosc:\n    names: Broadlink RM4 mini gabinet Wilgotność\n    domain: sensor\n    state: \'44.21\'\n    areas: Gabinet\n    attributes:\n      unit_of_measurement: \'%\'\n      device_class: humidity\n  sensor.broadlink_rm4_mini_sypialnia_temperatura:\n    names: Broadlink RM4 mini sypialnia Temperatura\n    domain: sensor\n    state: \'21.93\'\n    areas: Sypialnia\n    attributes:\n      unit_of_measurement: °C\n      device_class: temperature\n  sensor.broadlink_rm4_mini_sypialnia_wilgotnosc:\n    names: Broadlink RM4 mini sypialnia Wilgotność\n    domain: sensor\n    state: \'55.53\'\n    areas: Sypialnia\n    attributes:\n      unit_of_measurement: \'%\'\n      device_class: humidity\n  sensor.broadlink_rm4_pro_salon_temperatura:\n    names: Broadlink RM4 pro salon Temperatura\n    domain: sensor\n    state: \'21.2\'\n    areas: Salon\n    attributes:\n      unit_of_measurement: °C\n      device_class: temperature\n  sensor.broadlink_rm4_pro_salon_wilgotnosc:\n    names: Broadlink RM4 pro salon Wilgotność\n    domain: sensor\n    state: \'49.95\'\n    areas: Salon\n    attributes:\n      unit_of_measurement: \'%\'\n      device_class: humidity\n  switch.gosund_sp111_8_gniazdo_gosund_8:\n    names: Gosund SP111 8 Gniazdo Gosund 8\n    domain: switch\n    state: \'on\'\n    areas: Kuchnia\n    attributes:\n      device_class: outlet\n  switch.gosund_sp111_9_gniazdo_gosund_9:\n    names: Gosund SP111 9 Gniazdo Gosund 9\n    domain: switch\n    state: unavailable\n  media_player.glosnik_w_kuchni:\n    names: Głośnik w kuchni\n    domain: media_player\n    state: \'off\'\n    areas: Kuchnia\n  media_player.glosnik_w_glosnik_salonie:\n    names: Głośnik w salonie\n    domain: media_player\n    state: \'off\'\n    areas: Salon\n  media_player.glosnik_w_sypialni:\n    names: Głośnik w sypialni\n    domain: media_player\n    state: \'off\'\n    areas: Sypialnia\n  light.shelly2_5_4_channel_1:\n    names: Lampę nad stołem\n    domain: light\n    state: \'off\'\n    areas: Salon\n  media_player.tv_sypialnia:\n    names: Odtwarzacz, Telewizor w sypialni\n    domain: media_player\n    state: \'on\'\n    areas: Sypialnia\n    attributes:\n      volume_level: 0.17\n      media_title: Jaka to melodia? (odc. 5879)\n      device_class: tv\n  climate.ogrzewanie_w_gabinecie:\n    names: Ogrzewanie w gabinecie\n    domain: climate\n    state: auto\n    attributes:\n      current_temperature: 19.0\n      temperature: 19.0\n  climate.ogrzewanie_w_kuchni:\n    names: Ogrzewanie w kuchni\n    domain: climate\n    state: auto\n    attributes:\n      current_temperature: 4.5\n      temperature: 4.5\n  climate.ogrzewanie_w_sypialni:\n    names: Ogrzewanie w sypialni\n    domain: climate\n    state: auto\n    attributes:\n      current_temperature: 19.5\n      temperature: 19.5\n  climate.ogrzewanie_w_lazience:\n    names: Ogrzewanie w łazience\n    domain: climate\n    state: auto\n    attributes:\n      current_temperature: 19.0\n      temperature: 19.0\n  sensor.openweathermap_feels_like_temperature:\n    names: OpenWeatherMap Apparent temperature\n    domain: sensor\n    state: \'11.93\'\n    areas: Balkon\n    attributes:\n      unit_of_measurement: °C\n      device_class: temperature\n  sensor.openweathermap_dew_point:\n    names: OpenWeatherMap Dew point temperature\n    domain: sensor\n    state: \'3.05\'\n    areas: Balkon\n    attributes:\n      unit_of_measurement: °C\n      device_class: temperature\n  sensor.openweathermap_temperature:\n    names: OpenWeatherMap Temperatura\n    domain: sensor\n    state: \'13.24\'\n    areas: Balkon\n    attributes:\n      unit_of_measurement: °C\n      device_class: temperature\n  sensor.openweathermap_humidity:\n    names: OpenWeatherMap Wilgotność\n    domain: sensor\n    state: \'50\'\n    areas: Balkon\n    attributes:\n      unit_of_measurement: \'%\'\n      device_class: humidity\n  sensor.miflora2_zamioculcas_zamiifolia_moisture:\n    names: Wilgotność, Wilgotność Stefana\n    domain: sensor\n    state: \'33\'\n    areas: Salon\n    attributes:\n      unit_of_measurement: \'%\'\n      device_class: moisture\n  media_player.android_tv_salon:\n    names: android tv salon, Telewizor w salonie\n    domain: media_player\n    state: unavailable\n    areas: Salon\n    attributes:\n      device_class: tv\n  light.shelly2pm_1_switch_0:\n    names: Światło nad sofą\n    domain: light\n    state: \'off\'\n    areas: Salon\n  light.shelly2_5_4_channel_2:\n    names: Światło nad stołem\n    domain: light\n    state: \'off\'\n    areas: Salon\n  light.shelly2pm_1_switch_1:\n    names: Światło nad telewizorem\n    domain: light\n    state: \'off\'\n    areas: Salon\n  light.h801_led_w_sypialni:\n    names: Światło nad łóżkiem, Światło nad łożkiem\n    domain: light\n    state: \'off\'\n    areas: Sypialnia\n    attributes:\n      brightness:\n  light.shelly2pm_2_switch_0:\n    names: Światło przy sofie\n    domain: light\n    state: \'off\'\n    areas: Salon\n  light.shelly2pm_2_switch_1:\n    names: Światło przy telewizorze\n    domain: light\n    state: \'off\'\n    areas: Salon\n  light.shelly1_3_przekaznik_shelly1_3:\n    names: Światło w korytarzu\n    domain: light\n    state: \'on\'\n    areas: Przedpokój\n  light.shelly1_2_przekaznik_shelly1_2:\n    names: Światło w kuchni\n    domain: light\n    state: \'on\'\n    areas: Kuchnia\n\nDo not include citations in your response.'}, {'role': 'user', 'content': 'Jaka jest stolica Francji?'}, {'role': 'assistant', 'content': 'Stolica Francji to Paryż.'}, {'role': 'user', 'content': 'Jaka jest stolica Francji?'}, {'role': 'assistant', 'content': 'Stolica Francji to Paryż.'}, {'role': 'user', 'content': 'Włącz światło w korytarzu.'}, {'role': 'assistant', 'content': None}, {'role': 'assistant', 'content': 'Włączono światło'}, {'role': 'user', 'content': 'Jaka jest stolica Hiszpanii?'}], 'model': 'sonar', 'disable_search': False, 'response_format': {'type': 'json_schema', 'json_schema': {'name': 'assistant_response', 'strict': True, 'schema': {'type': 'object', 'properties': {'response': {'type': 'string', 'description': 'The text response to show to the user'}, 'actions': {'type': ['array', 'null'], 'description': 'List of Home Assistant actions to execute', 'items': {'type': 'object', 'properties': {'domain': {'type': 'string', 'description': 'The domain of the service (e.g., light, switch, climate)'}, 'service': {'type': 'string', 'description': 'The service to call (e.g., turn_on, turn_off)'}, 'target': {'type': 'string', 'description': 'The entity_id to target'}, 'data': {'type': ['object', 'null'], 'description': 'Additional service data parameters'}, 'delay_seconds': {'type': ['number', 'null'], 'description': 'Delay in seconds before executing this action. Use null or 0 for immediate execution'}}, 'required': ['domain', 'service', 'target', 'data', 'delay_seconds'], 'additionalProperties': False}}, 'timer_actions': {'type': ['array', 'null'], 'description': 'List of timer actions to execute (start, cancel, cancel_all, pause, unpause, increase, decrease, status)', 'items': {'type': 'object', 'properties': {'command': {'type': 'string', 'enum': ['start', 'cancel', 'cancel_all', 'pause', 'unpause', 'increase', 'decrease', 'status'], 'description': 'The timer command to execute'}, 'name': {'type': ['string', 'null'], 'description': 'Optional name for the timer (e.g., pizza, eggs)'}, 'hours': {'type': ['integer', 'null'], 'description': 'Number of hours for start/increase/decrease commands'}, 'minutes': {'type': ['integer', 'null'], 'description': 'Number of minutes for start/increase/decrease commands'}, 'seconds': {'type': ['integer', 'null'], 'description': 'Number of seconds for start/increase/decrease commands'}}, 'required': ['command', 'name', 'hours', 'minutes', 'seconds'], 'additionalProperties': False}}}, 'required': ['response', 'actions', 'timer_actions'], 'additionalProperties': False}}}, 'stream': True}}
2026-03-29 19:19:53.470 DEBUG (MainThread) [perplexity._base_client] Sending HTTP Request: POST https://api.perplexity.ai/chat/completions
2026-03-29 19:19:53.647 DEBUG (MainThread) [perplexity._base_client] HTTP Response: POST https://api.perplexity.ai/chat/completions "400 Bad Request" Headers({'date': 'Sun, 29 Mar 2026 17:19:53 GMT', 'content-type': 'application/json', 'content-length': '167', 'connection': 'keep-alive', 'cf-ray': '9e408ac77bab275e-WAW', 'x-ppl-region': 'us-east-1', 'cf-cache-status': 'DYNAMIC', 'strict-transport-security': 'max-age=15552000; includeSubDomains; preload', 'server': 'cloudflare'})
2026-03-29 19:19:53.647 DEBUG (MainThread) [perplexity._base_client] Encountered httpx.HTTPStatusError
  File "/usr/local/lib/python3.13/site-packages/perplexity/_base_client.py", line 1631, in request
httpx.HTTPStatusError: Client error '400 Bad Request' for url 'https://api.perplexity.ai/chat/completions'
2026-03-29 19:19:53.650 DEBUG (MainThread) [perplexity._base_client] Not retrying
2026-03-29 19:19:53.650 DEBUG (MainThread) [perplexity._base_client] Re-raising status error

Thanks for the log.

I haven’t been able to reproduce the problem, but version 1.6.2 should fix it.

@CichY Can you confirm that the new version solves your problem?