Local, no cloud
Talks to the CLU controllers directly on your network, with their own encryption.
Every device
Switches, dimmers, RGB lights, shutters, thermostats, scenes, sensors, cameras, schedules and TV remotes.
Always current
CLUs push every change, so state stays up to date without polling.
Conformance-tested
Implements the Grenton Core specification and passes its conformance suite.
Installation
Add the package to Package.swift (macOS 13+, iOS 16+):
dependencies: [
.package(url: "https://github.com/osieckiAdam/grenton-core-swift.git", from: "0.14.0"),
],
targets: [
.target(name: "MyApp", dependencies: [
.product(name: "GrentonKit", package: "grenton-core-swift"),
]),
]
Download the interface once, then start from the saved copy and list your lights:
import Foundation
import GrentonKit
// Once: Object Manager shows the address and the PIN in "Send to mobile devices".
// The store keeps the archive, and the key inside it, in a protected file.
let store = try InterfaceStore()
if try store.load() == nil {
let archive = try await ProvisioningClient(host: "192.168.1.50").fetchInterfaceArchive(pin: "149 853")
try store.save(archive)
}
// Every start: from the saved archive, no PIN and no Object Manager.
let system = try store.system()
await system.start()
for light in system.entities.compactMap(\.switchable) {
print(light.name, light.isOn == true ? "on" : "off")
}
The project file saved in Object Manager (.omp) is an alternative to the download. The code above, and loading from a project file, are explained step by step in Using the library โ
Clone the Swift implementation and run the examples against your installation. No build step; swift run does it:
git clone https://github.com/osieckiAdam/grenton-core-swift.git
cd grenton-core-swift
swift run fetch-interface 192.168.1.50 dist/interface.zip 149 853
swift run list-devices dist/interface.zip
swift run import-project house.omp # the same, from a project file, no PIN
This site is for the Swift implementation. Grenton Core itself is a language-agnostic specification: every implementation follows the same rules and passes the same conformance suite, so behaviour is identical across languages.
Implementations in other languages will have their own pages and API references. To write one, start from the specification and its conformance suite:
git submodule add https://github.com/osieckiAdam/grenton-core-spec.git vendor/grenton-core-spec
python3 vendor/grenton-core-spec/tools/suite.py check # validate the suite