Reduce multiple curl into single for multiple sensors

I think the host is not liking multiple curl calls and it got me thinking that each curl gets all the data needed, so why do I need repeated calls?

I have this in my configuration.yaml:

command_line:


  - sensor:
      command: "curl -k -u <USER>:<PASSWORD> https://ws.otodatanetwork.com/neevoapp/v1/DataService.svc/GetAllDisplayPropaneDevices --header Content-Type:application/json"
      name: "Propane Tank Neevo 371 Gallons"
      unique_id: propane_tank_371_gallons
      value_template: "{{ value_json[0].Level|float(0) * 2.4 if value_json[0].Level is defined else this.state }}"
      scan_interval: 157680000
      state_class: measurement
      unit_of_measurement: "Gallons"
  # 371 Propane

  - sensor:
      command: "curl -k -u <USER>:<PASSWORD> https://ws.otodatanetwork.com/neevoapp/v1/DataService.svc/GetAllDisplayPropaneDevices --header Content-Type:application/json"
      name: "Propane Tank Neevo 629 Gallons"
      unique_id: propane_tank_629_gallons
      value_template: "{{ value_json[1].Level|float(0) * 1.2 if value_json[1].Level is defined else this.state }}"
      scan_interval: 157680000
      state_class: measurement
      unit_of_measurement: "Gallons"
  # 629 Propane

  - sensor:
      command: "curl -k -u <USER>:<PASSWORD> https://ws.otodatanetwork.com/neevoapp/v1/DataService.svc/GetAllDisplayPropaneDevices --header Content-Type:application/json"
      name: "Propane Tank Neevo 255 Gallons"
      unique_id: propane_tank_255_gallons
      value_template: "{{ value_json[3].Level|float(0) * 1.2 if value_json[2].Level is defined else this.state }}"
      scan_interval: 157680000
      state_class: measurement
      unit_of_measurement: "Gallons"
  # 255 Propane

  - sensor:
      command: "curl -k -u <USER>:<PASSWORD> https://ws.otodatanetwork.com/neevoapp/v1/DataService.svc/GetAllDisplayPropaneDevices --header Content-Type:application/json"
      name: "Propane Tank Neevo 76 Gallons"
      unique_id: propane_tank_76_gallons
      value_template: "{{ value_json[4].Level|float(0) * 1.2 if value_json[3].Level is defined else this.state }}"
      scan_interval: 157680000
      state_class: measurement
      unit_of_measurement: "Gallons"
  #76 Propane

  - sensor:
      command: "curl -k -u <USER>:<PASSWORD> https://ws.otodatanetwork.com/neevoapp/v1/DataService.svc/GetAllDisplayPropaneDevices --header Content-Type:application/json"
      name: "Propane Tank Neevo 125 Gallons"
      unique_id: propane_tank_125_gallons
      value_template: "{{ value_json[5].Level|float(0) * 1.2 if value_json[4].Level is defined else this.state }}"
      scan_interval: 157680000
      state_class: measurement
      unit_of_measurement: "Gallons"
  # 125 Propane

  - sensor:
      command: "curl -k -u <USER>:<PASSWORD> https://ws.otodatanetwork.com/neevoapp/v1/DataService.svc/GetAllDisplayPropaneDevices --header Content-Type:application/json"
      name: "Propane Tank Neevo 630 Gallons"
      unique_id: propane_tank_630_gallons
      value_template: "{{ value_json[2].Level|float(0) * 2.4 if value_json[5].Level is defined else this.state }}"
      scan_interval: 157680000
      state_class: measurement
      unit_of_measurement: "Gallons"
  # 630 Propane

  - sensor:
      command: "curl -k -u <USER>:<PASSWORD> https://ws.otodatanetwork.com/neevoapp/v1/DataService.svc/GetAllDisplayPropaneDevices --header Content-Type:application/json"
      name: "Propane Tank Neevo 6 Gallons"
      unique_id: propane_tank_6_gallons
      value_template: "{{ value_json[6].Level|float(0) * 2.4 if value_json[6].Level is defined else this.state }}"
      scan_interval: 157680000
      state_class: measurement
      unit_of_measurement: "Gallons"
# ??? Propane

Each curl call yields this response:

