Skip to main content

Configure Thresholds

The sensor measures all the time, but it sends data to our servers in batches. The data you read from the API can be some minutes old.

Thresholds solve this. When a measurement crosses a threshold, the sensor contacts the servers at once. What happens next depends on the type of measurement and your settings.

You can set thresholds for sound level, temperature and humidity.

Sound level​

The sound level threshold controls when noise monitoring events start. Set the dBA level and the duration on the device.

Single threshold​

import axios from 'axios';

const dbLevel = 75
const durationSeconds = 600

const body = {
"reactions": [
{
"type": "sound_level_high",
"notifications": [],
"value": dbLevel,
"duration_seconds": durationSeconds
}
]
}

const response = await axios.put(
'https://api.minut.com/v8/devices/<DEVICE_ID>',
body,
{
headers: {
Authorization: `Bearer ${accessToken}`,
},
})

Quiet hours​

import axios from 'axios';

const dbLevel = 65
const durationSeconds = 600
// These two are the HH:MM format in the local timezone of the home
// that the device is in.
const quietHoursStart = '22:00'
const quietHoursEnd = '07:00'

const body = {
"reactions": [
{
"type": "sound_level_high_quiet_hours",
"notifications": [],
"value": dbLevel,
"duration_seconds": durationSeconds
}
],
"quiet_hours": {
"enabled": true,
"start": quietHoursStart,
"end": quietHoursEnd
}
}

const response = await axios.put(
'https://api.minut.com/v8/devices/<DEVICE_ID>',
body,
{
headers: {
Authorization: `Bearer ${accessToken}`,
},
})

Temperature and humidity​

Temperature and humidity thresholds are set in a climate profile, not on each device.

  • A climate profile belongs to an organization.
  • Each home uses one climate profile, given by climate_profile_id on the home.
  • All devices in a home use the thresholds of the home's profile.
  • Many homes can use the same profile. A change to a profile applies to every home that uses it. Devices get the new thresholds at their next check-in.

A profile has four thresholds. Each one has a value and an enabled switch:

FieldUnitRangeDefault
temperature.low°C-50 to 100, rounded to 0.2515, enabled
temperature.high°C-50 to 100, rounded to 0.2530, enabled
humidity.low% RH0 to 1000, enabled (0 never alerts)
humidity.high% RH0 to 10070, enabled

low.value must be below high.value. If not, the API returns 400 invalid_thresholds.

Alerts go out only when the home's indoor climate monitoring is on. This stays a per-home setting: PATCH /homes/{home_id}/indoor_climate_monitoring with state.

Only organization owners and admins can create, update or delete climate profiles.

A new organization gets a profile called "Standard indoor climate". You cannot delete the last profile of an organization, so an organization always has at least one.

Almost freezing and mould risk alerts are not part of the profile. You cannot configure them.

List the profiles of an organization​

import axios from 'axios';

const response = await axios.get(
'https://api.minut.com/v8/organizations/<ORGANIZATION_ID>/profiles/climate',
{
headers: {
Authorization: `Bearer ${accessToken}`,
},
})

// response.data.profiles[0].temperature => { low: { enabled: true, value: 15 }, high: { enabled: true, value: 30 } }
const profiles = response.data.profiles;

GET /organizations/{organization_id}/profiles/climate returns the profiles with paging. Use name to search. Each profile has number_of_homes.

Create a profile​

import axios from 'axios';

// Temperatures are in Celsius
// For Fahrenheit: const fToC = (f: number) => (f - 32) * 5 / 9
const body = {
"name": "Winter homes",
"temperature": {
"low": { "enabled": true, "value": 12 },
"high": { "enabled": false, "value": 30 }
},
"humidity": {
"low": { "enabled": false, "value": 0 },
"high": { "enabled": true, "value": 75 }
}
}

const response = await axios.post(
'https://api.minut.com/v8/organizations/<ORGANIZATION_ID>/profiles/climate',
body,
{
headers: {
Authorization: `Bearer ${accessToken}`,
},
})
const profileId = response.data.id;

