raw json data 

JSON Structure for a List of Objects:

[
  {
    "key1": "value1",
    "key2": "value2",
    "key3": "value3"
  },
  {
    "key1": "valueA",
    "key2": "valueB",
    "key3": "valueC"
  },
  {
    "key1": "valueX",
    "key2": "valueY",
    "key3": "valueZ"
  }
]

 

Create the Entity

/data/homeassistant202405/configuration.yaml

#
# ----------------------------------- rest -----------------------------------
#
rest:
  - resource: https://github.com/NateScarlet/holiday-cn/blob/master/2025.json
    scan_interval: 86400   # Refresh once per day
    sensor:
      - name: "ChinaHoliday"
        value_template: "{{ value_json.days | length }}"
        json_attributes_path: "$"
        json_attributes:
          - days

 

Usage in Home Assistant Automations:

 

 

 

Comments


Comments are closed