Offbeat Iot
Get started
Using the time integration

Using the time integration

The time command returns the current time to your device. It is a built-in service, so no account linking is required.

Send the time query from your device over the websocket and read the time.response command that the server sends back.

Contexts

Clock

Get the current time

Returns the current time formatted for the zone resolved from the request. When no parameters are supplied the server uses the zone derived from the request (device IP if resolvable, otherwise UTC).

Request
{
  "time" : { }
}
Response
{
  "time.response" : {
    "offset" : "Z",
    "timezone" : "Z",
    "epoch" : 1788186600,
    "time" : "2026-08-31T14:30:00"
  },
  "endpointId" : "test-endpoint-id"
}
Get the current time in an explicit timezone

Returns the current time in the supplied IANA timezone. The timezone parameter always wins over country and IP-based resolution.

Request
{
  "time" : {
    "timezone" : "Europe/Berlin"
  }
}
Response
{
  "time.response" : {
    "offset" : "+02:00",
    "timezone" : "Europe/Berlin",
    "epoch" : 1788186600,
    "time" : "2026-08-31T16:30:00"
  },
  "endpointId" : "test-endpoint-id"
}
Get the current time for a country

Returns the current time in the default timezone for the supplied ISO-3166 alpha-2 country code.

Request
{
  "time" : {
    "country" : "DE"
  }
}
Response
{
  "time.response" : {
    "offset" : "+02:00",
    "timezone" : "Europe/Berlin",
    "epoch" : 1788186600,
    "time" : "2026-08-31T16:30:00"
  },
  "endpointId" : "test-endpoint-id"
}

If the country code is unknown, the server falls back to UTC.

Request (unknown country)
{
  "time" : {
    "country" : "QQ"
  }
}
Response (unknown country)
{
  "time.response" : {
    "offset" : "Z",
    "timezone" : "Z",
    "epoch" : 1788186600,
    "time" : "2026-08-31T14:30:00"
  },
  "endpointId" : "test-endpoint-id"
}
Get the current time from the device IP

When no timezone or country is supplied, the server resolves the country from the device IP address and uses that country’s default timezone. When the IP cannot be resolved, the server falls back to UTC.

Request
{
  "time" : { }
}
Response
{
  "time.response" : {
    "offset" : "+03:00",
    "timezone" : "Europe/Athens",
    "epoch" : 1788186600,
    "time" : "2026-08-31T17:30:00"
  },
  "endpointId" : "test-endpoint-id"
}
Format presets and patterns

The format parameter accepts a simple preset name or a raw Java DateTimeFormatter pattern. Presets:

  • iso - ISO-8601 local date-time (default), e.g. 2026-08-31T14:30:00

  • date - yyyy-MM-dd, e.g. 2026-08-31

  • time - HH:mm:ss, e.g. 14:30:00

  • datetime - yyyy-MM-dd HH:mm:ss, e.g. 2026-08-31 14:30:00

  • rfc1123 - RFC-1123, e.g. Mon, 31 Aug 2026 16:30:00 +0200

An invalid pattern or preset is ignored and no response is sent.

Request using the date preset
{
  "time" : {
    "country" : "DE",
    "format" : "date"
  }
}
Response using the date preset
{
  "time.response" : {
    "offset" : "+02:00",
    "timezone" : "Europe/Berlin",
    "epoch" : 1788186600,
    "time" : "2026-08-31"
  },
  "endpointId" : "test-endpoint-id"
}
Request using the time preset
{
  "time" : {
    "timezone" : "Europe/Berlin",
    "format" : "time"
  }
}
Response using the time preset
{
  "time.response" : {
    "offset" : "+02:00",
    "timezone" : "Europe/Berlin",
    "epoch" : 1788186600,
    "time" : "16:30:00"
  },
  "endpointId" : "test-endpoint-id"
}
Request using the datetime preset
{
  "time" : {
    "timezone" : "Europe/Berlin",
    "format" : "datetime"
  }
}
Response using the datetime preset
{
  "time.response" : {
    "offset" : "+02:00",
    "timezone" : "Europe/Berlin",
    "epoch" : 1788186600,
    "time" : "2026-08-31 16:30:00"
  },
  "endpointId" : "test-endpoint-id"
}
Request using the iso preset
{
  "time" : {
    "timezone" : "Europe/Berlin",
    "format" : "iso"
  }
}
Response using the iso preset
{
  "time.response" : {
    "offset" : "+02:00",
    "timezone" : "Europe/Berlin",
    "epoch" : 1788186600,
    "time" : "2026-08-31T16:30:00"
  },
  "endpointId" : "test-endpoint-id"
}
Request using the rfc1123 preset
{
  "time" : {
    "timezone" : "Europe/Berlin",
    "format" : "rfc1123"
  }
}
Response using the rfc1123 preset
{
  "time.response" : {
    "offset" : "+02:00",
    "timezone" : "Europe/Berlin",
    "epoch" : 1788186600,
    "time" : "Mon, 31 Aug 2026 16:30:00 +0200"
  },
  "endpointId" : "test-endpoint-id"
}
Request using a raw pattern
{
  "time" : {
    "format" : "HH:mm"
  }
}
Response using a raw pattern
{
  "time.response" : {
    "offset" : "Z",
    "timezone" : "Z",
    "epoch" : 1788186600,
    "time" : "14:30"
  },
  "endpointId" : "test-endpoint-id"
}
Localized output

The locale parameter takes a BCP-47 language tag and is applied when the format uses locale-sensitive fields such as month or day names.

Request
{
  "time" : {
    "country" : "DE",
    "format" : "EEEE",
    "locale" : "de"
  }
}
Response
{
  "time.response" : {
    "offset" : "+02:00",
    "timezone" : "Europe/Berlin",
    "epoch" : 1788186600,
    "time" : "Montag"
  },
  "endpointId" : "test-endpoint-id"
}
Server-sent notifications

The time integration has no server notifications. The server only responds to a device time query with a time.response command.

Examples