Fields you leave out get the defaults from the table above.

Change a profile​

import axios from 'axios';

// Only the fields you send change
const body = {
"humidity": {
"high": { "value": 65 }
}
}

const response = await axios.patch(
'https://api.minut.com/v8/organizations/<ORGANIZATION_ID>/profiles/climate/<PROFILE_ID>',
body,
{
headers: {
Authorization: `Bearer ${accessToken}`,
},
})

PATCH /organizations/{organization_id}/profiles/climate/{profile_id}. Fields you leave out keep their current value.

Use a profile for a home​

import axios from 'axios';

const body = {
"climate_profile_id": "<PROFILE_ID>"
}

const response = await axios.patch(
'https://api.minut.com/v8/organizations/<ORGANIZATION_ID>/homes/<HOME_ID>',
body,
{
headers: {
Authorization: `Bearer ${accessToken}`,
},
})

Set climate_profile_id with PATCH /organizations/{organization_id}/homes/{home_id}. The profile must belong to the same organization. If not, the API returns 400.

To set it for many homes at once, use PATCH /organizations/{organization_id}/homes. The name query filters the homes. Without name, all homes in the organization change. A profile of another organization returns 403 unauthorized_for_profile.

import axios from 'axios';

const body = {
"climate_profile_id": "<PROFILE_ID>"
}

// All homes with "North Street" in the name use the profile
const response = await axios.patch(
'https://api.minut.com/v8/organizations/<ORGANIZATION_ID>/homes?name=North%20Street',
body,
{
headers: {
Authorization: `Bearer ${accessToken}`,
},
})
const updatedHomesCount = response.data.updated_homes_count;

To find the homes that use a profile, call GET /organizations/{organization_id}/homes?climate_profile_id={profile_id}.

When you create a home without climate_profile_id, it gets the oldest profile of the organization.

Delete a profile​

DELETE /organizations/{organization_id}/profiles/climate/{profile_id}. You cannot delete:

  • a profile that a home uses (400 cannot_delete_used_profile). Move the homes first.
  • the last profile of the organization (400 cannot_delete_last_profile).

Device settings and climate profiles​

For homes that use a climate profile:

  • GET /devices/{device_id} returns the temperature and humidity reactions from the home's profile.
  • PUT /devices/{device_id} with a home:temperature:* or home:humidity:* reaction that changes a value or the push notification returns 400 with the key climate_setting_on_profile. Nothing in the request is saved. Change the profile instead.
  • If the climate reactions in the request are the same as the profile's values, the API ignores them and saves the rest of the request. A client that sends back what it read keeps working.
  • PATCH /homes/{home_id}/indoor_climate_monitoring with a temperature_enabled or humidity_enabled value that is different from the profile also returns 400 climate_setting_on_profile. A toggle is on when the low or the high threshold of that measurement is enabled in the profile. state still works.
  • Sound level reactions and other device settings do not change.
  • Minut Point (P1) devices keep their own temperature and humidity reactions. PUT /devices still changes them.

Example error:

{
"error": "bad_request",
"error_key": "climate_setting_on_profile",
"message": "Temperature and humidity alerts for this home are now set in its indoor climate profile. Update the Minut app, or change the settings in the indoor climate profile."
}

Migration from device thresholds​

We move organizations to climate profiles in steps. API customers move last. We tell you your date at least 4 weeks before.

When your organization moves:

  • We create profiles from your current device thresholds. Homes with the same thresholds share a profile.
  • If the devices in one home had different thresholds, the home gets the strictest one from the devices that had that alert on: the highest low value and the lowest high value. If that low is not below that high, the home gets the lowest low value and the highest high value from all its devices. P1 devices are not part of this, because they keep their own thresholds.
  • From then on, use the climate profile endpoints. PUT /devices returns 400 for changed temperature and humidity reactions.