Understanding Networks: IOT Device Design

Posted on
understanding_networks iot

I’m working with Jackie Liu for an IOT assignment.

Our first assignment is to design a web api and a physical interface for the an app. Another working pair will implement our idea.

Our idea is for a digital pet.

App

The application simulates a pet. The pet has a state with several attributes.

  • Hunger satisfaction: how satisfied is the pet’s hunger?
  • Love satisfaction: How much love does the pet have?
  • Cleanliness: How clean is the pet?

All attribute values start at 0 and max out at 10. The attributes deteriorate after a predetermined time interval, eg every hour.

There is also an “overall happiness” metric. It is the sum of the hunger, love, and cleanliness levels, out of the total number of 30 points. For example if we have hunger = 410, love = 210, cleanliness = 910, overall happiness will be 1530.

Web API endpoints

/pet

A GET endpoint that returns a JSON object describing the state of the pet.

{ 
    "hunger": 1,
    "love": 0.5, 
    "cleanliness": 10,
    "happiness": 0.383
}

Trigger endpoints

  • /hunger
  • /love
  • /cleanliness

Requests to these endpoints should trigger a modification of the state mapping to that end point. e.g. calling /hunger should decrease hunger by some amount.

Physical Avatar

A physical avatar communicating the state of the simulation

Web client

A web client to provide users with an easy way to trigger API calls.

A simple web page with three buttons, one for each trigger endpoint.