fix date representation in state view

This commit is contained in:
Michael Zanetti 2018-04-19 21:09:59 +02:00
parent 7ee3b8c070
commit 88d730ddb5
4 changed files with 13 additions and 3 deletions

View File

@ -134,9 +134,11 @@ void UpnpDiscovery::readData()
data.resize(pendingDatagramSize());
readDatagram(data.data(), data.size(), &hostAddress, &port);
}
if (data.contains("10.10.10.128"))
qDebug() << "Data received" << data;
// if the data contains the HTTP OK header...
if (data.contains("HTTP/1.1 200 OK")) {
if (data.contains("HTTP/1.1 200 OK") || data.contains("NOTIFY * HTTP/1.1")) {
QUrl location;
bool isNymea = false;

View File

@ -407,7 +407,7 @@ QPair<Types::Unit, QString> JsonTypes::stringToUnit(const QString &unitString)
} else if (unitString == "UnitHours") {
return QPair<Types::Unit, QString>(Types::UnitHours, "h");
} else if (unitString == "UnitUnixTime") {
return QPair<Types::Unit, QString>(Types::UnitUnixTime, "");
return QPair<Types::Unit, QString>(Types::UnitUnixTime, "datetime");
} else if (unitString == "UnitMeterPerSecond") {
return QPair<Types::Unit, QString>(Types::UnitMeterPerSecond, "m/s");
} else if (unitString == "UnitKiloMeterPerHour") {

View File

@ -78,6 +78,13 @@ DevicePageBase {
}
ColorPickerCt {
id: pickerCt
Layout.fillWidth: true

View File

@ -114,7 +114,8 @@ Page {
Label {
property var value: ""
property var stateTypeId: null
text: value + " " + deviceClass.stateTypes.getStateType(stateTypeId).unitString
property var unitString: deviceClass.stateTypes.getStateType(stateTypeId).unitString
text: unitString === "datetime" ? Qt.formatDateTime(new Date(value * 1000), Qt.DefaultLocaleShortDate) : value + " " + unitString
horizontalAlignment: Text.AlignHCenter
}
}