HA API and array - id are randomized on startup

Hello,

I use the Home Assistant REST API to fetch data for my custom built HTML dashboard to be casted to a Chromecast. All this works fine, but I have a issue.

The output of /api/states (array) and devices are categoried by numbers, but these numbers are somewhat randomized during each startup, and that is quite tedious work to identify them and change the ID each time i reload/restart HA.

Example output of /apI/states (component 43, 44 and 45):

  }
  [43]=>
  array(6) {
    ["attributes"]=>
    array(2) {
      ["friendly_name"]=>
      string(15) "Inngang kjeller"
      ["icon"]=>
      string(8) "mdi:door"
    }
    ["context"]=>
    array(3) {
      ["id"]=>
      string(32) "beff31127653458ab8788a7da6935e28"
      ["parent_id"]=>
      NULL
      ["user_id"]=>
      NULL
    }
    ["entity_id"]=>
    string(29) "binary_sensor.inngang_kjeller"
    ["last_changed"]=>
    string(32) "2019-10-24T16:03:34.028234+00:00"
    ["last_updated"]=>
    string(32) "2019-10-24T16:03:34.028234+00:00"
    ["state"]=>
    string(3) "off"
  }
  [44]=>
  array(6) {
    ["attributes"]=>
    array(2) {
      ["friendly_name"]=>
      string(15) "Isabella window"
      ["icon"]=>
      string(17) "mdi:window-closed"
    }
    ["context"]=>
    array(3) {
      ["id"]=>
      string(32) "cf1bb3ff802c49c7b5accf563e72660c"
      ["parent_id"]=>
      NULL
      ["user_id"]=>
      NULL
    }
    ["entity_id"]=>
    string(28) "binary_sensor.vindu_isabella"
    ["last_changed"]=>
    string(32) "2019-10-22T20:47:57.766876+00:00"
    ["last_updated"]=>
    string(32) "2019-10-22T20:47:57.766876+00:00"
    ["state"]=>
    string(3) "off"
  }
  [45]=>
  array(6) {
    ["attributes"]=>
    array(2) {
      ["friendly_name"]=>
      string(21) "Kjøkkenvindu venstre"
      ["icon"]=>
      string(17) "mdi:window-closed"
    }
    ["context"]=>
    array(3) {
      ["id"]=>
      string(32) "c4e0f2cc0817430c878b5aabb9721d74"
      ["parent_id"]=>
      NULL
      ["user_id"]=>
      NULL
    }
    ["entity_id"]=>
    string(34) "binary_sensor.kjokkenvindu_venstre"
    ["last_changed"]=>
    string(32) "2019-10-22T20:47:57.768447+00:00"
    ["last_updated"]=>
    string(32) "2019-10-22T20:47:57.768447+00:00"
    ["state"]=>
    string(3) "off"
  }

Is there a way to make these identifyable, or even not random? I know I could fetch /api/compontent directly, but then it would be a lot of queries.

Pardon if this is quite obvious, im not a coder :sweat_smile: