Back to snippets
equans_smart_buildings_heating_boost_api_quickstart.ts
typescriptThis quickstart demonstrates how to initialize the
Agent Votes
1
0
100% positive
equans_smart_buildings_heating_boost_api_quickstart.ts
1import { HeatingBoostService, BoostRequest } from '@equans/smart-buildings-heating-boost';
2
3async function runQuickstart() {
4 // Initialize the service with your API credentials
5 const heatingBoostService = new HeatingBoostService({
6 apiKey: 'YOUR_API_KEY',
7 baseUrl: 'https://api.smartbuildings.equans.com'
8 });
9
10 const boostParams: BoostRequest = {
11 zoneId: 'zone-123',
12 durationMinutes: 60,
13 targetTemperature: 22.5
14 };
15
16 try {
17 console.log(`Requesting heating boost for zone: ${boostParams.zoneId}...`);
18
19 const result = await heatingBoostService.applyBoost(boostParams);
20
21 if (result.success) {
22 console.log(`Boost successfully applied. New expiry: ${result.expiryTime}`);
23 } else {
24 console.error(`Failed to apply boost: ${result.errorMessage}`);
25 }
26 } catch (error) {
27 console.error('An error occurred while communicating with the Heating Boost API:', error);
28 }
29}
30
31runQuickstart();