Synchronize Buildings and Devices

Synchronize Buildings

Make sure all buildings, which shall be taken into consideration by the MOOST Recommender Platform, are synchronized to MOOST. I.e. new buildings shall be created, and changed building states shall be updated (incl. deactivation and reactivation) via MOOST API.

Building Data Structure

Following example depicts a data structure of a building located in Dresden, with a couple of connected devices, with dual tariff.

{
  "id": "66d07a7fd51e3528aa5673ba",
  "customerId": "656730be2bc9719e6e5ed51d",
  "customerBuildingId": "99900000C048ADA6",
  "zip": "01067",
  "city": "Dresden",
  "countryCode": "DE",
  "registrationTimestamp": 1645630735,
  "isEarlyAdopter": false,
  "devices": [
    {
      "id": "656830efc4515778b1ce4f2f",
      "type": "CAR",
      "product_name": "Device Link Car",
      "createdAt": 1701327087,
      "updatedAt": 1724896211,
      "soc": 45
    },
    {
      "id": "621660e410c1012648d7bed2",
      "type": "CAR_CHARGER",
      "product_name": "easee Home",
      "createdAt": 1645633761,
      "updatedAt": 1724936865,
      "chargingTargetSoc": 100,
      "chargingTargetSocTimestamp": 1720238400,
      "chargingMode": 5
    },
    {
      "id": "621656d8777d12261e8f866d",
      "type": "INVERTER",
      "product_name": "SolarEdge SE",
      "createdAt": 1645631192,
      "updatedAt": 1724749114
    },
    {
      "id": "6216248d10c1012648d7bee2",
      "type": "SMART_METER",
      "product_name": "sonnenBatterieSM",
      "createdAt": 1645634701,
      "updatedAt": 1724893400
    },
    {
      "id": "623201c48a137f405fefb795",
      "type": "SMART_PLUG",
      "product_name": "MyStrom Switch",
      "createdAt": 1647444425,
      "updatedAt": 1724936914,
      "chargingMode": 5
    },
    {
      "id": "6220d1ef1051012648d7c2c1",
      "type": "HEAT_PUMP",
      "product_name": "Hoval WP",
      "createdAt": 1646318063,
      "updatedAt": 1724749125,
      "chargingMode": 4
    },
    {
      "id": "62165b47989b3626707a5b3f",
      "type": "BATTERY",
      "product_name": "sonnenBatterie",
      "createdAt": 1645632327,
      "updatedAt": 1724906039
    },
    {
      "id": "626258311f2abe67c56ce90b",
      "type": "SWITCH",
      "product_name": "Smart-me Relais",
      "createdAt": 1650612273,
      "updatedAt": 1724936911
    },
    {
      "id": "643bbe11478c9b43d7338519",
      "type": "ENERGY_MEASUREMENT",
      "product_name": "Shelly 3EM",
      "createdAt": 1681636881,
      "updatedAt": 1724889701
    }
  ],
  "settings": {
    "tariff": {
      "type": "DUAL",
      "minPrice": "0.296",
      "maxPrice": "0.385",
      "currency": "EUR",
      "dual": {
        "lowTariff": {
          "mondayStartTime": "19:00",
          "mondayEndTime": "07:00",
          "tuesdayStartTime": "19:00",
          "tuesdayEndTime": "07:00",
          "wednesdayStartTime": "19:00",
          "wednesdayEndTime": "07:00",
          "thursdayStartTime": "19:00",
          "thursdayEndTime": "07:00",
          "fridayStartTime": "19:00",
          "fridayEndTime": "07:00",
          "saturdayStartTime": "00:00",
          "saturdayEndTime": "07:00",
          "sundayStartTime": "00:00",
          "sundayEndTime": "07:00"
        }
      }
    }
  }
}

Data Structure Attributes

Attribute Name
Description

id

The building ID on MOOST side (is generated when inserting a new building)

customerBuildingId

The building ID on customer side

customerId

The ID of the customer (cannot be set or changed)

zip

Postal code

city

Name of the city

countryCode

registrationTimestamp

Time (Epoch Time in seconds (UTC)) when the building was registered

deactivatedTimestamp

If building has been deregistered, and shall no longer receive notifications, then this attribute is set, and contains Epoch Time in seconds (UTC)

isEarlyAdopter

