Rest Sensor no longing loading

Since Core_2022.12.9 my rest sensor doesn’t load any more. I can’t seem to find any info anywhere on this.

here is the yaml

- platform: rest
  name: stefans_env_rest
  unique_id: stefans_foobar
  params:
    sessionkey: "{'key':'a083-8496-e232-c9ec'}"
    sts: "{'temperature':1,'humidity':1, 'ccs811':1}"
  json_attributes:
    - temperature
    - humidity
    - co2
    - tvoc
  resource: http://stefan-47130.local/json
- platform: template
  sensors:
    stefans_temperature:
      friendly_name: " Stefan's Temperature"
      value_template: "{{ state_attr('sensor.stefans_env','temperature')}}"
      unit_of_measurement: "°C"
      unique_id: sstefan_temperature
    stefans_humidity:
      friendly_name: "Stefan's humiditiy"
      value_template: "{{ state_attr('sensor.stefans_env','humidity')}}"
      unit_of_measurement: "%"

and here is the log entry for it

Logger: homeassistant.components.sensor
Source: components/rest/data.py:63
Integration: Sensor (documentation, issues)
First occurred: 07:18:58 (1 occurrences)
Last logged: 07:18:58

Error while setting up rest platform for sensor
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 289, in _async_setup_platform
    await asyncio.shield(task)
  File "/usr/src/homeassistant/homeassistant/components/rest/sensor.py", line 63, in async_setup_platform
    await rest.async_update(log_errors=False)
  File "/usr/src/homeassistant/homeassistant/components/rest/data.py", line 63, in async_update
    response = await self._async_client.request(
  File "/usr/local/lib/python3.10/site-packages/httpx/_client.py", line 1520, in request
    request = self.build_request(
  File "/usr/local/lib/python3.10/site-packages/httpx/_client.py", line 351, in build_request
    params = self._merge_queryparams(params)
  File "/usr/local/lib/python3.10/site-packages/httpx/_client.py", line 428, in _merge_queryparams
    return merged_queryparams.merge(params)
  File "/usr/local/lib/python3.10/site-packages/httpx/_urls.py", line 723, in merge
    q = QueryParams(params)
  File "/usr/local/lib/python3.10/site-packages/httpx/_urls.py", line 585, in __init__
    self._dict = {
  File "/usr/local/lib/python3.10/site-packages/httpx/_urls.py", line 586, in <dictcomp>
    str(k): [primitive_value_to_str(item) for item in v]
  File "/usr/local/lib/python3.10/site-packages/httpx/_urls.py", line 586, in <listcomp>
    str(k): [primitive_value_to_str(item) for item in v]
  File "/usr/local/lib/python3.10/site-packages/httpx/_utils.py", line 72, in primitive_value_to_str
    raise TypeError(
TypeError: Expected str, int, float, bool, or None. Got 'Wrapper'.

as you can see from the log entry it is receiving a wrapper. Nothing has changed on the sensor and I can still access it via it’s API without issue. I have updated since to see if it corrects the issue, am now running core_2023.1.1 any pointers would be greatly appreciated.

Have the same I think, upgraded from 2022.12.8 too 2023.1.6.

  - platform: rest
    name: CeBios now playing
    authentication: basic
    username: "xxxxxx"
    password: "xxxxxx"  
    resource: http://xxx.xxx.x.xxx:8080/jsonrpc
    params:
      request: '{"jsonrpc": "2.0", "id": 1, "method": "Player.GetItem", "params": {"properties": ["file"], "playerid": 1}}'
    value_template: '{{ value_json.result.item.file }}'

and the log:

Logger: homeassistant.components.sensor
Source: components/rest/data.py:63
Integration: Sensor (documentation, issues)
First occurred: 21:25:46 (1 occurrences)
Last logged: 21:25:46

Error while setting up rest platform for sensor
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 289, in _async_setup_platform
    await asyncio.shield(task)
  File "/usr/src/homeassistant/homeassistant/components/rest/sensor.py", line 63, in async_setup_platform
    await rest.async_update(log_errors=False)
  File "/usr/src/homeassistant/homeassistant/components/rest/data.py", line 63, in async_update
    response = await self._async_client.request(
  File "/usr/local/lib/python3.10/site-packages/httpx/_client.py", line 1520, in request
    request = self.build_request(
  File "/usr/local/lib/python3.10/site-packages/httpx/_client.py", line 351, in build_request
    params = self._merge_queryparams(params)
  File "/usr/local/lib/python3.10/site-packages/httpx/_client.py", line 428, in _merge_queryparams
    return merged_queryparams.merge(params)
  File "/usr/local/lib/python3.10/site-packages/httpx/_urls.py", line 723, in merge
    q = QueryParams(params)
  File "/usr/local/lib/python3.10/site-packages/httpx/_urls.py", line 585, in __init__
    self._dict = {
  File "/usr/local/lib/python3.10/site-packages/httpx/_urls.py", line 586, in <dictcomp>
    str(k): [primitive_value_to_str(item) for item in v]
  File "/usr/local/lib/python3.10/site-packages/httpx/_urls.py", line 586, in <listcomp>
    str(k): [primitive_value_to_str(item) for item in v]
  File "/usr/local/lib/python3.10/site-packages/httpx/_utils.py", line 72, in primitive_value_to_str
    raise TypeError(
TypeError: Expected str, int, float, bool, or None. Got 'Wrapper'.

Made a github issue: Github Issue

Update: will be fixed in upcoming release of HA

1 Like

Sorry I set notifications but did not get any.

I have rebuilt the sensor in ESPhome, so I kind of worked round it, so I don’t know if it is fixed.

Its fixed now in new core 2023.2.X

1 Like