Current Platform Integrations

Hubitat Hub Integration

  • Protocol: HTTP REST API using Makers API
  • Authentication: Access token with App ID
  • Communication: Local network for minimal latency
  • Event Handling: Webhook-based real-time device updates

Flair HVAC Integration

  • Protocol: OAuth 2.0 REST API with automatic token refresh
  • Components: Structures, rooms, HVAC units, sensor bridges
  • Capabilities: Mini-split control, room temperature monitoring

Weather Service Integration (currently disabled)

  • Provider: WeatherAPI.com with API key authentication
  • Data Points: Temperature, humidity, conditions, feels-like temperature
  • Caching: Local cache with 30-minute refresh intervals

Device Management System

Most of my devices are registered in the Hubitat platform, which provides a local API for device management. I have also been evaluating Home Assistant as a potential alternative for future integrations but have not yet migrated. The core requirements for the device management system include:

  • Unified Device Model: Abstract representation of devices across platforms
  • Capability-Based Architecture: Devices expose capabilities like switches, sensors, and thermostats
  • Room Organization: Devices are grouped by rooms with hierarchical structure

Device states are synchronized into local cache storage, providing fast API responses while maintaining eventual consistency with upstream platforms.

Abstract Device Interface

All devices implement a common interface to ensure consistent interaction across platforms:

type Device interface {
  ID() string
	Name() string
	Room() room.Room
	MatchesName(string) bool
	Capabilities() []CapabilityName
	As(CapabilityName) Capability
}

This interface is implemented for each platform / device type once and reused across the system. It allows for flexible device management and interaction without needing to know the underlying platform details.

Capability-Based Controls

Devices expose capabilities that define their functionality, allowing for flexible control and automation. For instance:

  • Switch capabilities for on/off control
  • Sensor capabilities for environmental data
  • Thermostat capabilities for HVAC control
  • Button capabilities for trigger events
type Capability interface {
	Name() CapabilityName
	IsStateful() bool
	CurrentState() CapabilityState
	Merge(Capability)
	SendCommand(string) error
}

Room Organization

type Room struct {
	Name    string   `json:"name,omitempty"`