@@ -22,13 +22,14 @@ extern http::server::CWebServer m_webserver;
22
22
OTGWBase::OTGWBase (void )
23
23
{
24
24
m_OutsideTemperatureIdx=0 ;// use build in
25
+ m_bufferpos = 0 ;
25
26
}
26
27
27
28
OTGWBase::~OTGWBase (void )
28
29
{
29
30
}
30
31
31
- void OTGWBase::SetModes ( const int Mode1, const int Mode2, const int Mode3, const int Mode4, const int Mode5)
32
+ void OTGWBase::SetModes (const int Mode1, const int Mode2, const int Mode3, const int Mode4, const int Mode5, const int Mode6 )
32
33
{
33
34
m_OutsideTemperatureIdx=Mode1;
34
35
}
@@ -117,7 +118,7 @@ void OTGWBase::UpdateSwitch(const unsigned char Idx, const bool bOn, const std::
117
118
szQuery.clear ();
118
119
szQuery.str (" " );
119
120
szQuery << " UPDATE DeviceStatus SET Name='" << defaultname << " ' WHERE (HardwareID==" << m_HwdID << " ) AND (DeviceID=='" << szIdx << " ')" ;
120
- result= m_sql.query (szQuery.str ());
121
+ m_sql.query (szQuery.str ());
121
122
}
122
123
123
124
}
@@ -159,7 +160,7 @@ void OTGWBase::UpdateTempSensor(const unsigned char Idx, const float Temp, const
159
160
szQuery.clear ();
160
161
szQuery.str (" " );
161
162
szQuery << " UPDATE DeviceStatus SET Name='" << defaultname << " ' WHERE (HardwareID==" << m_HwdID << " ) AND (DeviceID==" << int (Idx) << " )" ;
162
- result= m_sql.query (szQuery.str ());
163
+ m_sql.query (szQuery.str ());
163
164
}
164
165
}
165
166
@@ -197,7 +198,7 @@ void OTGWBase::UpdateSetPointSensor(const unsigned char Idx, const float Temp, c
197
198
szQuery.clear ();
198
199
szQuery.str (" " );
199
200
szQuery << " UPDATE DeviceStatus SET Name='" << defaultname << " ' WHERE (HardwareID==" << m_HwdID << " ) AND (DeviceID=='" << szID << " ')" ;
200
- result= m_sql.query (szQuery.str ());
201
+ m_sql.query (szQuery.str ());
201
202
}
202
203
}
203
204
@@ -221,7 +222,7 @@ void OTGWBase::UpdatePressureSensor(const unsigned long Idx, const float Pressur
221
222
gDevice .subtype =sTypePressure ;
222
223
gDevice .id =1 ;
223
224
gDevice .floatval1 =Pressure;
224
- gDevice .intval1 =( int ) Idx;
225
+ gDevice .intval1 = static_cast < int >( Idx) ;
225
226
sDecodeRXMessage (this , (const unsigned char *)&gDevice );
226
227
227
228
if (!bDeviceExits)
@@ -230,8 +231,7 @@ void OTGWBase::UpdatePressureSensor(const unsigned long Idx, const float Pressur
230
231
szQuery.clear ();
231
232
szQuery.str (" " );
232
233
szQuery << " UPDATE DeviceStatus SET Name='" << defaultname << " ' WHERE (HardwareID==" << m_HwdID << " ) AND (DeviceID=='" << szTmp << " ') AND (Type==" << int (pTypeGeneral) << " ) AND (Subtype==" << int (sTypePressure ) << " )" ;
233
- result=m_sql.query (szQuery.str ());
234
-
234
+ m_sql.query (szQuery.str ());
235
235
}
236
236
}
237
237
@@ -292,27 +292,35 @@ void OTGWBase::ParseLine()
292
292
bool bDiagnosticEvent=(_status.MsgID [9 +1 ]==' 1' ); UpdateSwitch (116 ,bDiagnosticEvent," DiagnosticEvent" );
293
293
}
294
294
295
- _status.Control_setpoint =( float ) atof (results[idx++].c_str ()); UpdateTempSensor (idx-1 ,_status.Control_setpoint ," Control Setpoint" );
295
+ _status.Control_setpoint =static_cast < float >( atof (results[idx++].c_str () )); UpdateTempSensor (idx-1 ,_status.Control_setpoint ," Control Setpoint" );
296
296
_status.Remote_parameter_flags =results[idx++];
297
- _status.Maximum_relative_modulation_level =(float )atof (results[idx++].c_str ());
297
+ _status.Maximum_relative_modulation_level = static_cast <float >(atof (results[idx++].c_str ()));
298
+ if (_status.Maximum_relative_modulation_level != 0 )
299
+ {
300
+ SendPercentageSensor (idx - 1 , 1 , 255 , _status.Maximum_relative_modulation_level , " Maximum Relative Modulation Level" );
301
+ }
298
302
_status.Boiler_capacity_and_modulation_limits =results[idx++];
299
- _status.Room_Setpoint =(float )atof (results[idx++].c_str ()); UpdateSetPointSensor (idx-1 ,_status.Room_Setpoint ," Room Setpoint" );
300
- _status.Relative_modulation_level =(float )atof (results[idx++].c_str ());
301
- _status.CH_water_pressure =(float )atof (results[idx++].c_str ());
303
+ _status.Room_Setpoint = static_cast <float >(atof (results[idx++].c_str ())); UpdateSetPointSensor (idx - 1 , _status.Room_Setpoint , " Room Setpoint" );
304
+ _status.Relative_modulation_level = static_cast <float >(atof (results[idx++].c_str ()));
305
+ if (_status.Relative_modulation_level != 0 )
306
+ {
307
+ SendPercentageSensor (idx - 1 , 1 , 255 , _status.Relative_modulation_level , " Relative modulation level" );
308
+ }
309
+ _status.CH_water_pressure = static_cast <float >(atof (results[idx++].c_str ()));
302
310
if (_status.CH_water_pressure !=0 )
303
311
{
304
312
UpdatePressureSensor (idx-1 ,_status.CH_water_pressure ," CH Water Pressure" );
305
313
}
306
314
307
- _status.Room_temperature =( float ) atof (results[idx++].c_str ()); UpdateTempSensor (idx- 1 , _status.Room_temperature ," Room Temperature" );
308
- _status.Boiler_water_temperature =( float ) atof (results[idx++].c_str ()); UpdateTempSensor (idx- 1 , _status.Boiler_water_temperature ," Boiler Water Temperature" );
309
- _status.DHW_temperature =( float ) atof (results[idx++].c_str ()); UpdateTempSensor (idx- 1 , _status.DHW_temperature ," DHW Temperature" );
310
- _status.Outside_temperature =( float ) atof (results[idx++].c_str ()); UpdateTempSensor (idx- 1 , _status.Outside_temperature ," Outside Temperature" );
311
- _status.Return_water_temperature =( float ) atof (results[idx++].c_str ()); UpdateTempSensor (idx- 1 , _status.Return_water_temperature ," Return Water Temperature" );
315
+ _status.Room_temperature = static_cast < float >( atof (results[idx++].c_str ())) ; UpdateTempSensor (idx - 1 , _status.Room_temperature , " Room Temperature" );
316
+ _status.Boiler_water_temperature = static_cast < float >( atof (results[idx++].c_str ())) ; UpdateTempSensor (idx - 1 , _status.Boiler_water_temperature , " Boiler Water Temperature" );
317
+ _status.DHW_temperature = static_cast < float >( atof (results[idx++].c_str ())) ; UpdateTempSensor (idx - 1 , _status.DHW_temperature , " DHW Temperature" );
318
+ _status.Outside_temperature = static_cast < float >( atof (results[idx++].c_str ())) ; UpdateTempSensor (idx - 1 , _status.Outside_temperature , " Outside Temperature" );
319
+ _status.Return_water_temperature = static_cast < float >( atof (results[idx++].c_str ())) ; UpdateTempSensor (idx - 1 , _status.Return_water_temperature , " Return Water Temperature" );
312
320
_status.DHW_setpoint_boundaries =results[idx++];
313
321
_status.Max_CH_setpoint_boundaries =results[idx++];
314
- _status.DHW_setpoint =( float ) atof (results[idx++].c_str ()); UpdateSetPointSensor (idx- 1 , _status.DHW_setpoint ," DHW Setpoint" );
315
- _status.Max_CH_water_setpoint =( float ) atof (results[idx++].c_str ()); UpdateSetPointSensor (idx- 1 , _status.Max_CH_water_setpoint ," Max_CH Water Setpoint" );
322
+ _status.DHW_setpoint = static_cast < float >( atof (results[idx++].c_str ())) ; UpdateSetPointSensor (idx - 1 , _status.DHW_setpoint , " DHW Setpoint" );
323
+ _status.Max_CH_water_setpoint = static_cast < float >( atof (results[idx++].c_str ())) ; UpdateSetPointSensor (idx - 1 , _status.Max_CH_water_setpoint , " Max_CH Water Setpoint" );
316
324
_status.Burner_starts =atol (results[idx++].c_str ());
317
325
_status.CH_pump_starts =atol (results[idx++].c_str ());
318
326
_status.DHW_pump_valve_starts =atol (results[idx++].c_str ());
@@ -351,14 +359,13 @@ bool OTGWBase::GetOutsideTemperatureFromDomoticz(float &tvalue)
351
359
Json::Value tempjson;
352
360
std::stringstream sstr;
353
361
sstr << m_OutsideTemperatureIdx;
354
- m_webserver.GetJSonDevices (tempjson, " " , " temp" ," ID" ,sstr.str ()," " ," " ,true ,0 );
362
+ m_webserver.GetJSonDevices (tempjson, " " , " temp" ," ID" ,sstr.str ()," " ," " ,true ,0 , true );
355
363
356
364
size_t tsize=tempjson.size ();
357
365
if (tsize<1 )
358
366
return false ;
359
367
360
368
Json::Value::const_iterator itt;
361
- int ii=0 ;
362
369
Json::ArrayIndex rsize=tempjson[" result" ].size ();
363
370
if (rsize<1 )
364
371
return false ;
0 commit comments