Node.js TypeScript library for controlling Trane thermostats
npm install trane-thermostat-apiA TypeScript/Node.js library for controlling Trane thermostats via the Trane Home API.
This library provides:
- Full TypeScript support with comprehensive type definitions
- Homebridge-optimized architecture for seamless HomeKit integration
- Modern async/await patterns for all API interactions
- Multi-zone support with individual thermostat zone control
- RoomIQ sensor integration for enhanced temperature monitoring
- Comprehensive error handling with structured error hierarchy
- Trane Thermostats: XL850, XL950, XL1050, XL824, and other Trane Home compatible models
``bash`
npm install trane-thermostat-api
`typescript
import { TraneClient } from 'trane-thermostat-api';
const client = new TraneClient({
username: 'your-email@example.com',
password: 'your-password'
});
// Authenticate and discover devices
await client.login();
const thermostats = await client.getThermostats();
// Control thermostat
const thermostat = thermostats[0];
await thermostat.setFanMode('auto');
// Control zones
const zone = thermostat.zones[0];
await zone.setTemperatures({
heatingSetpoint: 70,
coolingSetpoint: 75
});
`
#### TraneClient
Main HTTP client for API communication and device discovery.
#### TraneThermostat
Represents a physical thermostat with full feature detection and control.
#### TraneZone
Represents a zone/room within a thermostat with independent temperature control.
#### TraneSensor
RoomIQ temperature and humidity sensor with battery monitoring.
This library is designed specifically for Homebridge plugins. See the included platform implementation for complete HomeKit integration examples.
`bashInstall dependencies
npm install
Testing
The test suite includes:
- Unit tests for all core classes
- Mock HTTP responses for API testing
- Validation logic testing
- Error handling scenarios
`bash
npm run test:coverage
``1. Fork the repository
2. Create a feature branch
3. Make your changes with tests
4. Run the test suite
5. Submit a pull request
MIT License - see LICENSE file for details.