Rest api - best practices

I am trying to import 80 sensors from a single device using the resp api but seeing HA log errors if I have any more than 5 sensors configured. I am wondering whether there is a better way of getting many values from the same device. I think my current config is making 80 single requests to get the data where I woud expect a single request to return all 80 sensor values would be more efficient and hopefully no log errors. Any ideas or direction anyone can offer?

The log errors are:
2022-03-26 01:08:41 ERROR (MainThread) [homeassistant.components.rest.data] Error fetching data: http://192.168.2.19:80/cgi-bin/status.xml failed with All connection attempts failed

I have each sensor configured in confguration.yaml I have shown the config for 2 of the sensors and the remaining ones are configured in the same manner.

  - platform: rest    
    name: AARC Tank pH
    resource: http://192.168.2.19:80/cgi-bin/status.xml
    value_template: "{{ value_json.status.probes.probe[1].value }}"
    unit_of_measurement: "dkh"
    force_update: true    
  - platform: rest    
    name: AARC Tank ORP
    resource: http://192.168.2.19:80/cgi-bin/status.xml
    value_template: "{{ value_json.status.probes.probe[2].value }}"
    unit_of_measurement: "mV"
    force_update: true

The device with the 80 sensors shows the following (I have limited it to the two sensors) when doing a status.xml request.

<status software="5.06_8C21" hardware="1.0">
<hostname>Nursery</hostname>
<serial>AC5:76861</serial>
<timezone>7.00</timezone>
<date>03/26/2022 00:12:37</date>
<power>
<failed>03/13/2022 18:41:53</failed>
<restored>none</restored>
 </power>
<probes>
<probe>
<name>Temp</name>
<value>28.4</value>
<type>Temp</type>
 </probe>
<probe>
<name>pH</name>
<value>8.03</value>
<type>pH</type>
 </probe>



It looks like you’re using the RESTful sensor integration. Try the RESTFUL platform integration instead. You can make one call and extract many fields/values.

1 Like