# Bobbie

### Get sensor data

*Request URL:*

```
POST /provider/fetch
```

*Headers:*

```
Content-Type: application/json
Authorization: Bearer {access_token}
```

*Body*:

```
{
  "serial_number" : "{Bobbie Serial Number}"
}
```

*Response:*

```
{
    "provider": {
        "cold": 26.490346029707, //value of the cold pipe temperature sensor in celsius
        "hot": 32.514830800359, //value of the hot pipe temperature sensor in celsius
        "home": 27.252545430612, //value of the ambient temperature sensor in celsius
        "energy": 0.10849291444, //electrical energy in kWh
        "voltage": 232.76088205096, //value of measured voltage in V
        "current": 12.254590367881, //value of electrical current in A
        "relay_state": 1, //state of the relay (1 - on, 0 - off)
        "load": true //indicator of load (boolean value)
    },
    "_links": {
        "self": {
            "href": "/v1/provider/fetch"
        }
    }
}
```

### Control relay state (turn Bobbie on/off)

*Request URL:*

```
POST /provider/send
```

*Headers:*

```
Content-Type: application/json
Authorization: Bearer {access_token}
```

*Body*:

```
{
  "serial_number": “{Bobbie Serial Number}”,
  "command" : "switch_on_off",
  "state" : "on"  //receives values “on”/“off”
}
```

*Response:*

```
{
  "provider": [
    254,
    2,
    0,
    0
  ],
  "_links": {
    "self": {
      "href": "/v1/provider/send"
    }
  }
}
```

### Default State

*Request URL:*

```
POST /provider/send
```

*Headers:*

```
Content-Type: application/json
Authorization: Bearer {access_token}
```

*Body*:

```
{
  "serial_number": “{Bobbie Serial Number}”,
  "command" : "default_state",
  "state" : 2  // 0-OFF, 1-ON, 2-DO NOTHING
}
```

*Response:*

```
{
  "provider": [
      254,
      16,
      0,
      0
  ],
  "_links": {
      "self": {
          "href": "/v1/provider/send"
      }
  }
}
```

### Turning OFF/ON the LED light

*Request URL:*

```
POST /provider/send
```

*Headers:*

```
Content-Type: application/json
Authorization: Bearer {access_token}
```

*Body*:

```
{
  "serial_number": “{Bobbie Serial Number}”,
  "command" : "led_on_off",
  "state" : 1  // 0-OFF, 1-ON
}
```

*Response:*

```
{
  "provider": [
      254,
      12,
      0,
      0
  ],
  "_links": {
      "self": {
          "href": "/v1/provider/send"
      }
  }
}
```

##