> 
> [{"CompanyFillRequestAvailable":false,"CompanyId":"29014dc1-acd3-4abe-9e03-0054f48393da","CompanyImageId":null,"CompanyName":"yyyy Energy Inc.","CompanySupportPhoneNumber":null,"CustomName":"371","DealerId":"0148e47d-980b-4f4a-bd5c-c835e48c8a02","Id":"c99fd97d-2d7e-437f-a55b-9b4bd46f2701","IsOwner":true,"Latitude":yyyy1872,"Level":9,"Longitude":-xxxxx289,"NotifyAt1":40.00,"NotifyAt2":25.00,"NotifyCriticalLevels":true,"NotifyDispatch":false,"NotifyDispatchEnabled":false,"NotifyFillDetection":true,"Product":"Propane","SensorMaxLevel":null,"SensorMinLevel":null,"SerialNumber":20196761,"TankCapacity":908.49,"TankFormType":1,"TankLastPressure":null,"TankPressureDisplayUnitSymbol":"kPa","TankPrimaryValueType":0,"ThemeInfo":null},{"CompanyFillRequestAvailable":false,"CompanyId":"29014dc1-acd3-4abe-9e03-0054f48393da","CompanyImageId":null,"CompanyName":"yyyy Energy Inc.","CompanySupportPhoneNumber":null,"CustomName":"629","DealerId":"0148e47d-980b-4f4a-bd5c-c835e48c8a02","Id":"236d578d-f835-4e41-8a09-d20a93df50b3","IsOwner":true,"Latitude":yyyy5841,"Level":75,"Longitude":-xxxxx338,"NotifyAt1":30.00,"NotifyAt2":20.00,"NotifyCriticalLevels":true,"NotifyDispatch":false,"NotifyDispatchEnabled":false,"NotifyFillDetection":true,"Product":"Propane","SensorMaxLevel":null,"SensorMinLevel":null,"SerialNumber":20527575,"TankCapacity":454.24,"TankFormType":1,"TankLastPressure":null,"TankPressureDisplayUnitSymbol":"kPa","TankPrimaryValueType":0,"ThemeInfo":null},{"CompanyFillRequestAvailable":false,"CompanyId":"29014dc1-acd3-4abe-9e03-0054f48393da","CompanyImageId":null,"CompanyName":"yyyy Energy Inc.","CompanySupportPhoneNumber":null,"CustomName":"630  Correct","DealerId":"0148e47d-980b-4f4a-bd5c-c835e48c8a02","Id":"a86e10ad-cb5e-449d-a606-ffdae0e1c769","IsOwner":true,"Latitude":yyyy5976,"Level":72,"Longitude":-yyyy9904,"NotifyAt1":30.00,"NotifyAt2":20.00,"NotifyCriticalLevels":true,"NotifyDispatch":true,"NotifyDispatchEnabled":false,"NotifyFillDetection":true,"Product":"Propane","SensorMaxLevel":null,"SensorMinLevel":null,"SerialNumber":24045716,"TankCapacity":908.49,"TankFormType":1,"TankLastPressure":null,"TankPressureDisplayUnitSymbol":"kPa","TankPrimaryValueType":0,"ThemeInfo":null},{"CompanyFillRequestAvailable":false,"CompanyId":"29014dc1-acd3-4abe-9e03-0054f48393da","CompanyImageId":null,"CompanyName":"yyyy Energy Inc.","CompanySupportPhoneNumber":null,"CustomName":"255","DealerId":"0148e47d-980b-4f4a-bd5c-c835e48c8a02","Id":"b9310be9-b276-4294-b09a-11ac67b20cfd","IsOwner":true,"Latitude":yyyy3741,"Level":64,"Longitude":-yyyy3814,"NotifyAt1":30.00,"NotifyAt2":20.00,"NotifyCriticalLevels":true,"NotifyDispatch":false,"NotifyDispatchEnabled":false,"NotifyFillDetection":true,"Product":"Propane","SensorMaxLevel":null,"SensorMinLevel":null,"SerialNumber":24122799,"TankCapacity":454.24,"TankFormType":1,"TankLastPressure":null,"TankPressureDisplayUnitSymbol":"kPa","TankPrimaryValueType":0,"ThemeInfo":null},{"CompanyFillRequestAvailable":false,"CompanyId":"29014dc1-acd3-4abe-9e03-0054f48393da","CompanyImageId":null,"CompanyName":"yyyy Energy Inc.","CompanySupportPhoneNumber":null,"CustomName":"76","DealerId":"0148e47d-980b-4f4a-bd5c-c835e48c8a02","Id":"8f3c2705-39cc-461e-aff5-9251c2eefb5a","IsOwner":true,"Latitude":yyyy0257,"Level":72,"Longitude":-yyyy9472,"NotifyAt1":30.00,"NotifyAt2":20.00,"NotifyCriticalLevels":true,"NotifyDispatch":true,"NotifyDispatchEnabled":false,"NotifyFillDetection":true,"Product":"Propane","SensorMaxLevel":null,"SensorMinLevel":null,"SerialNumber":24470704,"TankCapacity":454.24,"TankFormType":1,"TankLastPressure":null,"TankPressureDisplayUnitSymbol":"kPa","TankPrimaryValueType":0,"ThemeInfo":null},{"CompanyFillRequestAvailable":false,"CompanyId":"29014dc1-acd3-4abe-9e03-0054f48393da","CompanyImageId":null,"CompanyName":"yyyy Energy Inc.","CompanySupportPhoneNumber":null,"CustomName":"125 ","DealerId":"0148e47d-980b-4f4a-bd5c-c835e48c8a02","Id":"3c3dcd64-85cc-4961-8489-d210861382ee","IsOwner":true,"Latitude":yyyy0339,"Level":75,"Longitude":-yyyy8042,"NotifyAt1":30.00,"NotifyAt2":20.00,"NotifyCriticalLevels":true,"NotifyDispatch":true,"NotifyDispatchEnabled":false,"NotifyFillDetection":true,"Product":"Propane","SensorMaxLevel":null,"SensorMinLevel":null,"SerialNumber":24554970,"TankCapacity":454.24,"TankFormType":1,"TankLastPressure":null,"TankPressureDisplayUnitSymbol":"kPa","TankPrimaryValueType":0,"ThemeInfo":null}]