If building is marked as early adopters, then he/she also receives notifications of rules marked for "Early Adopter" (these are typically new designed rules which shall be tested on a small user (aka building) base.

devices

List of devices. Each device mainly contains following attributes

  • id,

  • product_name

settings.tariff

You may add tariff data of a building. If dual or dynamic tariff settings are defined, then MOOST is able to generate additional tariff related events. The tariff sub-structures are explained in table cells below. Remark: attributes "currency", "minPrice" and "maxPrice" are optional.

Single tariff settings

Dual tariff settings: defines the low-tariff time for a whole week.

Dynamic tariff settings: defines the dynamic tariff slices for the next couple of hours (typically for 1 - 2 days)

Remark: when reading building data, there might be additional attributes set, such as profile or geolocation. These fields are calculated by MOOST and is not to be modified by the customer.

Load Buildings

Example with CURL

# make sure ACCESS_TOKEN is set and valid (see "Request Access Token")
curl -X GET "https://api.moost.io/buildings/v1" \
     -H "Authorization: Bearer $ACCESS_TOKEN"

Load a Building

Example with CURL

curl -X GET "https://api.moost.io/buildings/999000009C54AEDC/v1" \
     -H "Authorization: Bearer $ACCESS_TOKEN"

Add a Building

Example with CURL

curl -X POST "https://api.moost.io/buildings/v1" \
     -H  "Authorization: Bearer $ACCESS_TOKEN" \
     -H  "Content-Type: application/json" \
     -d "{\"customerBuildingId\":\"999000009C54AAAB\",\"customerId\":\"656730be2bc9719e6e5ed51d\",\"zip\":\"8010\",\"city\":\"Graz\",\"countryCode\":\"AT\",\"devices\":[],\"settings\":{\"lowTariffHourSetting\":{\"mondayStartTime\":\"20:00\",\"mondayEndTime\":\"07:00\",\"tuesdayStartTime\":\"20:00\",\"tuesdayEndTime\":\"07:00\",\"wednesdayStartTime\":\"20:00\",\"wednesdayEndTime\":\"07:00\",\"thursdayStartTime\":\"20:00\",\"thursdayEndTime\":\"07:00\",\"fridayStartTime\":\"20:00\",\"fridayEndTime\":\"07:00\",\"saturdayStartTime\":\"13:00\",\"saturdayEndTime\":\"07:00\",\"sundayStartTime\":\"00:00\",\"sundayEndTime\":\"07:00\"}},\"registrationTimestamp\":1549971011,\"customerSubscriptionName\":\"Premium\"}"

Adjust a Building

Example with CURL

curl -X PUT "https://api.moost.io/buildings/v1" \
     -H  "Authorization: Bearer $ACCESS_TOKEN" \
     -H  "Content-Type: application/json" \
     -d "{\"customerBuildingId\":\"999000009C54AAAA\",\"customerId\":\"656730be2bc9719e6e5ed51d\",\"zip\":\"8020\",\"city\":\"Graz\",\"countryCode\":\"AT\",\"devices\":[],\"settings\":{\"lowTariffHourSetting\":{\"mondayStartTime\":\"20:00\",\"mondayEndTime\":\"07:00\",\"tuesdayStartTime\":\"20:00\",\"tuesdayEndTime\":\"07:00\",\"wednesdayStartTime\":\"20:00\",\"wednesdayEndTime\":\"07:00\",\"thursdayStartTime\":\"20:00\",\"thursdayEndTime\":\"07:00\",\"fridayStartTime\":\"20:00\",\"fridayEndTime\":\"07:00\",\"saturdayStartTime\":\"13:00\",\"saturdayEndTime\":\"07:00\",\"sundayStartTime\":\"00:00\",\"sundayEndTime\":\"07:00\"}},\"registrationTimestamp\":1549971011,\"customerSubscriptionName\":\"Premium\"}"

Delete a Building

Example with CURL

curl -X DELETE "https://api.moost.io/buildings/999000009C54AAAB/v1" \
     -H "Authorization: Bearer $ACCESS_TOKEN"

Synchronize Devices of Buildings

Make sure that devices of buildings, which shall be taken into consideration by MOOST Recommender Platform, are synchronized to MOOST via MOOST API.

Remark: it is also possible to manage the devices via the upper mentioned building API's.

Update Devices of a Building

Example with CURL

curl -X PUT "https://api.moost.io/buildings/999000009C54AAAA/devices/v1" \
    -H  "Authorization: Bearer $ACCESS_TOKEN" \
    -H  "Content-Type: application/json"  \
    -d "[{\"id\": \"17306deb97e0f94609f13e22\", \"type\": \"CAR\", \"vendor_name\": \"Device Link Car\", \"product_name\": \"Device Link Car\", \"createdAt\": 1702981099,\"updatedAt\": 1707135597}, {\"id\": \"1730da2d6e14aa3701e65105\", \"type\": \"HEAT_PUMP\", \"vendor_name\": \"SG Ready Switch\", \"product_name\": \"SG Ready Switch\", \"createdAt\": 1665915437,\"updatedAt\": 1707124897}, {\"id\": \"173042c71376cf79c2dc8bde\", \"type\": \"BATTERY\", \"vendor_name\": \"TWICE Hexagon\", \"product_name\": \"TWICE Hexagon\", \"createdAt\": 1697727175,\"updatedAt\": 1707144323}, {\"id\": \"173062ba52ae9f481a010aa9\", \"type\": \"CAR_CHARGER\", \"vendor_name\": \"easee Home\", \"product_name\": \"easee Home\", \"createdAt\": 1617388218,\"updatedAt\": 1707144356}]"

Last updated

© 2023 MOOST AG