Show arest sensor data (Solved)

How can I show/display data from this code:

sensor esp8266_temperature:
  - platform: arest
    resource: http://192.168.2.90/temperature
    name: ESP8266
    monitored_variables:
      temperature:
        name: temperature
        unit_of_measurement: "°C"
        value_template: "{{ value | round(1) }}"

Thank you Tom, but my sensor is not visible in Lovelace,
do I need an identifier in my code for this to happen ?

Does your sensor exist?

Check developer tools / states.

If it does then you can add it to a Lovelace card.

If it does not, check your log for errors.

Your configuration is wrong.

The first line shall only state sensor:

Actually this is valid.

See the last example here https://www.home-assistant.io/docs/configuration/splitting_configuration/#example-combine-include_dir_merge_list-with-automationsyaml

I changed it to only ‘sensor’, but no luck…

This is my error log:

Error while setting up arest platform for sensor
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 249, in _async_setup_platform
    await asyncio.shield(task)
  File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 52, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/src/homeassistant/homeassistant/components/arest/sensor.py", line 101, in setup_platform
    if variable not in response["variables"]:
KeyError: 'variables'

In HTML:
http://192.168.2.90/temperature

{“temperature”: 24, “id”: “1”, “name”: “esp8266”, “hardware”: “esp8266”, “connected”: true}

I changed the resource url to : http://192.168.2.90/x

now my json is:
{“variables”: {“temperature”: 24, “humidity”: 40}, “id”: “1”, “name”: “esp8266”, “hardware”: “esp8266”, “connected”: true}

the “variabel” error is gone,

but now my error is:


arest: Error on device update!
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 431, in _async_add_entity
    await entity.async_device_update(warning=False)
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 718, in async_device_update
    await task
  File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 52, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/src/homeassistant/homeassistant/components/arest/sensor.py", line 165, in update
    self._attr_available = self.arest.available
AttributeError: 'ArestData' object has no attribute 'available'

but In the manual example there is not attribute “available’”

I changed my json output with ‘available’ added:
{“variables”: {“temperature”: 24, “available”: 1}, “id”: “1”, “name”: “esp8266”, “hardware”: “esp8266”, “connected”: true, “available”: true}

Stil the same error like above.

Solution:

My ESP8266 code:

sensor:
  - platform: rest
    name: Temperatuur
    resource: http://192.168.2.90/temperature
    unit_of_measurement: "°C"
    force_update: true
    scan_interval: 5
    value_template: >-
        {{value_json.temperature}}
    verify_ssl: false