What is the easiest/best way to extract all 7 “LEVEL” values and assign each to separate sensor using only a single curl call?

Thank you.

You could use curl to save the content as a file and then use e.g. REST integration/sensors to read from the file.

EDIT
Amother option is to put the whole output in one sensor-attributes and then use template entities (if stil lneeded), this may or may not need JQ to fiddle the data as you like it…
this would then look like

    command: >
         echo "{\"whateverattribute\":" $(
         curl 
         -s 
         'YOURCOMMAND'
         ) "}" 
    value_template: > 
        {{ value_json.whateverattribute | length }}
    json_attributes:
        - whateverattribute

Any reason to not use the Rest integration, that allows you to define multiple sensors on a single call?

Thanks, guys.

I have no experience at all with the REST integration. I took a look at the RESTful integration and trying to understand.

Does REST replace curl (i.e., curl is no longer used if I used REST)?

Yes. It does exactly the same as a command_line + curl, just more efficiently.

Got it.

I’ve been looking for the equivalent way to reference the JSON number in order to find the LEVEL amount for each entry, and am having a hard time.

Provide the JSON, and we might be able to help.

Thank you. It was included in post 1 but because it has not cr/lf it was easy to miss.

Here it is:

[{“CompanyFillRequestAvailable”:false,“CompanyId”:“29014dc1-acd3-4abe-9e03-0054f48393da”,“CompanyImageId”:null,“CompanyName”:“yyyy Energy Inc.”,“CompanySupportPhoneNumber”:null,“CustomName”:“371”,“DealerId”:“0148e47d-980b-4f4a-bd5c-c835e48c8a02”,“Id”:“c99fd97d-2d7e-437f-a55b-9b4bd46f2701”,“IsOwner”:true,“Latitude”:yyyy1872,“Level”:9,“Longitude”:-xxxxx289,“NotifyAt1”:40.00,“NotifyAt2”:25.00,“NotifyCriticalLevels”:true,“NotifyDispatch”:false,“NotifyDispatchEnabled”:false,“NotifyFillDetection”:true,“Product”:“Propane”,“SensorMaxLevel”:null,“SensorMinLevel”:null,“SerialNumber”:20196761,“TankCapacity”:908.49,“TankFormType”:1,“TankLastPressure”:null,“TankPressureDisplayUnitSymbol”:“kPa”,“TankPrimaryValueType”:0,“ThemeInfo”:null},{“CompanyFillRequestAvailable”:false,“CompanyId”:“29014dc1-acd3-4abe-9e03-0054f48393da”,“CompanyImageId”:null,“CompanyName”:“yyyy Energy Inc.”,“CompanySupportPhoneNumber”:null,“CustomName”:“629”,“DealerId”:“0148e47d-980b-4f4a-bd5c-c835e48c8a02”,“Id”:“236d578d-f835-4e41-8a09-d20a93df50b3”,“IsOwner”:true,“Latitude”:yyyy5841,“Level”:75,“Longitude”:-xxxxx338,“NotifyAt1”:30.00,“NotifyAt2”:20.00,“NotifyCriticalLevels”:true,“NotifyDispatch”:false,“NotifyDispatchEnabled”:false,“NotifyFillDetection”:true,“Product”:“Propane”,“SensorMaxLevel”:null,“SensorMinLevel”:null,“SerialNumber”:20527575,“TankCapacity”:454.24,“TankFormType”:1,“TankLastPressure”:null,“TankPressureDisplayUnitSymbol”:“kPa”,“TankPrimaryValueType”:0,“ThemeInfo”:null},{“CompanyFillRequestAvailable”:false,“CompanyId”:“29014dc1-acd3-4abe-9e03-0054f48393da”,“CompanyImageId”:null,“CompanyName”:“yyyy Energy Inc.”,“CompanySupportPhoneNumber”:null,“CustomName”:“630 Correct”,“DealerId”:“0148e47d-980b-4f4a-bd5c-c835e48c8a02”,“Id”:“a86e10ad-cb5e-449d-a606-ffdae0e1c769”,“IsOwner”:true,“Latitude”:yyyy5976,“Level”:72,“Longitude”:-yyyy9904,“NotifyAt1”:30.00,“NotifyAt2”:20.00,“NotifyCriticalLevels”:true,“NotifyDispatch”:true,“NotifyDispatchEnabled”:false,“NotifyFillDetection”:true,“Product”:“Propane”,“SensorMaxLevel”:null,“SensorMinLevel”:null,“SerialNumber”:24045716,“TankCapacity”:908.49,“TankFormType”:1,“TankLastPressure”:null,“TankPressureDisplayUnitSymbol”:“kPa”,“TankPrimaryValueType”:0,“ThemeInfo”:null},{“CompanyFillRequestAvailable”:false,“CompanyId”:“29014dc1-acd3-4abe-9e03-0054f48393da”,“CompanyImageId”:null,“CompanyName”:“yyyy Energy Inc.”,“CompanySupportPhoneNumber”:null,“CustomName”:“255”,“DealerId”:“0148e47d-980b-4f4a-bd5c-c835e48c8a02”,“Id”:“b9310be9-b276-4294-b09a-11ac67b20cfd”,“IsOwner”:true,“Latitude”:yyyy3741,“Level”:64,“Longitude”:-yyyy3814,“NotifyAt1”:30.00,“NotifyAt2”:20.00,“NotifyCriticalLevels”:true,“NotifyDispatch”:false,“NotifyDispatchEnabled”:false,“NotifyFillDetection”:true,“Product”:“Propane”,“SensorMaxLevel”:null,“SensorMinLevel”:null,“SerialNumber”:24122799,“TankCapacity”:454.24,“TankFormType”:1,“TankLastPressure”:null,“TankPressureDisplayUnitSymbol”:“kPa”,“TankPrimaryValueType”:0,“ThemeInfo”:null},{“CompanyFillRequestAvailable”:false,“CompanyId”:“29014dc1-acd3-4abe-9e03-0054f48393da”,“CompanyImageId”:null,“CompanyName”:“yyyy Energy Inc.”,“CompanySupportPhoneNumber”:null,“CustomName”:“76”,“DealerId”:“0148e47d-980b-4f4a-bd5c-c835e48c8a02”,“Id”:“8f3c2705-39cc-461e-aff5-9251c2eefb5a”,“IsOwner”:true,“Latitude”:yyyy0257,“Level”:72,“Longitude”:-yyyy9472,“NotifyAt1”:30.00,“NotifyAt2”:20.00,“NotifyCriticalLevels”:true,“NotifyDispatch”:true,“NotifyDispatchEnabled”:false,“NotifyFillDetection”:true,“Product”:“Propane”,“SensorMaxLevel”:null,“SensorMinLevel”:null,“SerialNumber”:24470704,“TankCapacity”:454.24,“TankFormType”:1,“TankLastPressure”:null,“TankPressureDisplayUnitSymbol”:“kPa”,“TankPrimaryValueType”:0,“ThemeInfo”:null},{“CompanyFillRequestAvailable”:false,“CompanyId”:“29014dc1-acd3-4abe-9e03-0054f48393da”,“CompanyImageId”:null,“CompanyName”:“yyyy Energy Inc.”,“CompanySupportPhoneNumber”:null,“CustomName”:"125 ",“DealerId”:“0148e47d-980b-4f4a-bd5c-c835e48c8a02”,“Id”:“3c3dcd64-85cc-4961-8489-d210861382ee”,“IsOwner”:true,“Latitude”:yyyy0339,“Level”:75,“Longitude”:-yyyy8042,“NotifyAt1”:30.00,“NotifyAt2”:20.00,“NotifyCriticalLevels”:true,“NotifyDispatch”:true,“NotifyDispatchEnabled”:false,“NotifyFillDetection”:true,“Product”:“Propane”,“SensorMaxLevel”:null,“SensorMinLevel”:null,“SerialNumber”:24554970,“TankCapacity”:454.24,“TankFormType”:1,“TankLastPressure”:null,“TankPressureDisplayUnitSymbol”:“kPa”,“TankPrimaryValueType”:0,“ThemeInfo”:null}]

