Hello,
In order to decrease the amount of http request from HomeAssistant to my device, I’m looking for a solution in order to combine my RESTful Sensors declared in my configuration.yaml in one.
As you can see below, I have 2 independant request from the same ressource.
How to combine them in one ?
Thanks a lot !
- First ressource :
- platform: rest
name: "ecocompteur_data_conso_hp"
resource: http://192.168.1.92/data.json
value_template: '{{ (((value|regex_replace("([ :])0+(\\d+),", "\g<1>\g<2>,")|from_json).conso_hp) | float * 1 / 1000) | round(0) }}'
device_class: energy
scan_interval: 300 #5min
unit_of_measurement: "kWh"
- platform: rest
name: "ecocompteur_data_conso_hc"
resource: http://192.168.1.92/data.json
value_template: '{{ (((value|regex_replace("([ :])0+(\\d+),", "\g<1>\g<2>,")|from_json).conso_hc) | float * 1 / 1000) | round(0) }}'
device_class: energy
scan_interval: 300 #5min
unit_of_measurement: "kWh"
- Second ressource
- platform: rest
name: "ecocompteur_inst_data1"
resource: http://192.168.1.92/inst.json
value_template: '{{ value_json.data1 | round(0) }}'
device_class: power
scan_interval: 5
unit_of_measurement: "W"
- platform: rest
name: "ecocompteur_inst_data2"
resource: http://192.168.1.92/inst.json
value_template: '{{ value_json.data2 | round(0) }}'
device_class: power
scan_interval: 5
unit_of_measurement: "W"
- platform: rest
name: "ecocompteur_inst_data3"
resource: http://192.168.1.92/inst.json
value_template: '{{ value_json.data3 | round(0) }}'
device_class: power
scan_interval: 5
unit_of_measurement: "W"
- platform: rest
name: "ecocompteur_inst_data4"
resource: http://192.168.1.92/inst.json
value_template: '{{ value_json.data4 | round(0) }}'
device_class: power
scan_interval: 5
unit_of_measurement: "W"
- platform: rest
name: "ecocompteur_inst_data5"
resource: http://192.168.1.92/inst.json
value_template: '{{ value_json.data5 | round(0) }}'
device_class: power
scan_interval: 5
unit_of_measurement: "W"
- platform: rest
name: "ecocompteur_inst_data6m3"
resource: http://192.168.1.92/inst.json
value_template: '{{ ((value_json.data6m3 ) | float * 1 + 283.993 ) | round(3) }}'
scan_interval: 5
unit_of_measurement: "m3"
- platform: rest
name: "ecocompteur_inst_data7m3"
resource: http://192.168.1.92/inst.json
value_template: '{{ ((value_json.data7m3 ) | float * 1 + 134.391) | round(3) }}'
scan_interval: 5
unit_of_measurement: "m3"