some tunings in the heating experience
This commit is contained in:
parent
ae0a3279ec
commit
2b42b20a24
@ -137,7 +137,7 @@ Connection *NymeaConnection::currentConnection() const
|
|||||||
void NymeaConnection::sendData(const QByteArray &data)
|
void NymeaConnection::sendData(const QByteArray &data)
|
||||||
{
|
{
|
||||||
if (connected()) {
|
if (connected()) {
|
||||||
// qDebug() << "sending data:" << data;
|
qDebug() << "sending data:" << data;
|
||||||
m_currentTransport->sendData(data);
|
m_currentTransport->sendData(data);
|
||||||
} else {
|
} else {
|
||||||
qWarning() << "Connection: Not connected. Cannot send.";
|
qWarning() << "Connection: Not connected. Cannot send.";
|
||||||
|
|||||||
@ -5,13 +5,27 @@ Item {
|
|||||||
implicitHeight: app.iconSize * .8
|
implicitHeight: app.iconSize * .8
|
||||||
implicitWidth: height
|
implicitWidth: height
|
||||||
|
|
||||||
property bool on: false
|
// TODO: Convert to enum once we have Qt 5.10
|
||||||
|
// on, off, green, orange, red
|
||||||
|
property string state: "off"
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
height: Math.min(parent.height, parent.height)
|
height: Math.min(parent.height, parent.height)
|
||||||
width: height
|
width: height
|
||||||
radius: width / 2
|
radius: width / 2
|
||||||
color: root.on ? "lightgreen" : "lightgray"
|
color: {
|
||||||
|
switch (root.state) {
|
||||||
|
case "on":
|
||||||
|
case "green":
|
||||||
|
return "#91dd77";
|
||||||
|
case "off":
|
||||||
|
return "lightgray";
|
||||||
|
case "orange":
|
||||||
|
return "#dddd77";
|
||||||
|
case "red":
|
||||||
|
return "#dd7777"
|
||||||
|
}
|
||||||
|
}
|
||||||
border.width: 1
|
border.width: 1
|
||||||
border.color: app.foregroundColor
|
border.color: app.foregroundColor
|
||||||
}
|
}
|
||||||
|
|||||||
@ -57,7 +57,7 @@ Item {
|
|||||||
|
|
||||||
Led {
|
Led {
|
||||||
visible: root.stateType.type.toLowerCase() === "bool"
|
visible: root.stateType.type.toLowerCase() === "bool"
|
||||||
on: root.valueState.value === true
|
state: root.valueState.value === true ? "on" : "off"
|
||||||
}
|
}
|
||||||
|
|
||||||
Label {
|
Label {
|
||||||
|
|||||||
@ -7,5 +7,5 @@ import "../../components"
|
|||||||
|
|
||||||
Led {
|
Led {
|
||||||
property bool value
|
property bool value
|
||||||
on: value === true
|
state: value === true ? "on" : "off"
|
||||||
}
|
}
|
||||||
|
|||||||
@ -118,7 +118,7 @@ DeviceListPageBase {
|
|||||||
Led {
|
Led {
|
||||||
id: led
|
id: led
|
||||||
visible: sensorValueDelegate.stateType && sensorValueDelegate.stateType.type.toLowerCase() == "bool"
|
visible: sensorValueDelegate.stateType && sensorValueDelegate.stateType.type.toLowerCase() == "bool"
|
||||||
on: visible && sensorValueDelegate.stateValue.value === true
|
state: visible && sensorValueDelegate.stateValue.value === true ? "on" : "off"
|
||||||
}
|
}
|
||||||
Item {
|
Item {
|
||||||
Layout.preferredWidth: led.width
|
Layout.preferredWidth: led.width
|
||||||
|
|||||||
@ -268,7 +268,7 @@ Page {
|
|||||||
property var value
|
property var value
|
||||||
Led {
|
Led {
|
||||||
implicitHeight: app.smallFont
|
implicitHeight: app.smallFont
|
||||||
on: boolLed.value === "true"
|
state: boolLed.value === "true" ? "on" : "off"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -16,7 +16,9 @@ Item {
|
|||||||
|
|
||||||
readonly property State temperatureState: duwWpDevice ? duwWpDevice.states.getState(duwWpDevice.deviceClass.stateTypes.findByName("temperature").id) : null
|
readonly property State temperatureState: duwWpDevice ? duwWpDevice.states.getState(duwWpDevice.deviceClass.stateTypes.findByName("temperature").id) : null
|
||||||
readonly property State targetTemperatureState: duwWpDevice ? duwWpDevice.states.getState(duwWpDevice.deviceClass.stateTypes.findByName("targetTemperature").id) : null
|
readonly property State targetTemperatureState: duwWpDevice ? duwWpDevice.states.getState(duwWpDevice.deviceClass.stateTypes.findByName("targetTemperature").id) : null
|
||||||
|
readonly property State co2LevelState: duwLuDevice ? duwLuDevice.states.getState(duwLuDevice.deviceClass.stateTypes.findByName("co2").id) : null
|
||||||
readonly property State ventilationModeState: duwLuDevice ? duwLuDevice.states.getState(duwLuDevice.deviceClass.stateTypes.findByName("ventilationMode").id) : null
|
readonly property State ventilationModeState: duwLuDevice ? duwLuDevice.states.getState(duwLuDevice.deviceClass.stateTypes.findByName("ventilationMode").id) : null
|
||||||
|
readonly property State ventilationLevelState: duwLuDevice ? duwLuDevice.states.getState(duwLuDevice.deviceClass.stateTypes.findByName("activeVentilationLevel").id) : null
|
||||||
|
|
||||||
function ventilationModeToSliderValue(ventilationMode) {
|
function ventilationModeToSliderValue(ventilationMode) {
|
||||||
switch (ventilationMode) {
|
switch (ventilationMode) {
|
||||||
@ -135,149 +137,177 @@ Item {
|
|||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
anchors.margins: app.margins
|
anchors.margins: app.margins
|
||||||
|
|
||||||
RowLayout {
|
ColumnLayout {
|
||||||
spacing: app.margins
|
|
||||||
ColorIcon {
|
|
||||||
Layout.preferredHeight: app.iconSize
|
|
||||||
Layout.preferredWidth: app.iconSize
|
|
||||||
name: "qrc:/ui/images/weathericons/wind.svg"
|
|
||||||
color: app.accentColor
|
|
||||||
}
|
|
||||||
Led {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Label {
|
RowLayout {
|
||||||
text: qsTr("Current temperature")
|
spacing: app.margins
|
||||||
font.pixelSize: app.smallFont
|
ColorIcon {
|
||||||
}
|
Layout.preferredHeight: app.iconSize
|
||||||
|
Layout.preferredWidth: app.iconSize
|
||||||
RowLayout {
|
name: "qrc:/ui/images/weathericons/wind.svg"
|
||||||
ColorIcon {
|
color: app.accentColor
|
||||||
Layout.preferredHeight: app.iconSize
|
}
|
||||||
Layout.preferredWidth: app.iconSize
|
Led {
|
||||||
name: "qrc:/ui/images/sensors/temperature.svg"
|
state: {
|
||||||
color: app.accentColor
|
if (!root.co2LevelState) {
|
||||||
|
return "off"
|
||||||
|
}
|
||||||
|
if (root.co2LevelState.value < 900) {
|
||||||
|
return "green"
|
||||||
|
}
|
||||||
|
if (root.co2LevelState.value < 2000) {
|
||||||
|
return "orange"
|
||||||
|
}
|
||||||
|
return "red"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Label {
|
Label {
|
||||||
text: root.temperatureState ? root.temperatureState.value.toFixed(1) + "°C" : "N/A"
|
text: qsTr("Current temperature")
|
||||||
Layout.fillWidth: true
|
font.pixelSize: app.smallFont
|
||||||
font.pixelSize: app.largeFont * 2
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Item {
|
|
||||||
Layout.preferredHeight: app.margins * 2
|
|
||||||
Layout.fillWidth: true
|
|
||||||
}
|
|
||||||
|
|
||||||
Label {
|
|
||||||
text: qsTr("Temperature, °C")
|
|
||||||
font.pixelSize: app.largeFont
|
|
||||||
}
|
|
||||||
Label {
|
|
||||||
text: (d.pendingCallId !== -1 || d.setTempPending) ? d.queuedTargetTemp.toFixed(1) :
|
|
||||||
root.targetTemperatureState ? root.targetTemperatureState.value.toFixed(1) : "N/A"
|
|
||||||
font.pixelSize: app.largeFont * 4
|
|
||||||
}
|
|
||||||
|
|
||||||
Item {
|
|
||||||
Layout.preferredHeight: app.margins * 2
|
|
||||||
Layout.fillWidth: true
|
|
||||||
}
|
|
||||||
ColorIcon {
|
|
||||||
Layout.preferredHeight: app.iconSize * 1.5
|
|
||||||
Layout.preferredWidth: height
|
|
||||||
Layout.leftMargin: width
|
|
||||||
color: app.accentColor
|
|
||||||
name: "qrc:/ui/images/share.svg"
|
|
||||||
}
|
|
||||||
Label {
|
|
||||||
text: qsTr("Automate this thing")
|
|
||||||
color: app.accentColor
|
|
||||||
font.pixelSize: app.smallFont
|
|
||||||
}
|
|
||||||
|
|
||||||
Item {
|
|
||||||
Layout.fillWidth: true
|
|
||||||
Layout.fillHeight: true
|
|
||||||
}
|
|
||||||
|
|
||||||
RowLayout {
|
|
||||||
Layout.leftMargin: parent.width * .05
|
|
||||||
Layout.rightMargin: parent.width * .2
|
|
||||||
spacing: app.margins
|
|
||||||
ColorIcon {
|
|
||||||
Layout.preferredHeight: app.iconSize
|
|
||||||
Layout.preferredWidth: app.iconSize
|
|
||||||
color: app.accentColor
|
|
||||||
name: "qrc:/ui/images/ventilation.svg"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
RowLayout {
|
RowLayout {
|
||||||
Layout.fillWidth: true
|
ColorIcon {
|
||||||
Layout.maximumHeight: app.iconSize
|
Layout.preferredHeight: app.iconSize
|
||||||
spacing: 0
|
Layout.preferredWidth: app.iconSize
|
||||||
|
name: "qrc:/ui/images/sensors/temperature.svg"
|
||||||
|
color: app.accentColor
|
||||||
|
}
|
||||||
|
Label {
|
||||||
|
text: root.temperatureState ? root.temperatureState.value.toFixed(1) + "°C" : "N/A"
|
||||||
|
Layout.fillWidth: true
|
||||||
|
font.pixelSize: app.largeFont * 2
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Repeater {
|
ColumnLayout {
|
||||||
model: ListModel {
|
|
||||||
ListElement { text: qsTr("Auto") }
|
|
||||||
ListElement { text: qsTr("Party") }
|
|
||||||
ListElement { text: qsTr("Manual") }
|
|
||||||
}
|
|
||||||
|
|
||||||
Rectangle {
|
Label {
|
||||||
Layout.fillWidth: true
|
text: qsTr("Temperature, °C")
|
||||||
Layout.fillHeight: true
|
font.pixelSize: app.largeFont
|
||||||
border.width: 1
|
}
|
||||||
border.color: app.accentColor
|
Label {
|
||||||
color: root.ventilationModeState && root.ventilationModeToUiMode(root.ventilationModeState.value) === index ? app.accentColor : "transparent"
|
text: (d.pendingCallId !== -1 || d.setTempPending) ? d.queuedTargetTemp.toFixed(1) :
|
||||||
Label {
|
root.targetTemperatureState ? root.targetTemperatureState.value.toFixed(1) : "N/A"
|
||||||
anchors.centerIn: parent
|
font.pixelSize: app.largeFont * 4
|
||||||
text: model.text
|
}
|
||||||
font.pixelSize: app.smallFont
|
}
|
||||||
|
|
||||||
|
|
||||||
|
ColumnLayout {
|
||||||
|
Layout.fillWidth: false
|
||||||
|
ColorIcon {
|
||||||
|
Layout.preferredHeight: app.iconSize * 1.5
|
||||||
|
Layout.preferredWidth: height
|
||||||
|
Layout.alignment: Qt.AlignHCenter
|
||||||
|
color: app.accentColor
|
||||||
|
name: "qrc:/ui/images/share.svg"
|
||||||
|
MouseArea {
|
||||||
|
anchors.fill: parent
|
||||||
|
onClicked: pageStack.push("qrc:/ui/magic/DeviceRulesPage.qml", {device: root.duwWpDevice})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Label {
|
||||||
|
text: qsTr("Automate this thing")
|
||||||
|
color: app.accentColor
|
||||||
|
font.pixelSize: app.smallFont
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ColumnLayout {
|
||||||
|
|
||||||
|
RowLayout {
|
||||||
|
Layout.leftMargin: parent.width * .05
|
||||||
|
Layout.rightMargin: parent.width * .2
|
||||||
|
spacing: app.margins
|
||||||
|
ColorIcon {
|
||||||
|
Layout.preferredHeight: app.iconSize
|
||||||
|
Layout.preferredWidth: app.iconSize
|
||||||
|
color: app.accentColor
|
||||||
|
name: "qrc:/ui/images/ventilation.svg"
|
||||||
|
PropertyAnimation on rotation {
|
||||||
|
running: root.ventilationLevelState !== null
|
||||||
|
duration: root.ventilationLevelState !== null && root.ventilationLevelState.value > 0
|
||||||
|
? 2000 / root.ventilationLevelState.value
|
||||||
|
: 0
|
||||||
|
from: 360
|
||||||
|
to: 0
|
||||||
|
loops: Animation.Infinite
|
||||||
|
onDurationChanged: {
|
||||||
|
running = false;
|
||||||
|
running = true;
|
||||||
}
|
}
|
||||||
MouseArea {
|
}
|
||||||
anchors.fill: parent
|
}
|
||||||
onClicked: {
|
|
||||||
root.setVentilationMode(index, ventilationSlider.value)
|
RowLayout {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.maximumHeight: app.iconSize
|
||||||
|
spacing: 0
|
||||||
|
|
||||||
|
Repeater {
|
||||||
|
model: ListModel {
|
||||||
|
ListElement { text: qsTr("Auto") }
|
||||||
|
ListElement { text: qsTr("Party") }
|
||||||
|
ListElement { text: qsTr("Manual") }
|
||||||
|
}
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.fillHeight: true
|
||||||
|
border.width: 1
|
||||||
|
border.color: app.accentColor
|
||||||
|
color: root.ventilationModeState && root.ventilationModeToUiMode(root.ventilationModeState.value) === index ? app.accentColor : "transparent"
|
||||||
|
Label {
|
||||||
|
anchors.centerIn: parent
|
||||||
|
text: model.text
|
||||||
|
font.pixelSize: app.smallFont
|
||||||
|
}
|
||||||
|
MouseArea {
|
||||||
|
anchors.fill: parent
|
||||||
|
onClicked: {
|
||||||
|
root.setVentilationMode(index, ventilationSlider.value)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Slider {
|
||||||
|
id: ventilationSlider
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.leftMargin: parent.width * .05
|
||||||
|
Layout.rightMargin: parent.width * .05
|
||||||
|
from: 0
|
||||||
|
to: 3
|
||||||
|
stepSize: 1
|
||||||
|
live: false
|
||||||
|
snapMode: Slider.SnapAlways
|
||||||
|
enabled: root.ventilationModeState && root.ventilationModeToUiMode(root.ventilationModeState.value) === 2
|
||||||
|
opacity: enabled ? 1 : .2
|
||||||
|
value: root.ventilationModeState ? root.ventilationModeToSliderValue(root.ventilationModeState.value) : 0
|
||||||
|
onMoved: root.setVentilationMode(2, valueAt(visualPosition))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Slider {
|
|
||||||
id: ventilationSlider
|
|
||||||
Layout.fillWidth: true
|
|
||||||
Layout.leftMargin: parent.width * .05
|
|
||||||
Layout.rightMargin: parent.width * .05
|
|
||||||
from: 0
|
|
||||||
to: 4
|
|
||||||
stepSize: 1
|
|
||||||
live: false
|
|
||||||
snapMode: Slider.SnapAlways
|
|
||||||
enabled: root.ventilationModeState && root.ventilationModeToUiMode(root.ventilationModeState.value) === 2
|
|
||||||
opacity: enabled ? 1 : .2
|
|
||||||
value: root.ventilationModeState ? root.ventilationModeToSliderValue(root.ventilationModeState.value) : 0
|
|
||||||
onMoved: root.setVentilationMode(2, ventilationSlider.value)
|
|
||||||
|
|
||||||
}
|
// ProgressButton {
|
||||||
|
// imageSource: "qrc:/ui/images/system-shutdown.svg"
|
||||||
|
// Layout.preferredHeight: app.iconSize * 1.5
|
||||||
|
// Layout.preferredWidth: height
|
||||||
|
// Layout.alignment: Qt.AlignHCenter
|
||||||
|
// }
|
||||||
|
|
||||||
ProgressButton {
|
// Label {
|
||||||
imageSource: "qrc:/ui/images/system-shutdown.svg"
|
// text: qsTr("Hold to turn off")
|
||||||
Layout.preferredHeight: app.iconSize * 1.5
|
// font.pixelSize: app.smallFont
|
||||||
Layout.preferredWidth: height
|
// Layout.fillWidth: true
|
||||||
Layout.alignment: Qt.AlignHCenter
|
// horizontalAlignment: Text.AlignHCenter
|
||||||
}
|
// }
|
||||||
|
|
||||||
Label {
|
|
||||||
text: qsTr("Hold to turn off")
|
|
||||||
font.pixelSize: app.smallFont
|
|
||||||
Layout.fillWidth: true
|
|
||||||
horizontalAlignment: Text.AlignHCenter
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
|
|||||||
@ -511,7 +511,7 @@ MainPageTile {
|
|||||||
Led {
|
Led {
|
||||||
Layout.preferredHeight: app.iconSize * .5
|
Layout.preferredHeight: app.iconSize * .5
|
||||||
Layout.preferredWidth: height
|
Layout.preferredWidth: height
|
||||||
on: sensorsRoot.shownStateType && sensorsRoot.device.stateValue(sensorsRoot.shownStateType.id) === true
|
state: sensorsRoot.shownStateType && sensorsRoot.device.stateValue(sensorsRoot.shownStateType.id) === true ? "on" : "off"
|
||||||
visible: sensorsRoot.shownStateType && sensorsRoot.shownStateType.type.toLowerCase() === "bool"
|
visible: sensorsRoot.shownStateType && sensorsRoot.shownStateType.type.toLowerCase() === "bool"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -347,7 +347,7 @@ Item {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
Led {
|
Led {
|
||||||
on: sensorsRoot.currentState.value === true
|
state: sensorsRoot.currentState.value === true ? "on" : "off"
|
||||||
visible: sensorsRoot.currentStateType.type.toLowerCase() === "bool"
|
visible: sensorsRoot.currentStateType.type.toLowerCase() === "bool"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user