Sorry, missed it in post 1 (where it was correctly formatted).

I’m on a phone at the moment so testing is trickier. Could you repost, formatted as in post 1, but with the lat/long numbers replaced by 0? Your use of yyyy makes the JSON invalid.

Does this work:

[{"CompanyFillRequestAvailable":false,"CompanyId":"29014dc1-acd3-4abe-9e03-0054f48393da","CompanyImageId":null,"CompanyName":"yyyy Energy Inc.","CompanySupportPhoneNumber":null,"CustomName":"371","DealerId":"0148e47d-980b-4f4a-bd5c-c835e48c8a02","Id":"c99fd97d-2d7e-437f-a55b-9b4bd46f2701","IsOwner":true,"Latitude":0,"Level":9,"Longitude":0,"NotifyAt1":40.00,"NotifyAt2":25.00,"NotifyCriticalLevels":true,"NotifyDispatch":false,"NotifyDispatchEnabled":false,"NotifyFillDetection":true,"Product":"Propane","SensorMaxLevel":null,"SensorMinLevel":null,"SerialNumber":20196761,"TankCapacity":908.49,"TankFormType":1,"TankLastPressure":null,"TankPressureDisplayUnitSymbol":"kPa","TankPrimaryValueType":0,"ThemeInfo":null},{"CompanyFillRequestAvailable":false,"CompanyId":"29014dc1-acd3-4abe-9e03-0054f48393da","CompanyImageId":null,"CompanyName":"yyyy Energy Inc.","CompanySupportPhoneNumber":null,"CustomName":"629","DealerId":"0148e47d-980b-4f4a-bd5c-c835e48c8a02","Id":"236d578d-f835-4e41-8a09-d20a93df50b3","IsOwner":true,"Latitude":0,"Level":75,"Longitude":0,"NotifyAt1":30.00,"NotifyAt2":20.00,"NotifyCriticalLevels":true,"NotifyDispatch":false,"NotifyDispatchEnabled":false,"NotifyFillDetection":true,"Product":"Propane","SensorMaxLevel":null,"SensorMinLevel":null,"SerialNumber":20527575,"TankCapacity":454.24,"TankFormType":1,"TankLastPressure":null,"TankPressureDisplayUnitSymbol":"kPa","TankPrimaryValueType":0,"ThemeInfo":null},{"CompanyFillRequestAvailable":false,"CompanyId":"29014dc1-acd3-4abe-9e03-0054f48393da","CompanyImageId":null,"CompanyName":"yyyy Energy Inc.","CompanySupportPhoneNumber":null,"CustomName":"630  Correct","DealerId":"0148e47d-980b-4f4a-bd5c-c835e48c8a02","Id":"a86e10ad-cb5e-449d-a606-ffdae0e1c769","IsOwner":true,"Latitude":0,"Level":72,"Longitude":-yyyy9904,"NotifyAt1":30.00,"NotifyAt2":20.00,"NotifyCriticalLevels":true,"NotifyDispatch":true,"NotifyDispatchEnabled":false,"NotifyFillDetection":true,"Product":"Propane","SensorMaxLevel":null,"SensorMinLevel":null,"SerialNumber":24045716,"TankCapacity":908.49,"TankFormType":1,"TankLastPressure":null,"TankPressureDisplayUnitSymbol":"kPa","TankPrimaryValueType":0,"ThemeInfo":null},{"CompanyFillRequestAvailable":false,"CompanyId":"29014dc1-acd3-4abe-9e03-0054f48393da","CompanyImageId":null,"CompanyName":"yyyy Energy Inc.","CompanySupportPhoneNumber":null,"CustomName":"255","DealerId":"0148e47d-980b-4f4a-bd5c-c835e48c8a02","Id":"b9310be9-b276-4294-b09a-11ac67b20cfd","IsOwner":true,"Latitude":0,"Level":64,"Longitude":-yyyy3814,"NotifyAt1":30.00,"NotifyAt2":20.00,"NotifyCriticalLevels":true,"NotifyDispatch":false,"NotifyDispatchEnabled":false,"NotifyFillDetection":true,"Product":"Propane","SensorMaxLevel":null,"SensorMinLevel":null,"SerialNumber":24122799,"TankCapacity":454.24,"TankFormType":1,"TankLastPressure":null,"TankPressureDisplayUnitSymbol":"kPa","TankPrimaryValueType":0,"ThemeInfo":null},{"CompanyFillRequestAvailable":false,"CompanyId":"29014dc1-acd3-4abe-9e03-0054f48393da","CompanyImageId":null,"CompanyName":"yyyy Energy Inc.","CompanySupportPhoneNumber":null,"CustomName":"76","DealerId":"0148e47d-980b-4f4a-bd5c-c835e48c8a02","Id":"8f3c2705-39cc-461e-aff5-9251c2eefb5a","IsOwner":true,"Latitude":0,"Level":72,"Longitude":-yyyy9472,"NotifyAt1":30.00,"NotifyAt2":20.00,"NotifyCriticalLevels":true,"NotifyDispatch":true,"NotifyDispatchEnabled":false,"NotifyFillDetection":true,"Product":"Propane","SensorMaxLevel":null,"SensorMinLevel":null,"SerialNumber":24470704,"TankCapacity":454.24,"TankFormType":1,"TankLastPressure":null,"TankPressureDisplayUnitSymbol":"kPa","TankPrimaryValueType":0,"ThemeInfo":null},{"CompanyFillRequestAvailable":false,"CompanyId":"29014dc1-acd3-4abe-9e03-0054f48393da","CompanyImageId":null,"CompanyName":"yyyy Energy Inc.","CompanySupportPhoneNumber":null,"CustomName":"125 ","DealerId":"0148e47d-980b-4f4a-bd5c-c835e48c8a02","Id":"3c3dcd64-85cc-4961-8489-d210861382ee","IsOwner":true,"Latitude":0,"Level":75,"Longitude":-yyyy8042,"NotifyAt1":30.00,"NotifyAt2":20.00,"NotifyCriticalLevels":true,"NotifyDispatch":true,"NotifyDispatchEnabled":false,"NotifyFillDetection":true,"Product":"Propane","SensorMaxLevel":null,"SensorMinLevel":null,"SerialNumber":24554970,"TankCapacity":454.24,"TankFormType":1,"TankLastPressure":null,"TankPressureDisplayUnitSymbol":"kPa","TankPrimaryValueType":0,"ThemeInfo":null}]

You missed a few but I have fixed that. What’s the problem? Your existing value_templates work with that JSON, so something like this at the top level of configuration.yaml and a restart should work:

rest:
  - resource: https://ws.otodatanetwork.com/neevoapp/v1/DataService.svc/GetAllDisplayPropaneDevices
    authentication: basic
    username: "USER"
    password: "PASSWORD"
    scan_interval: 86400
    headers:
      Content-Type: application/json
    sensor:
      - name: "Propane Tank Neevo 371 Gallons"
        unique_id: propane_tank_371_gallons
        value_template: "{{ value_json[0].Level|float(0) *, 2.4 if value_json[0].Level is defined else this.state }}"
        state_class: measurement
        unit_of_measurement: "gal"

      - name: "Propane Tank Neevo 629 Gallons"
        unique_id: propane_tank_629_gallons
        value_template: "{{ value_json[1].Level|float(0) * 1.2 if value_json[1].Level is defined else this.state }}"
        state_class: measurement
        unit_of_measurement: "gal"

and so on. That assumes a) the resource is sending JSON with the correct headers and b) the tanks are always listed in that order.

1 Like

Wow!

Perfect – and super cool.

Thank you!