JSON Sensors empty?

I’m trying to turn the follow JSON into sensors I can display on a card.

[
  {
    "DataProvider": {
      "WebsiteURL": "http://openchargemap.org",
      "Comments": null,
      "DataProviderStatusType": {
        "IsProviderEnabled": true,
        "ID": 1,
        "Title": "Manual Data Entry"
      },
      "IsRestrictedEdit": false,
      "IsOpenDataLicensed": true,
      "IsApprovedImport": true,
      "License": "Licensed under Creative Commons Attribution 4.0 International (CC BY 4.0)",
      "DateLastImported": null,
      "ID": 1,
      "Title": "Open Charge Map Contributors"
    },
    "OperatorInfo": {
      "WebsiteURL": "https://www.bppulse.co.uk/",
      "Comments": "Formerly known as Polar Network, or BP Chargemaster",
      "PhonePrimaryContact": "01582 400331",
      "PhoneSecondaryContact": null,
      "IsPrivateIndividual": false,
      "AddressInfo": null,
      "BookingURL": null,
      "ContactEmail": "[email protected]",
      "FaultReportEmail": "[email protected]",
      "IsRestrictedEdit": false,
      "ID": 32,
      "Title": "BP Pulse"
    },
    "UsageType": {
      "IsPayAtLocation": false,
      "IsMembershipRequired": true,
      "IsAccessKeyRequired": true,
      "ID": 4,
      "Title": "Public - Membership Required"
    },
    "StatusType": {
      "IsOperational": true,
      "IsUserSelectable": true,
      "ID": 50,
      "Title": "Operational"
    },
    "SubmissionStatus": {
      "IsLive": true,
      "ID": 200,
      "Title": "Submission Published"
    },
    "UserComments": null,
    "PercentageSimilarity": null,
    "MediaItems": null,
    "IsRecentlyVerified": false,
    "DateLastVerified": "2019-06-21T05:25:00Z",
    "ID": 116913,
    "UUID": "37418399-D732-4031-B6D2-6C37AB5C2F98",
    "ParentChargePointID": null,
    "DataProviderID": 1,
    "DataProvidersReference": null,
    "OperatorID": 32,
    "OperatorsReference": "24338",
    "UsageTypeID": 4,
    "UsageCost": "£0.108/kWh; for Polar Plus subscription members only",
    "AddressInfo": {
      "ID": 117259,
      "Title": "Best Western Salford Hall Hotel",
      "AddressLine1": "Best Western Salford Hall Hotel",
      "AddressLine2": null,
      "Town": "Abbot's Salford",
      "StateOrProvince": "Evesham",
      "Postcode": "WR11 8UT",
      "CountryID": 1,
      "Country": {
        "ISOCode": "GB",
        "ContinentCode": "EU",
        "ID": 1,
        "Title": "United Kingdom"
      },
      "Latitude": 52.148701,
      "Longitude": -1.9028,
      "ContactTelephone1": null,
      "ContactTelephone2": null,
      "ContactEmail": null,
      "AccessComments": null,
      "RelatedURL": null,
      "Distance": 1.422837956297505,
      "DistanceUnit": 2
    },
    "Connections": [
      {
        "ID": 165497,
        "ConnectionTypeID": 33,
        "ConnectionType": {
          "FormalName": "IEC 62196-3 Configuration FF",
          "IsDiscontinued": false,
          "IsObsolete": false,
          "ID": 33,
          "Title": "CCS (Type 2)"
        },
        "Reference": null,
        "StatusTypeID": 50,
        "StatusType": {
          "IsOperational": true,
          "IsUserSelectable": true,
          "ID": 50,
          "Title": "Operational"
        },
        "LevelID": 3,
        "Level": {
          "Comments": "40KW and Higher",
          "IsFastChargeCapable": true,
          "ID": 3,
          "Title": "Level 3:  High (Over 40kW)"
        },
        "Amps": null,
        "Voltage": null,
        "PowerKW": 50.0,
        "CurrentTypeID": 30,
        "CurrentType": {
          "Description": "Direct Current",
          "ID": 30,
          "Title": "DC"
        },
        "Quantity": 1,
        "Comments": null
      },
      {
        "ID": 165498,
        "ConnectionTypeID": 2,
        "ConnectionType": {
          "FormalName": "IEC 62196-3 Configuration AA",
          "IsDiscontinued": null,
          "IsObsolete": null,
          "ID": 2,
          "Title": "CHAdeMO"
        },
        "Reference": null,
        "StatusTypeID": 50,
        "StatusType": {
          "IsOperational": true,
          "IsUserSelectable": true,
          "ID": 50,
          "Title": "Operational"
        },
        "LevelID": 3,
        "Level": {
          "Comments": "40KW and Higher",
          "IsFastChargeCapable": true,
          "ID": 3,
          "Title": "Level 3:  High (Over 40kW)"
        },
        "Amps": null,
        "Voltage": null,
        "PowerKW": 50.0,
        "CurrentTypeID": 30,
        "CurrentType": {
          "Description": "Direct Current",
          "ID": 30,
          "Title": "DC"
        },
        "Quantity": 1,
        "Comments": null
      },
      {
        "ID": 165499,
        "ConnectionTypeID": 1036,
        "ConnectionType": {
          "FormalName": "IEC 62196-2",
          "IsDiscontinued": false,
          "IsObsolete": false,
          "ID": 1036,
          "Title": "Type 2 (Tethered Connector) "
        },
        "Reference": null,
        "StatusTypeID": 50,
        "StatusType": {
          "IsOperational": true,
          "IsUserSelectable": true,
          "ID": 50,
          "Title": "Operational"
        },
        "LevelID": 3,
        "Level": {
          "Comments": "40KW and Higher",
          "IsFastChargeCapable": true,
          "ID": 3,
          "Title": "Level 3:  High (Over 40kW)"
        },
        "Amps": null,
        "Voltage": null,
        "PowerKW": 43.0,
        "CurrentTypeID": 20,
        "CurrentType": {
          "Description": "Alternating Current - Three Phase",
          "ID": 20,
          "Title": "AC (Three-Phase)"
        },
        "Quantity": 1,
        "Comments": null
      }
    ],
    "NumberOfPoints": 2,
    "GeneralComments": "Unit located in the rear car park.",
    "DatePlanned": null,
    "DateLastConfirmed": null,
    "StatusTypeID": 50,
    "DateLastStatusUpdate": "2019-06-21T05:25:00Z",
    "MetadataValues": null,
    "DataQualityLevel": 1,
    "DateCreated": "2019-02-14T06:15:00Z",
    "SubmissionStatusTypeID": 200
  },
  {
    "DataProvider": {
      "WebsiteURL": "http://openchargemap.org",
      "Comments": null,
      "DataProviderStatusType": {
        "IsProviderEnabled": true,
        "ID": 1,
        "Title": "Manual Data Entry"
      },
      "IsRestrictedEdit": false,
      "IsOpenDataLicensed": true,
      "IsApprovedImport": true,
      "License": "Licensed under Creative Commons Attribution 4.0 International (CC BY 4.0)",
      "DateLastImported": null,
      "ID": 1,
      "Title": "Open Charge Map Contributors"
    },
    "OperatorInfo": {
      "WebsiteURL": "https://www.bppulse.co.uk/",
      "Comments": "Formerly known as Polar Network, or BP Chargemaster",
      "PhonePrimaryContact": "01582 400331",
      "PhoneSecondaryContact": null,
      "IsPrivateIndividual": false,
      "AddressInfo": null,
      "BookingURL": null,
      "ContactEmail": "[email protected]",
      "FaultReportEmail": "[email protected]",
      "IsRestrictedEdit": false,
      "ID": 32,
      "Title": "BP Pulse"
    },
    "UsageType": {
      "IsPayAtLocation": false,
      "IsMembershipRequired": true,
      "IsAccessKeyRequired": true,
      "ID": 4,
      "Title": "Public - Membership Required"
    },
    "StatusType": {
      "IsOperational": true,
      "IsUserSelectable": true,
      "ID": 50,
      "Title": "Operational"
    },
    "SubmissionStatus": {
      "IsLive": true,
      "ID": 200,
      "Title": "Submission Published"
    },
    "UserComments": null,
    "PercentageSimilarity": null,
    "MediaItems": null,
    "IsRecentlyVerified": false,
    "DateLastVerified": "2019-06-20T05:34:00Z",
    "ID": 101894,
    "UUID": "4108498C-6875-4630-AB15-F4224F4B7C52",
    "ParentChargePointID": null,
    "DataProviderID": 1,
    "DataProvidersReference": null,
    "OperatorID": 32,
    "OperatorsReference": "21030,21034",
    "UsageTypeID": 4,
    "UsageCost": "£0.108/kWh; for Polar Plus subscription members only",
    "AddressInfo": {
      "ID": 102240,
      "Title": "Evesham Country Park",
      "AddressLine1": "Evesham Country Park",
      "AddressLine2": null,
      "Town": "Evesham",
      "StateOrProvince": null,
      "Postcode": "WR11 4TP",
      "CountryID": 1,
      "Country": {
        "ISOCode": "GB",
        "ContinentCode": "EU",
        "ID": 1,
        "Title": "United Kingdom"
      },
      "Latitude": 52.116016,
      "Longitude": -1.939138,
      "ContactTelephone1": null,
      "ContactTelephone2": null,
      "ContactEmail": null,
      "AccessComments": null,
      "RelatedURL": null,
      "Distance": 2.3200392429901875,
      "DistanceUnit": 2
    },
    "Connections": [
      {
        "ID": 143849,
        "ConnectionTypeID": 2,
        "ConnectionType": {
          "FormalName": "IEC 62196-3 Configuration AA",
          "IsDiscontinued": null,
          "IsObsolete": null,
          "ID": 2,
          "Title": "CHAdeMO"
        },
        "Reference": null,
        "StatusTypeID": 50,
        "StatusType": {
          "IsOperational": true,
          "IsUserSelectable": true,
          "ID": 50,
          "Title": "Operational"
        },
        "LevelID": 3,
        "Level": {
          "Comments": "40KW and Higher",
          "IsFastChargeCapable": true,
          "ID": 3,
          "Title": "Level 3:  High (Over 40kW)"
        },
        "Amps": null,
        "Voltage": null,
        "PowerKW": 50.0,
        "CurrentTypeID": 30,
        "CurrentType": {
          "Description": "Direct Current",
          "ID": 30,
          "Title": "DC"
        },
        "Quantity": 2,
        "Comments": null
      },
      {
        "ID": 143850,
        "ConnectionTypeID": 1036,
        "ConnectionType": {
          "FormalName": "IEC 62196-2",
          "IsDiscontinued": false,
          "IsObsolete": false,
          "ID": 1036,
          "Title": "Type 2 (Tethered Connector) "
        },
        "Reference": null,
        "StatusTypeID": 50,
        "StatusType": {
          "IsOperational": true,
          "IsUserSelectable": true,
          "ID": 50,
          "Title": "Operational"
        },
        "LevelID": 3,
        "Level": {
          "Comments": "40KW and Higher",
          "IsFastChargeCapable": true,
          "ID": 3,
          "Title": "Level 3:  High (Over 40kW)"
        },
        "Amps": null,
        "Voltage": null,
        "PowerKW": 43.0,
        "CurrentTypeID": 20,
        "CurrentType": {
          "Description": "Alternating Current - Three Phase",
          "ID": 20,
          "Title": "AC (Three-Phase)"
        },
        "Quantity": 2,
        "Comments": null
      },
      {
        "ID": 143851,
        "ConnectionTypeID": 33,
        "ConnectionType": {
          "FormalName": "IEC 62196-3 Configuration FF",
          "IsDiscontinued": false,
          "IsObsolete": false,
          "ID": 33,
          "Title": "CCS (Type 2)"
        },
        "Reference": null,
        "StatusTypeID": 50,
        "StatusType": {
          "IsOperational": true,
          "IsUserSelectable": true,
          "ID": 50,
          "Title": "Operational"
        },
        "LevelID": 3,
        "Level": {
          "Comments": "40KW and Higher",
          "IsFastChargeCapable": true,
          "ID": 3,
          "Title": "Level 3:  High (Over 40kW)"
        },
        "Amps": null,
        "Voltage": null,
        "PowerKW": 50.0,
        "CurrentTypeID": 30,
        "CurrentType": {
          "Description": "Direct Current",
          "ID": 30,
          "Title": "DC"
        },
        "Quantity": 2,
        "Comments": null
      }
    ],
    "NumberOfPoints": 2,
    "GeneralComments": "Access hours: 7:00 to 19:00. Free Parking.",
    "DatePlanned": null,
    "DateLastConfirmed": null,
    "StatusTypeID": 50,
    "DateLastStatusUpdate": "2019-06-20T05:34:00Z",
    "MetadataValues": null,
    "DataQualityLevel": 1,
    "DateCreated": "2018-04-14T05:17:00Z",
    "SubmissionStatusTypeID": 200
  },
  {
    "DataProvider": {
      "WebsiteURL": "http://openchargemap.org",
      "Comments": null,
      "DataProviderStatusType": {
        "IsProviderEnabled": true,
        "ID": 1,
        "Title": "Manual Data Entry"
      },
      "IsRestrictedEdit": false,
      "IsOpenDataLicensed": true,
      "IsApprovedImport": true,
      "License": "Licensed under Creative Commons Attribution 4.0 International (CC BY 4.0)",
      "DateLastImported": null,
      "ID": 1,
      "Title": "Open Charge Map Contributors"
    },
    "OperatorInfo": {
      "WebsiteURL": null,
      "Comments": "For use when the operator of the equipment is a single business owner connected to the location and equipment is not part of a larger network",
      "PhonePrimaryContact": null,
      "PhoneSecondaryContact": null,
      "IsPrivateIndividual": false,
      "AddressInfo": null,
      "BookingURL": null,
      "ContactEmail": null,
      "FaultReportEmail": null,
      "IsRestrictedEdit": null,
      "ID": 45,
      "Title": "(Business Owner at Location)"
    },
    "UsageType": {
      "IsPayAtLocation": null,
      "IsMembershipRequired": null,
      "IsAccessKeyRequired": null,
      "ID": 1,
      "Title": "Public"
    },
    "StatusType": {
      "IsOperational": true,
      "IsUserSelectable": true,
      "ID": 50,
      "Title": "Operational"
    },
    "SubmissionStatus": {
      "IsLive": true,
      "ID": 200,
      "Title": "Submission Published"
    },
    "UserComments": null,
    "PercentageSimilarity": null,
    "MediaItems": null,
    "IsRecentlyVerified": false,
    "DateLastVerified": "2019-12-08T11:44:00Z",
    "ID": 101902,
    "UUID": "D06939EA-CFD1-4E52-93D8-A8A065198F66",
    "ParentChargePointID": null,
    "DataProviderID": 1,
    "DataProvidersReference": null,
    "OperatorID": 45,
    "OperatorsReference": null,
    "UsageTypeID": 1,
    "UsageCost": "Free",
    "AddressInfo": {
      "ID": 102248,
      "Title": "Evesham Country Park",
      "AddressLine1": "Evesham Country Park",
      "AddressLine2": null,
      "Town": "Evesham",
      "StateOrProvince": null,
      "Postcode": "WR11 4TP",
      "CountryID": 1,
      "Country": {
        "ISOCode": "GB",
        "ContinentCode": "EU",
        "ID": 1,
        "Title": "United Kingdom"
      },
      "Latitude": 52.11576564775613,
      "Longitude": -1.938842957008319,
      "ContactTelephone1": null,
      "ContactTelephone2": null,
      "ContactEmail": null,
      "AccessComments": null,
      "RelatedURL": null,
      "Distance": 2.3367111100884452,
      "DistanceUnit": 2
    },
    "Connections": [
      {
        "ID": 143865,
        "ConnectionTypeID": 25,
        "ConnectionType": {
          "FormalName": "IEC 62196-2 Type 2",
          "IsDiscontinued": false,
          "IsObsolete": false,
          "ID": 25,
          "Title": "Type 2 (Socket Only)"
        },
        "Reference": null,
        "StatusTypeID": 50,
        "StatusType": {
          "IsOperational": true,
          "IsUserSelectable": true,
          "ID": 50,
          "Title": "Operational"
        },
        "LevelID": 2,
        "Level": {
          "Comments": "Over 2 kW, usually non-domestic socket type",
          "IsFastChargeCapable": false,
          "ID": 2,
          "Title": "Level 2 : Medium (Over 2kW)"
        },
        "Amps": 32,
        "Voltage": 230,
        "PowerKW": 7.0,
        "CurrentTypeID": 10,
        "CurrentType": {
          "Description": "Alternating Current - Single Phase",
          "ID": 10,
          "Title": "AC (Single-Phase)"
        },
        "Quantity": 4,
        "Comments": null
      }
    ],
    "NumberOfPoints": 4,
    "GeneralComments": "Access hours: 7:00 to 19:00. Free Parking.",
    "DatePlanned": null,
    "DateLastConfirmed": null,
    "StatusTypeID": 50,
    "DateLastStatusUpdate": "2019-12-08T11:44:00Z",
    "MetadataValues": null,
    "DataQualityLevel": 1,
    "DateCreated": "2018-04-14T12:35:00Z",
    "SubmissionStatusTypeID": 200
  }
]

I’ve put the following in my configuration.yaml

rest: !include rest.yaml

then put this into my rest.yaml

  resource: ************
  method: GET
  scan_interval: 60 
  sensor:
    - name: "evcharger1"
      json_attributes_path: "$.UsageType]"
      value_template: '{{ value_json[0]["UsageType"]}}'
      json_attributes:
        - IsPayAtLocation
        - IsMembershipRequired
        - IsAccessKeyRequired
        - Title

Currently I can see the evcharger1 sensor but it just shows OK and I can’t see any attributes on it. Pretty sure I’m missing something obvious.

This

json_attributes_path: "$.UsageType]"

Probably needs to be:

json_attributes_path: "$[0].UsageType"

thanks for the swift reply @tom_l , that’s done it.

evchargers1 is now showing with all the different values - now to break it all down into separate sensors

If you use the restful integration rather than the restful sensor platform you can create all the sensors with one call to the resource and no extra template sensors:

The example shown in the docs is rather poor and focusses on attributes, but each of the value templates can create a sensor (all the ones shown in the example just return “OK”).

I’ll have a go at getting my head around that!

Post here if you need help.