Compile with older qt versions
This commit is contained in:
parent
74ad4228cf
commit
d6990d3e91
@ -383,14 +383,14 @@ void DevicePluginOpenweathermap::processWeatherData(const QByteArray &data, Devi
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (dataMap.contains("sys")) {
|
if (dataMap.contains("sys")) {
|
||||||
uint sunrise = dataMap.value("sys").toMap().value("sunrise").toUInt();
|
qint64 sunrise = dataMap.value("sys").toMap().value("sunrise").toLongLong();
|
||||||
uint sunset = dataMap.value("sys").toMap().value("sunset").toUInt();
|
qint64 sunset = dataMap.value("sys").toMap().value("sunset").toLongLong();
|
||||||
|
|
||||||
device->setStateValue(openweathermapSunriseTimeStateTypeId, sunrise);
|
device->setStateValue(openweathermapSunriseTimeStateTypeId, sunrise);
|
||||||
device->setStateValue(openweathermapSunsetTimeStateTypeId, sunset);
|
device->setStateValue(openweathermapSunsetTimeStateTypeId, sunset);
|
||||||
QTimeZone tz = QTimeZone(QTimeZone::systemTimeZoneId());
|
QTimeZone tz = QTimeZone(QTimeZone::systemTimeZoneId());
|
||||||
QDateTime up = QDateTime::fromSecsSinceEpoch(sunrise);
|
QDateTime up = QDateTime::fromMSecsSinceEpoch(sunrise * 1000);
|
||||||
QDateTime down = QDateTime::fromSecsSinceEpoch(sunset);
|
QDateTime down = QDateTime::fromMSecsSinceEpoch(sunset * 1000);
|
||||||
QDateTime now = QDateTime::currentDateTime().toTimeZone(tz);
|
QDateTime now = QDateTime::currentDateTime().toTimeZone(tz);
|
||||||
device->setStateValue(openweathermapDaylightStateTypeId, up < now && down > now);
|
device->setStateValue(openweathermapDaylightStateTypeId, up < now && down > now);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user