Hello,
I was working on the setpoint off the thermostat.
But I got something weird.
Code: Select all
Netamo: Setpoint ()
Status: User: domoticz initiated a SetPoint command
Error: Netamo: NetatmoThermostat : No thermostat found in online devices!
Debug: Netamo: NetatmoThermostat idx = 4
Debug: Netamo: NetatmoThermostat idx = 4
Netamo: Setpoint (Unknown)
Status: User: domoticz initiated a SetPoint command
Error: Netamo: NetatmoThermostat : No thermostat found in online devices!
Debug: Netamo: NetatmoThermostat idx = 4
Debug: Netamo: NetatmoThermostat idx = 4
Netamo: Setpoint (Unknown)
Status: User: domoticz initiated a SetPoint command
Error: Netamo: NetatmoThermostat : No thermostat found in online devices!
Debug: Netamo: NetatmoThermostat idx = 4
Debug: Netamo: NetatmoThermostat idx = 4
Netamo: Setpoint (Unknown)
Status: User: domoticz initiated a SetPoint command
Error: Netamo: NetatmoThermostat : No thermostat found in online devices!
Debug: Netamo: NetatmoThermostat idx = 4
Debug: Netamo: NetatmoThermostat idx = 4
so the action off the 4 different setpoints returns always in idx = 4 ?
and after the action there are 4 new setpoint devices??
I was thinking the idx is always unique/singular.

- setpoint.png (69.37 KiB) Viewed 2052 times
Is there some registration off the setpoint necessary that I don't see?
Any advice on to identify the correct thermostat setpoint ?
or an example off a thermostat that uses updatevalueint().
Code: Select all
void CNetatmo::SetSetpoint(int idx, const float temp) //, const std::string& defaultname) //, std::string roomNetatmoID)
{
//Check if still connected to the API
//connect to it if needed
if (!m_isLogged == true)
{
if (!Login())
return;
}
Debug(DEBUG_HARDWARE, "NetatmoThermostat idx = %d", idx);
//Temp to set
float tempDest = temp;
unsigned char tSign = m_sql.m_tempsign[0];
// convert back to Celsius
if (tSign == 'F')
tempDest = static_cast<float>(ConvertToCelsius(tempDest));
//We change the setpoint for one hour
time_t now = mytime(nullptr);
struct tm etime;
localtime_r(&now, &etime);
time_t end_time;
int isdst = etime.tm_isdst;
bool goodtime = false;
while (!goodtime)
{
etime.tm_isdst = isdst;
etime.tm_hour += 1;
end_time = mktime(&etime);
goodtime = (etime.tm_isdst == isdst);
isdst = etime.tm_isdst;
if (!goodtime)
localtime_r(&now, &etime);
}
std::vector<std::string> ExtraHeaders;
std::string sResult;
std::stringstream sstr;
std::stringstream bstr;
Json::Value root; // root JSON object
std::string home_data = "";
bool ret = false;
bool bRet; //Parsing status
if (m_energyType != NETYPE_ENERGY)
{
// Check if thermostat device is available
if ((m_thermostatDeviceID[idx].empty()) || (m_thermostatModuleID[idx].empty())) // (m_thermostatDeviceID[roomNetatmoID].empty())
{
Log(LOG_ERROR, "NetatmoThermostat : No thermostat found in online devices!");
Debug(DEBUG_HARDWARE, "NetatmoThermostat idx = %d", idx);
return;
}
Get_Respons_API(NETYPE_SETTHERMPOINT, sResult, home_data, bRet, root);
}
else
{
//find module id
std::string module_ID = m_thermostatDeviceID[idx]; // (m_thermostatDeviceID[roomNetatmoID];
if (module_ID.empty())
{
Log(LOG_ERROR, "NetatmoThermostat: No thermostat or valve found in online devices!");
return;
}
Get_Respons_API(NETYPE_SETROOMTHERMPOINT, sResult, home_data, bRet, root);
}
if (!bRet)
{
Log(LOG_ERROR, "NetatmoThermostat: Error setting setpoint!");
return;
}
//Retrieve new thermostat data
GetHomeStatusDetails();
//Set up for updating thermostat data when the set point reach its end
m_tSetpointUpdateTime = time(nullptr) + 60;
m_bForceSetpointUpdate = true;
}
Kind Regards
Jurgen