fixed autodetect search from openweather and removed conrad from code temprary
This commit is contained in:
parent
6c3596a3f4
commit
477749fe7d
@ -3,7 +3,7 @@ SUBDIRS += elro \
|
||||
intertechno \
|
||||
# meisteranker \
|
||||
wifidetector \
|
||||
conrad \
|
||||
# conrad \
|
||||
mock \
|
||||
# weatherground \
|
||||
openweathermap \
|
||||
|
||||
@ -180,6 +180,17 @@ QList<DeviceClass> DevicePluginOpenweathermap::supportedDevices() const
|
||||
locationParam.insert("name", "location");
|
||||
locationParam.insert("type", "string");
|
||||
params.append(locationParam);
|
||||
|
||||
QVariantMap countryParam;
|
||||
countryParam.insert("name", "country");
|
||||
countryParam.insert("type", "string");
|
||||
params.append(countryParam);
|
||||
|
||||
QVariantMap idParam;
|
||||
idParam.insert("name", "id");
|
||||
idParam.insert("type", "string");
|
||||
params.append(idParam);
|
||||
|
||||
deviceClassOpenweathermap.setParams(params);
|
||||
|
||||
// Actions
|
||||
@ -294,7 +305,7 @@ DeviceManager::DeviceError DevicePluginOpenweathermap::discoverDevices(const Dev
|
||||
{
|
||||
qDebug() << "should discover divces for" << deviceClassId << params;
|
||||
if(params.value("location").toString() == ""){
|
||||
m_openweaher->update();
|
||||
m_openweaher->searchAutodetect();
|
||||
return DeviceManager::DeviceErrorNoError;
|
||||
}
|
||||
m_openweaher->search(params.value("location").toString());
|
||||
@ -318,6 +329,7 @@ PluginId DevicePluginOpenweathermap::pluginId() const
|
||||
|
||||
void DevicePluginOpenweathermap::guhTimer()
|
||||
{
|
||||
m_openweaher->update();
|
||||
}
|
||||
|
||||
void DevicePluginOpenweathermap::searchResultsReady(const QList<QVariantMap> &cityList)
|
||||
|
||||
@ -66,16 +66,7 @@ void OpenWeatherMap::processLocationResponse(QByteArray data)
|
||||
|
||||
QVariantMap dataMap = jsonDoc.toVariant().toMap();
|
||||
if(dataMap.contains("city")){
|
||||
QString cityName = dataMap.value("city").toString();
|
||||
// skip search for cityID...
|
||||
if(m_cityName != cityName){
|
||||
m_cityName = cityName;
|
||||
updateSearchData();
|
||||
return;
|
||||
}else{
|
||||
updateWeatherData();
|
||||
return;
|
||||
}
|
||||
search(dataMap.value("city").toString());
|
||||
}
|
||||
}
|
||||
|
||||
@ -237,25 +228,25 @@ void OpenWeatherMap::processWeatherResponse(QByteArray data)
|
||||
// emit
|
||||
}
|
||||
}
|
||||
// qDebug() << "#########################################################";
|
||||
// qDebug() << m_cityName << m_cityId;
|
||||
// qDebug() << "#########################################################";
|
||||
// qDebug() << "temp" << m_temperatur;
|
||||
// qDebug() << "temp min" << m_temperaturMin;
|
||||
// qDebug() << "temp max" << m_temperaturMax;
|
||||
// qDebug() << "cloudiness" << m_cloudiness;
|
||||
// qDebug() << "humidity" << m_humidity;
|
||||
// qDebug() << "pressure" << m_pressure;
|
||||
// qDebug() << "wind dir" << m_windDirection;
|
||||
// qDebug() << "wind speed" << m_windSpeed;
|
||||
// qDebug() << "sunrise" << QDateTime::fromTime_t(m_sunrise);
|
||||
// qDebug() << "sunset" << QDateTime::fromTime_t(m_sunset);
|
||||
// qDebug() << "last update" << QDateTime::fromTime_t(m_lastUpdate);
|
||||
qDebug() << "#########################################################";
|
||||
qDebug() << m_cityName << m_cityId;
|
||||
qDebug() << "#########################################################";
|
||||
qDebug() << "temp" << m_temperatur;
|
||||
qDebug() << "temp min" << m_temperaturMin;
|
||||
qDebug() << "temp max" << m_temperaturMax;
|
||||
qDebug() << "cloudiness" << m_cloudiness;
|
||||
qDebug() << "humidity" << m_humidity;
|
||||
qDebug() << "pressure" << m_pressure;
|
||||
qDebug() << "wind dir" << m_windDirection;
|
||||
qDebug() << "wind speed" << m_windSpeed;
|
||||
qDebug() << "sunrise" << QDateTime::fromTime_t(m_sunrise);
|
||||
qDebug() << "sunset" << QDateTime::fromTime_t(m_sunset);
|
||||
qDebug() << "last update" << QDateTime::fromTime_t(m_lastUpdate);
|
||||
}
|
||||
|
||||
void OpenWeatherMap::update()
|
||||
{
|
||||
updateLocationData();
|
||||
updateWeatherData();
|
||||
}
|
||||
|
||||
void OpenWeatherMap::searchAutodetect()
|
||||
@ -280,24 +271,28 @@ void OpenWeatherMap::replyFinished(QNetworkReply *reply)
|
||||
if(reply == m_locationReply && status == 200){
|
||||
data = reply->readAll();
|
||||
processLocationResponse(data);
|
||||
m_locationReply->deleteLater();
|
||||
return;
|
||||
}
|
||||
|
||||
if(reply == m_searchReply && status == 200){
|
||||
data = reply->readAll();
|
||||
processSearchResponse(data);
|
||||
m_searchReply->deleteLater();
|
||||
return;
|
||||
}
|
||||
|
||||
if(reply == m_searchLocationReply && status == 200){
|
||||
data = reply->readAll();
|
||||
processSearchLocationResponse(data);
|
||||
m_searchLocationReply->deleteLater();
|
||||
return;
|
||||
}
|
||||
|
||||
if(reply == m_weatherReply && status == 200){
|
||||
data = reply->readAll();
|
||||
processWeatherResponse(data);
|
||||
m_weatherReply->deleteLater();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@ -25,7 +25,7 @@ Q_IMPORT_PLUGIN(DevicePluginElro)
|
||||
Q_IMPORT_PLUGIN(DevicePluginIntertechno)
|
||||
//Q_IMPORT_PLUGIN(DevicePluginMeisterAnker)
|
||||
Q_IMPORT_PLUGIN(DevicePluginWifiDetector)
|
||||
Q_IMPORT_PLUGIN(DevicePluginConrad)
|
||||
//Q_IMPORT_PLUGIN(DevicePluginConrad)
|
||||
Q_IMPORT_PLUGIN(DevicePluginMock)
|
||||
//Q_IMPORT_PLUGIN(DevicePluginWeatherground)
|
||||
Q_IMPORT_PLUGIN(DevicePluginOpenweathermap)
|
||||
|
||||
@ -19,7 +19,7 @@ LIBS += -L../plugins/deviceplugins/elro/ -lguh_devicepluginelro
|
||||
LIBS += -L../plugins/deviceplugins/intertechno/ -lguh_devicepluginintertechno
|
||||
#LIBS += -L../plugins/deviceplugins/meisteranker/ -lguh_devicepluginmeisteranker
|
||||
LIBS += -L../plugins/deviceplugins/wifidetector/ -lguh_devicepluginwifidetector
|
||||
LIBS += -L../plugins/deviceplugins/conrad -lguh_devicepluginconrad
|
||||
#LIBS += -L../plugins/deviceplugins/conrad -lguh_devicepluginconrad
|
||||
LIBS += -L../plugins/deviceplugins/mock -lguh_devicepluginmock
|
||||
#LIBS += -L../plugins/deviceplugins/weatherground -lguh_devicepluginweatherground
|
||||
LIBS += -L../plugins/deviceplugins/openweathermap -lguh_devicepluginopenweathermap
|
||||
|
||||
Reference in New Issue
Block a user