Pattern Scroll

Pattern scrolls are where we made a determination using the magic of machine learning whether something is off pattern. So, it’s like the results of a pattern spell we’ve cast from reading a scroll versus memorizing it, and it’s cast on our machine. Yeah, we’ve played too much D&D. Oh well.

eranaAPI.views_pattern_scroll.patternScrollsList(self, request, *args, **kwargs)
GET /api/v1/pattern-scrolls/

Pattern scrolls are where we store the off-pattern events that transpired based on our machine learning.

Returns
[
   {
       "id": 1,
       "item": {
           "id": 1,
           "castle": {
             "id": 1,
             "name": "Speilburg Castle",
             "homekit_id": "Steve & Steve's Homekit id",
             "is_primary": true,
             "room_id": 1
           },
           "room": {
             "id": 1,
             "name": "Secret Passageway",
             "is_occupied": true,
           },
           "access_token": "Healing Potion",
           "energy_watts": 1210000000.0,
           "ip_address": "192.168.0.2",
           "is_active": false,
           "is_activated": false,
           "is_on": true,
           "is_reachable": false,
           "item_type": "game_item",
           "latest_mana_level": 42.0,
           "manufacturer": "Healing Hut",
           "name": "Healing Potion",
           "unique_id": "00:11:22:33:44:55"
       },
       "event_time": "2020-09-13T19:00:09.174033Z",
       "expected_status": "on",
       "actual_status": "off"
       }
   }
]
Raises
400 on bad request
Return type
Collection (Array of Objects)
eranaAPI.views_pattern_scroll.patternScrollDetail(self, request, *args, **kwargs)
GET /api/v1/pattern-scroll/<str:pk>/

This gets the details of one pattern scroll.

Parameters
pk (string) – REQUIRED. This is the id of the pattern scroll we want from database. Place in the URL string.
Returns
    {
       "id": 1,
       "item": {
           "id": 1,
           "castle": {
             "id": 1,
             "name": "Speilburg Castle",
             "homekit_id": "Steve & Steve's Homekit id",
             "is_primary": true,
             "room_id": 1
           },
           "room": {
             "id": 1,
             "name": "Secret Passageway",
             "is_occupied": true,
           },
           "access_token": "Healing Potion",
           "energy_watts": 1210000000.0,
           "ip_address": "192.168.0.2",
           "is_active": false,
           "is_activated": false,
           "is_on": true,
           "is_reachable": false,
           "item_type": "game_item",
           "latest_mana_level": 42.0,
           "manufacturer": "Healing Hut",
           "name": "Healing Potion",
           "unique_id": "00:11:22:33:44:55"
       },
       "event_time": "2020-09-13T19:00:09.174033Z",
       "actual_status": "off",
       "expected_status": "on"
       }
   }
Raises
400 on bad request
Return type
Collection (Array of Objects)
eranaAPI.views_pattern_scroll.patternScrollsCreate(self, request, *args, **kwargs)
GET /api/v1/pattern-scrolls-create/
This creates a pattern scroll or pattern scrolls from digital nothingness. It must always be bundled as a collection.
Parameters
  • expected_status(string) – What we expected the status to be based on our ML magic
  • actual_status (string) – What the user or system actually did
  • item (integer) –The item we’re performing the magic on
[
   {
       "expected_status": "on",
       "actual_status": "off,
       "item":  1
   }
]
Returns
[
   {
       "id": 1,
       "item": {
           "id": 1,
           "castle": {
             "id": 1,
             "name": "Speilburg Castle",
             "homekit_id": "Steve & Steve's Homekit id",
             "is_primary": true,
             "room_id": 1
           },
           "room": {
             "id": 1,
             "name": "Secret Passageway",
             "is_occupied": true,
           },
           "access_token": "Healing Potion",
           "energy_watts": 1210000000.0,
           "ip_address": "192.168.0.2",
           "is_active": false,
           "is_activated": false,
           "is_on": true,
           "is_reachable": false,
           "item_type": "game_item",
           "latest_mana_level": 42.0,
           "manufacturer": "Healing Hut",
           "name": "Healing Potion",
           "unique_id": "00:11:22:33:44:55"
       },
       "event_time": "2020-09-13T19:00:09.174033Z",
       "actual_status": "off",
       "expected_status": "on"
       }
   }
]
Raises
400 on bad request
Return type
Collection (Array of Objects)
eranaAPI.views_pattern_scroll.pattern_scrollsUpdate(self, request, *args, **kwargs)
PATCH /api/v1/pattern-scrolls-update/
This updates a pattern scroll. It must always be bundled as a collection. You really shouldn’t need to do this one… ever. That is, unlike life, there is almost never a need to change our perception of the past.
Parameters
id (integer) – REQUIRED. This database id of our pattern scroll(s) must always be included.
[
   {
       "actual_status": "on",
       "expected_status": "off",
       "id":  1
   }
]
Returns
[
   {
       "id": 1,
       "item": {
           "id": 1,
           "castle": {
             "id": 1,
             "name": "Speilburg Castle",
             "homekit_id": "Steve & Steve's Homekit id",
             "is_primary": true,
             "room_id": 1
           },
           "room": {
             "id": 1,
             "name": "Secret Passageway",
             "is_occupied": true,
           },
           "access_token": "Healing Potion",
           "energy_watts": 1210000000.0,
           "ip_address": "192.168.0.2",
           "is_active": false,
           "is_activated": false,
           "is_on": true,
           "is_reachable": false,
           "item_type": "game_item",
           "latest_mana_level": 42.0,
           "manufacturer": "Healing Hut",
           "name": "Healing Potion",
           "unique_id": "00:11:22:33:44:55"
       },
       "event_time": "2020-09-13T19:00:09.174033Z",
       "actual_status": "on",
       "expected_status": "off"
       }
   }
]
Raises
400 on bad request
Return type
Collection (Array of Objects)
eranaAPI.views_pattern_scroll.patternScrollsDelete(self, request, *args, **kwargs)
DELETE /api/v1/pattern-scrolls-delete/

All good things must come to an end. It must always be bundled as a collection.

Parameters
id (integer) – REQUIRED. This database id of our pattern_scroll(s) must always be included.
[
   {
       "id": 1
   }
]
Returns
Confirmation of our pattern scroll(s) deletion.
"Pattern Scroll(s) successfully deleted!"
Raises
400 on bad request
Return type
String