@@ -74,6 +74,9 @@ export class SchluterAPI {
7474 const data = { email : this . email , password : this . password } ;
7575 const result = await axios . post ( SchluterAPI . signInUrl , data ) ;
7676
77+ // Logging the sign-in response for debugging
78+ this . log . debug ( "Sign-in API response:" , result . data ) ;
79+
7780 switch ( result . data . ErrorCode ) {
7881 case 0 :
7982 return result . data . SessionId ;
@@ -111,6 +114,10 @@ export class SchluterAPI {
111114 async getTemperatureUnit ( ) : Promise < TemperatureUnit > {
112115 try {
113116 const result = await axios . get ( SchluterAPI . accountUrl ) ;
117+
118+ // Logging the response for debugging
119+ this . log . debug ( "Account API response:" , result . data ) ;
120+
114121 if ( result . data . TempUnitIsCelsius !== undefined ) {
115122 return result . data . TempUnitIsCelsius
116123 ? TemperatureUnit . Celsius
@@ -189,6 +196,22 @@ export class SchluterAPI {
189196 const result = await axios . get ( SchluterAPI . thermostatUrl , {
190197 params : params ,
191198 } ) ;
199+
200+ // Logging full response for debugging
201+ this . log . debug ( "Thermostat API response:" , result . data ) ;
202+
203+ if (
204+ ! result . data ||
205+ result . data . Temperature === undefined ||
206+ result . data . SetPointTemp === undefined
207+ ) {
208+ this . log . error (
209+ "Thermostat state response is missing required data:" ,
210+ result . data ,
211+ ) ;
212+ throw new Error ( "Invalid thermostat state response" ) ;
213+ }
214+
192215 return {
193216 temperature : result . data . Temperature / 100 ,
194217 targetTemperature : result . data . SetPointTemp / 100 ,
0 commit comments