Add watersensor interface
parent
05d1938167
commit
c1b3d5aed0
|
|
@ -140,7 +140,7 @@ void UpnpDiscovery::readData()
|
|||
data.resize(socket->pendingDatagramSize());
|
||||
socket->readDatagram(data.data(), data.size(), &hostAddress, &port);
|
||||
|
||||
qDebug() << "Received UPnP datagram:" << data;
|
||||
// qDebug() << "Received UPnP datagram:" << data;
|
||||
|
||||
// if the data contains the HTTP OK header...
|
||||
if (data.contains("HTTP/1.1 200 OK")) {
|
||||
|
|
|
|||
|
|
@ -322,7 +322,7 @@ void LogsModel::fetchMore(const QModelIndex &parent)
|
|||
params.insert("limit", m_blockSize);
|
||||
params.insert("offset", m_list.count());
|
||||
|
||||
qDebug() << "Fetching logs from" << m_startTime.toString() << "to" << m_endTime.toString() << "with offset" << m_list.count() << "and limit" << m_blockSize;
|
||||
// qDebug() << "Fetching logs from" << m_startTime.toString() << "to" << m_endTime.toString() << "with offset" << m_list.count() << "and limit" << m_blockSize;
|
||||
|
||||
m_engine->jsonRpcClient()->sendCommand("Logging.GetLogEntries", params, this, "logsReply");
|
||||
// qDebug() << "GetLogEntries called";
|
||||
|
|
|
|||
|
|
@ -418,7 +418,7 @@ void LogsModelNg::fetchMore(const QModelIndex &parent)
|
|||
params.insert("limit", m_blockSize);
|
||||
params.insert("offset", m_list.count());
|
||||
|
||||
qDebug() << "Fetching logs:" << qUtf8Printable(QJsonDocument::fromVariant(params).toJson());
|
||||
// qDebug() << "Fetching logs:" << qUtf8Printable(QJsonDocument::fromVariant(params).toJson());
|
||||
|
||||
m_engine->jsonRpcClient()->sendCommand("Logging.GetLogEntries", params, this, "logsReply");
|
||||
// qDebug() << "GetLogEntries called";
|
||||
|
|
|
|||
|
|
@ -46,12 +46,34 @@ void XYSeriesAdapter::setBaseSeries(QtCharts::QXYSeries *series)
|
|||
|
||||
connect(m_baseSeries, &QtCharts::QXYSeries::pointAdded, this, [=](int index){
|
||||
if (m_series->count() > index) {
|
||||
m_series->replace(index, m_series->at(index).x(), calculateSampleValue(index));
|
||||
qreal value = calculateSampleValue(index);
|
||||
m_series->replace(index, m_series->at(index).x(), value);
|
||||
if (value < m_minValue) {
|
||||
m_minValue = value;
|
||||
qDebug() << "New min:" << m_minValue;
|
||||
emit minValueChanged();
|
||||
}
|
||||
if (value > m_maxValue) {
|
||||
m_maxValue = value;
|
||||
qDebug() << "New max:" << m_maxValue;
|
||||
emit maxValueChanged();
|
||||
}
|
||||
}
|
||||
});
|
||||
connect(m_baseSeries, &QtCharts::QXYSeries::pointReplaced, this, [=](int index){
|
||||
if (m_series->count() > index) {
|
||||
m_series->replace(index, m_series->at(index).x(), calculateSampleValue(index));
|
||||
qreal value = calculateSampleValue(index);
|
||||
m_series->replace(index, m_series->at(index).x(), value);
|
||||
if (value < m_minValue) {
|
||||
m_minValue = value;
|
||||
qDebug() << "New min:" << m_minValue;
|
||||
emit minValueChanged();
|
||||
}
|
||||
if (value > m_maxValue) {
|
||||
m_maxValue = value;
|
||||
qDebug() << "New max:" << m_maxValue;
|
||||
emit maxValueChanged();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
@ -155,10 +177,12 @@ void XYSeriesAdapter::logEntryAdded(LogEntry *entry)
|
|||
|
||||
if (value < m_minValue) {
|
||||
m_minValue = value;
|
||||
// qDebug() << "New min:" << m_minValue;
|
||||
emit minValueChanged();
|
||||
}
|
||||
if (value > m_maxValue) {
|
||||
m_maxValue = value;
|
||||
// qDebug() << "New max:" << m_maxValue;
|
||||
emit maxValueChanged();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -297,6 +297,8 @@ Interfaces::Interfaces(QObject *parent) : QAbstractListModel(parent)
|
|||
addInterface("wirelessconnectable", tr("Wireless devices"), {"connectable"});
|
||||
addStateType("wirelessconnectable", "signalStrength", QVariant::UInt, false, tr("Signal strength"), tr("Signal strength changed"));
|
||||
|
||||
addInterface("watersensor", tr("Water sensors"), {"sensor"});
|
||||
addStateType("watersensor", "watterDetected", QVariant::Double, false, tr("Water detected"), tr("Water detected changed"));
|
||||
}
|
||||
|
||||
int Interfaces::rowCount(const QModelIndex &parent) const
|
||||
|
|
|
|||
|
|
@ -253,5 +253,6 @@
|
|||
<file>ui/images/media/ambeo.svg</file>
|
||||
<file>ui/images/thermostat/cooling.svg</file>
|
||||
<file>ui/images/thermostat/heating.svg</file>
|
||||
<file>ui/images/sensors/water.svg</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
|
|
|||
|
|
@ -291,6 +291,8 @@ ApplicationWindow {
|
|||
return Qt.resolvedUrl("images/sensors/closable.svg")
|
||||
case "windspeedsensor":
|
||||
return Qt.resolvedUrl("images/sensors/windspeed.svg")
|
||||
case "watersensor":
|
||||
return Qt.resolvedUrl("images/sensors/water.svg")
|
||||
case "media":
|
||||
case "mediacontroller":
|
||||
case "mediaplayer":
|
||||
|
|
@ -390,6 +392,31 @@ ApplicationWindow {
|
|||
id: styleBase
|
||||
}
|
||||
|
||||
function stateColor(stateName) {
|
||||
// Try to load color map from style
|
||||
if (Style.stateColors[stateName]) {
|
||||
return Style.stateColors[stateName];
|
||||
}
|
||||
|
||||
if (styleBase.stateColors[stateName]) {
|
||||
return styleBase.stateColors[stateName];
|
||||
}
|
||||
console.warn("stateColor(): Color not set for state", stateName)
|
||||
return "grey";
|
||||
}
|
||||
|
||||
function stateIcon(stateName) {
|
||||
var iconMap = {
|
||||
"currentPower": "energy.svg",
|
||||
"totalEnergyConsumed": "smartmeter.svg",
|
||||
"totalEnergyProduced": "smartmeter.svg",
|
||||
}
|
||||
if (!iconMap[stateName]) {
|
||||
console.warn("stateIcon(): Icon not set for state", stateName)
|
||||
}
|
||||
return Qt.resolvedUrl("images/" + iconMap[stateName]);
|
||||
}
|
||||
|
||||
function interfaceToColor(name) {
|
||||
// Try to load color map from style
|
||||
if (Style.interfaceColors[name]) {
|
||||
|
|
|
|||
|
|
@ -36,12 +36,19 @@ Item {
|
|||
"closablesensor": "green",
|
||||
"smartmeterproducer": "lightgreen",
|
||||
"extendedsmartmeterproducer": "lightgreen",
|
||||
"smartmeterconsumer": "orange",
|
||||
"extendedsmartmeterconsumer": "orange",
|
||||
"smartmeterconsumer": "deepskyblue",
|
||||
"extendedsmartmeterconsumer": "deepskyblue",
|
||||
"heating" : "gainsboro",
|
||||
"thermostat": "dodgerblue",
|
||||
"irrigation": "lightblue",
|
||||
"windspeedsensor": "blue",
|
||||
"ventilation": "lightblue"
|
||||
"ventilation": "lightblue",
|
||||
"watersensor": "aqua"
|
||||
}
|
||||
|
||||
property var stateColors: {
|
||||
"totalEnergyConsumed": "orange",
|
||||
"totalEnergyProduced": "lightgreen",
|
||||
"currentPower": "deepskyblue",
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,7 +37,8 @@ import Nymea 1.0
|
|||
|
||||
ChartView {
|
||||
id: chart
|
||||
backgroundColor: Style.backgroundColor
|
||||
backgroundColor: Style.tileBackgroundColor
|
||||
backgroundRoundness: Style.tileRadius
|
||||
theme: ChartView.ChartThemeLight
|
||||
legend.labelColor: Style.foregroundColor
|
||||
legend.font.pixelSize: app.smallFont
|
||||
|
|
|
|||
|
|
@ -44,13 +44,15 @@ Item {
|
|||
property Device device: null
|
||||
property StateType stateType: null
|
||||
property int roundTo: 2
|
||||
property color color: Style.accentColor
|
||||
property string iconSource: ""
|
||||
property alias title: titleLabel.text
|
||||
|
||||
readonly property var valueState: device.states.getState(stateType.id)
|
||||
readonly property var deviceClass: engine.deviceManager.deviceClasses.getDeviceClass(device.deviceClassId);
|
||||
readonly property bool hasConnectable: deviceClass.interfaces.indexOf("connectable") >= 0
|
||||
readonly property var connectedStateType: hasConnectable ? deviceClass.stateTypes.findByName("connected") : null
|
||||
|
||||
property color color: Style.accentColor
|
||||
property string iconSource: ""
|
||||
|
||||
LogsModelNg {
|
||||
id: logsModelNg
|
||||
|
|
@ -91,7 +93,7 @@ Item {
|
|||
animationOptions: ChartView.SeriesAnimations
|
||||
|
||||
RowLayout {
|
||||
anchors { left: parent.left; top: parent.top; right: parent.right; topMargin: app.margins / 2; leftMargin: app.margins; rightMargin: app.margins }
|
||||
anchors { left: parent.left; top: parent.top; right: parent.right; topMargin: app.margins / 2; leftMargin: app.margins * 1.5; rightMargin: app.margins }
|
||||
|
||||
ColorIcon {
|
||||
Layout.preferredHeight: app.iconSize
|
||||
|
|
@ -101,6 +103,7 @@ Item {
|
|||
color: root.color
|
||||
}
|
||||
Label {
|
||||
id: titleLabel
|
||||
Layout.fillWidth: true
|
||||
text: root.stateType.type.toLowerCase() === "bool"
|
||||
? root.stateType.displayName
|
||||
|
|
|
|||
|
|
@ -627,6 +627,7 @@ MainPageTile {
|
|||
ListElement { ifaceName: "presencesensor"; stateName: "isPresent" }
|
||||
ListElement { ifaceName: "closablesensor"; stateName: "closed" }
|
||||
ListElement { ifaceName: "lightsensor"; stateName: "lightIntensity" }
|
||||
ListElement { ifaceName: "watersensor"; stateName: "waterDetected" }
|
||||
ListElement { ifaceName: "co2sensor"; stateName: "co2" }
|
||||
ListElement { ifaceName: "conductivity"; stateName: "conductivity" }
|
||||
ListElement { ifaceName: "noisesensor"; stateName: "noise" }
|
||||
|
|
@ -717,6 +718,5 @@ MainPageTile {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -85,6 +85,7 @@ DeviceListPageBase {
|
|||
ListElement { interfaceName: "closablesensor"; stateName: "closed" }
|
||||
ListElement { interfaceName: "heating"; stateName: "power" }
|
||||
ListElement { interfaceName: "thermostat"; stateName: "targetTemperature" }
|
||||
ListElement { interfaceName: "watersensor"; stateName: "waterDetected" }
|
||||
}
|
||||
|
||||
delegate: RowLayout {
|
||||
|
|
@ -124,10 +125,12 @@ DeviceListPageBase {
|
|||
switch (model.interfaceName) {
|
||||
case "closablesensor":
|
||||
return sensorValueDelegate.stateValue && sensorValueDelegate.stateValue.value === true ? qsTr("Closed") : qsTr("Open");
|
||||
case "preencesensor":
|
||||
case "presencesensor":
|
||||
return sensorValueDelegate.stateValue && sensorValueDelegate.stateValue.value === true ? qsTr("Presence") : qsTr("Vacant");
|
||||
case "daylightsensor":
|
||||
return sensorValueDelegate.stateValue && sensorValueDelegate.stateValue.value === true ? qsTr("Daytime") : qsTr("Nighttime");
|
||||
case "watersensor":
|
||||
return sensorValueDelegate.stateValue && sensorValueDelegate.stateValue.value === true ? qsTr("Wet") : qsTr("Dry");
|
||||
case "heating":
|
||||
return sensorValueDelegate.stateValue && sensorValueDelegate.stateValue.value === true ? qsTr("On") : qsTr("Off");
|
||||
default:
|
||||
|
|
@ -144,7 +147,7 @@ DeviceListPageBase {
|
|||
}
|
||||
Led {
|
||||
id: led
|
||||
visible: sensorValueDelegate.stateType && sensorValueDelegate.stateType.type.toLowerCase() === "bool" && ["presencesensor", "daylightsensor", "heating", "closablesensor"].indexOf(model.interfaceName) < 0
|
||||
visible: sensorValueDelegate.stateType && sensorValueDelegate.stateType.type.toLowerCase() === "bool" && ["presencesensor", "daylightsensor", "heating", "closablesensor", "watersensor"].indexOf(model.interfaceName) < 0
|
||||
state: visible && sensorValueDelegate.stateValue.value === true ? "on" : "off"
|
||||
}
|
||||
Item {
|
||||
|
|
|
|||
|
|
@ -103,8 +103,8 @@ DeviceListPageBase {
|
|||
Layout.preferredHeight: app.iconSize
|
||||
Layout.preferredWidth: height
|
||||
Layout.alignment: Qt.AlignVCenter
|
||||
color: app.interfaceToColor(model.interfaceName)
|
||||
name: app.interfaceToIcon(model.interfaceName)
|
||||
color: app.stateColor(model.stateName)
|
||||
name: app.stateIcon(model.stateName)
|
||||
}
|
||||
|
||||
Label {
|
||||
|
|
|
|||
|
|
@ -41,18 +41,22 @@ DevicePageBase {
|
|||
Flickable {
|
||||
id: listView
|
||||
anchors { fill: parent }
|
||||
topMargin: app.margins / 2
|
||||
interactive: contentHeight > height
|
||||
contentHeight: contentGrid.implicitHeight
|
||||
|
||||
GridLayout {
|
||||
id: contentGrid
|
||||
width: parent.width
|
||||
width: parent.width - app.margins
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
columns: Math.ceil(width / 600)
|
||||
rowSpacing: 0
|
||||
columnSpacing: 0
|
||||
|
||||
Repeater {
|
||||
model: ListModel {
|
||||
Component.onCompleted: {
|
||||
var supportedInterfaces = ["temperaturesensor", "humiditysensor", "pressuresensor", "moisturesensor", "lightsensor", "conductivitysensor", "noisesensor", "co2sensor", "presencesensor", "daylightsensor", "closablesensor"]
|
||||
var supportedInterfaces = ["temperaturesensor", "humiditysensor", "pressuresensor", "moisturesensor", "lightsensor", "conductivitysensor", "noisesensor", "co2sensor", "presencesensor", "daylightsensor", "closablesensor", "watersensor"]
|
||||
for (var i = 0; i < supportedInterfaces.length; i++) {
|
||||
if (root.deviceClass.interfaces.indexOf(supportedInterfaces[i]) >= 0) {
|
||||
append({name: supportedInterfaces[i]});
|
||||
|
|
@ -67,6 +71,7 @@ DevicePageBase {
|
|||
Layout.preferredHeight: item.implicitHeight
|
||||
|
||||
property StateType stateType: root.deviceClass.stateTypes.findByName(interfaceStateMap[modelData])
|
||||
property State state: root.thing.stateByName(interfaceStateMap[modelData])
|
||||
property string interfaceName: modelData
|
||||
|
||||
// sourceComponent: stateType && stateType.type.toLowerCase() === "bool" ? boolComponent : graphComponent
|
||||
|
|
@ -83,7 +88,8 @@ DevicePageBase {
|
|||
"co2sensor": "co2",
|
||||
"presencesensor": "isPresent",
|
||||
"daylightsensor": "daylight",
|
||||
"closablesensor": "closed"
|
||||
"closablesensor": "closed",
|
||||
"watersensor": "waterDetected"
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -96,12 +102,32 @@ DevicePageBase {
|
|||
id: graphComponent
|
||||
|
||||
GenericTypeGraph {
|
||||
id: graph
|
||||
device: root.device
|
||||
color: app.interfaceToColor(interfaceName)
|
||||
iconSource: app.interfaceToIcon(interfaceName)
|
||||
implicitHeight: width * .6
|
||||
property string interfaceName: parent.interfaceName
|
||||
stateType: parent.stateType
|
||||
property State state: parent.state
|
||||
|
||||
Binding {
|
||||
target: graph
|
||||
property: "title"
|
||||
when: ["presencesensor", "daylightsensor", "closablesensor", "watersensor"].indexOf(graph.interfaceName) >= 0
|
||||
value: {
|
||||
switch (graph.interfaceName) {
|
||||
case "presencesensor":
|
||||
return graph.state.value === true ? qsTr("Presence") : qsTr("Vacant")
|
||||
case "daylightsensor":
|
||||
return graph.state.value === true ? qsTr("Daytimet") : qsTr("Nighttime")
|
||||
case "closablesensor":
|
||||
return graph.state.value === true ? qsTr("Closed") : qsTr("Open")
|
||||
case "watersensor":
|
||||
return graph.state.value === true ? qsTr("Wet") : qsTr("Dry")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -45,6 +45,7 @@ DevicePageBase {
|
|||
|
||||
Flickable {
|
||||
anchors.fill: parent
|
||||
topMargin: app.margins / 2
|
||||
contentHeight: contentGrid.height
|
||||
interactive: contentHeight > height
|
||||
|
||||
|
|
@ -56,13 +57,17 @@ DevicePageBase {
|
|||
|
||||
BigTile {
|
||||
Layout.preferredWidth: contentGrid.width / contentGrid.columns
|
||||
showHeader: false
|
||||
showHeader: true
|
||||
header: Label {
|
||||
text: qsTr("Total energy consumption")
|
||||
}
|
||||
|
||||
contentItem: RowLayout {
|
||||
ColorIcon {
|
||||
Layout.preferredHeight: app.iconSize
|
||||
Layout.preferredWidth: app.iconSize
|
||||
name: app.interfaceToIcon("smartmeterconsumer")
|
||||
color: app.interfaceToColor("smartmeterconsumer")
|
||||
name: app.stateIcon("totalEnergyConsumed")
|
||||
color: app.stateColor("totalEnergyConsumed")
|
||||
}
|
||||
|
||||
Label {
|
||||
|
|
@ -73,14 +78,16 @@ DevicePageBase {
|
|||
ColorIcon {
|
||||
Layout.preferredHeight: app.iconSize
|
||||
Layout.preferredWidth: app.iconSize
|
||||
name: app.interfaceToIcon("smartmeterproducer")
|
||||
color: app.interfaceToColor("smartmeterproducer")
|
||||
name: app.stateIcon("totalEnergyProduced")
|
||||
color: app.stateColor("totalEnergyProduced")
|
||||
visible: root.totalEnergyProducedState !== null
|
||||
}
|
||||
|
||||
Label {
|
||||
Layout.fillWidth: true
|
||||
text: root.totalEnergyProducedState.value.toFixed(2) + " " + root.totalEnergyProducedStateType.unitString
|
||||
font.pixelSize: app.largeFont
|
||||
visible: root.totalEnergyProducedState !== null
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -89,8 +96,8 @@ DevicePageBase {
|
|||
Layout.preferredWidth: contentGrid.width / contentGrid.columns
|
||||
device: root.device
|
||||
stateType: root.deviceClass.stateTypes.findByName("currentPower")
|
||||
color: app.interfaceToColor("smartmeterconsumer")
|
||||
iconSource: app.interfaceToIcon("smartmeterconsumer")
|
||||
color: app.stateColor("currentPower")
|
||||
iconSource: app.stateIcon("currentPower")
|
||||
roundTo: 5
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,177 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
width="96"
|
||||
height="96"
|
||||
id="svg4874"
|
||||
version="1.1"
|
||||
inkscape:version="1.0.1 (1.0.1+r74)"
|
||||
viewBox="0 0 96 96.000001"
|
||||
sodipodi:docname="water.svg">
|
||||
<defs
|
||||
id="defs4876" />
|
||||
<sodipodi:namedview
|
||||
id="base"
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1.0"
|
||||
inkscape:pageopacity="0.0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:zoom="5.6199993"
|
||||
inkscape:cx="42.494274"
|
||||
inkscape:cy="50.51304"
|
||||
inkscape:document-units="px"
|
||||
inkscape:current-layer="g4780"
|
||||
showgrid="true"
|
||||
showborder="true"
|
||||
fit-margin-top="0"
|
||||
fit-margin-left="0"
|
||||
fit-margin-right="0"
|
||||
fit-margin-bottom="0"
|
||||
inkscape:snap-bbox="true"
|
||||
inkscape:bbox-paths="true"
|
||||
inkscape:bbox-nodes="true"
|
||||
inkscape:snap-bbox-edge-midpoints="true"
|
||||
inkscape:snap-bbox-midpoints="true"
|
||||
inkscape:object-paths="true"
|
||||
inkscape:snap-intersection-paths="true"
|
||||
inkscape:object-nodes="true"
|
||||
inkscape:snap-smooth-nodes="true"
|
||||
inkscape:snap-midpoints="true"
|
||||
inkscape:snap-object-midpoints="true"
|
||||
inkscape:snap-center="true"
|
||||
showguides="true"
|
||||
inkscape:guide-bbox="true"
|
||||
inkscape:snap-global="true"
|
||||
inkscape:document-rotation="0"
|
||||
inkscape:window-width="1380"
|
||||
inkscape:window-height="873"
|
||||
inkscape:window-x="60"
|
||||
inkscape:window-y="27"
|
||||
inkscape:window-maximized="1">
|
||||
<inkscape:grid
|
||||
type="xygrid"
|
||||
id="grid5451"
|
||||
empspacing="8" />
|
||||
<sodipodi:guide
|
||||
orientation="1,0"
|
||||
position="8,-8.0000001"
|
||||
id="guide4063" />
|
||||
<sodipodi:guide
|
||||
orientation="1,0"
|
||||
position="4,-8.0000001"
|
||||
id="guide4065" />
|
||||
<sodipodi:guide
|
||||
orientation="0,1"
|
||||
position="-8,88.000001"
|
||||
id="guide4067" />
|
||||
<sodipodi:guide
|
||||
orientation="0,1"
|
||||
position="-8,92.000001"
|
||||
id="guide4069" />
|
||||
<sodipodi:guide
|
||||
orientation="0,1"
|
||||
position="104,4"
|
||||
id="guide4071" />
|
||||
<sodipodi:guide
|
||||
orientation="0,1"
|
||||
position="-5,8.0000001"
|
||||
id="guide4073" />
|
||||
<sodipodi:guide
|
||||
orientation="1,0"
|
||||
position="88,-8.0000001"
|
||||
id="guide4077" />
|
||||
<sodipodi:guide
|
||||
orientation="0,1"
|
||||
position="-8,84.000001"
|
||||
id="guide4074" />
|
||||
<sodipodi:guide
|
||||
orientation="1,0"
|
||||
position="12,-8.0000001"
|
||||
id="guide4076" />
|
||||
<sodipodi:guide
|
||||
orientation="1,0"
|
||||
position="84,-8.0000001"
|
||||
id="guide4080" />
|
||||
<sodipodi:guide
|
||||
position="48,-8.0000001"
|
||||
orientation="1,0"
|
||||
id="guide4170" />
|
||||
<sodipodi:guide
|
||||
position="-8,48"
|
||||
orientation="0,1"
|
||||
id="guide4172" />
|
||||
<sodipodi:guide
|
||||
position="92,-8.0000001"
|
||||
orientation="1,0"
|
||||
id="guide4760" />
|
||||
</sodipodi:namedview>
|
||||
<metadata
|
||||
id="metadata4879">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
<dc:title></dc:title>
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<g
|
||||
inkscape:label="Layer 1"
|
||||
inkscape:groupmode="layer"
|
||||
id="layer1"
|
||||
transform="translate(67.857146,-78.50504)">
|
||||
<g
|
||||
transform="matrix(0,-1,-1,0,373.50506,516.50504)"
|
||||
id="g4845"
|
||||
style="display:inline">
|
||||
<g
|
||||
inkscape:export-ydpi="90"
|
||||
inkscape:export-xdpi="90"
|
||||
inkscape:export-filename="next01.png"
|
||||
transform="matrix(-0.9996045,0,0,1,575.94296,-611.00001)"
|
||||
id="g4778"
|
||||
inkscape:label="Layer 1">
|
||||
<g
|
||||
transform="matrix(-1,0,0,1,575.99999,611)"
|
||||
id="g4780"
|
||||
style="display:inline">
|
||||
<rect
|
||||
style="color:#000000;display:inline;overflow:visible;visibility:visible;fill:none;stroke:none;stroke-width:4;marker:none;enable-background:accumulate"
|
||||
id="rect4782"
|
||||
width="96.037987"
|
||||
height="96"
|
||||
x="-438.00244"
|
||||
y="345.36221"
|
||||
transform="scale(-1,1)" />
|
||||
<path
|
||||
style="color:#000000;display:inline;overflow:visible;visibility:visible;fill:#808080;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.8;marker:none;enable-background:accumulate"
|
||||
d="m 410.99179,429.36224 h -4.0016 c 0,0 4.20227,-10.94333 4.00158,-19.82534 -0.20069,-8.88201 -7.79075,-23.17621 -8.00316,-32.09889 -0.21242,-8.92267 4.00158,-20.07579 4.00158,-20.07579 h 4.0016 c 0,0 -4.2233,11.28389 -4.00158,20.2116 0.22172,8.92771 7.80091,23.13419 8.00316,31.99414 0.20225,8.85995 -4.00158,19.79428 -4.00158,19.79428 z"
|
||||
id="path4182"
|
||||
inkscape:connector-curvature="0"
|
||||
sodipodi:nodetypes="cczzcczzc" />
|
||||
<path
|
||||
style="color:#000000;display:inline;overflow:visible;visibility:visible;fill:#808080;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.8;marker:none;enable-background:accumulate"
|
||||
d="m 392.09463,429.36224 h -4.0016 c 0,0 4.20227,-10.94333 4.00158,-19.82534 -0.20069,-8.88201 -7.79075,-23.17621 -8.00316,-32.09889 -0.21242,-8.92267 4.00158,-20.07579 4.00158,-20.07579 h 4.0016 c 0,0 -4.2233,11.28389 -4.00158,20.2116 0.22172,8.92771 7.80091,23.13419 8.00316,31.99414 0.20225,8.85995 -4.00158,19.79428 -4.00158,19.79428 z"
|
||||
id="path851"
|
||||
inkscape:connector-curvature="0"
|
||||
sodipodi:nodetypes="cczzcczzc" />
|
||||
<path
|
||||
style="color:#000000;display:inline;overflow:visible;visibility:visible;fill:#808080;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.8;marker:none;enable-background:accumulate"
|
||||
d="m 373.01945,429.36224 h -4.0016 c 0,0 4.20227,-10.94333 4.00158,-19.82534 -0.20069,-8.88201 -7.79075,-23.17621 -8.00316,-32.09889 -0.21242,-8.92267 4.00158,-20.07579 4.00158,-20.07579 h 4.0016 c 0,0 -4.2233,11.28389 -4.00158,20.2116 0.22172,8.92771 7.80091,23.13419 8.00316,31.99414 0.20225,8.85995 -4.00158,19.79428 -4.00158,19.79428 z"
|
||||
id="path853"
|
||||
inkscape:connector-curvature="0"
|
||||
sodipodi:nodetypes="cczzcczzc" />
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 6.5 KiB |
|
|
@ -79,7 +79,8 @@ MainViewBase {
|
|||
legend.alignment: Qt.AlignBottom
|
||||
legend.font.pixelSize: app.smallFont
|
||||
legend.visible: false
|
||||
backgroundColor: Style.backgroundColor
|
||||
backgroundColor: Style.tileBackgroundColor
|
||||
backgroundRoundness: Style.tileRadius
|
||||
titleColor: Style.foregroundColor
|
||||
title: qsTr("Power usage history")
|
||||
|
||||
|
|
@ -150,7 +151,7 @@ MainViewBase {
|
|||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
print("creating series")
|
||||
print("creating series", consumer.thing.name, index)
|
||||
seriesAdapter.ensureSamples(xAxis.min, xAxis.max)
|
||||
var areaSeries = chartView.createSeries(ChartView.SeriesTypeArea, consumer.thing.name, xAxis, yAxis)
|
||||
areaSeries.upperSeries = upperSeries;
|
||||
|
|
@ -179,8 +180,8 @@ MainViewBase {
|
|||
ValueAxis {
|
||||
id: yAxis
|
||||
readonly property XYSeriesAdapter adapter: consumersRepeater.itemAt(consumersRepeater.count - 1).adapter;
|
||||
max: Math.ceil(adapter.maxValue + Math.abs(adapter.maxValue * .05))
|
||||
min: Math.floor(adapter.minValue - Math.abs(adapter.minValue * .05))
|
||||
max: Math.ceil(Math.max(adapter.maxValue * 0.95, adapter.maxValue * 1.05))
|
||||
min: Math.floor(Math.min(adapter.minValue * 0.95, adapter.minValue * 1.05))
|
||||
// This seems to crash occationally
|
||||
// onMinChanged: applyNiceNumbers();
|
||||
// onMaxChanged: applyNiceNumbers();
|
||||
|
|
@ -354,6 +355,8 @@ MainViewBase {
|
|||
SmartMeterChart {
|
||||
Layout.fillWidth: true
|
||||
Layout.preferredHeight: width * .7
|
||||
backgroundColor: Style.tileBackgroundColor
|
||||
backgroundRoundness: Style.tileRadius
|
||||
meters: producers
|
||||
title: qsTr("Total produced energy")
|
||||
visible: producers.count > 0
|
||||
|
|
|
|||
Loading…
Reference in New Issue