thanks Matt, there’s two sets of data, kW on the left, Lux on the right. kW can be negative as it represents charge/discharge.
here’s the panel json
{
"id": 4,
"gridPos": {
"h": 13,
"w": 12,
"x": 0,
"y": 13
},
"type": "timeseries",
"title": "Charge vs Light",
"datasource": "InfluxDB (db)",
"fieldConfig": {
"defaults": {
"custom": {
"drawStyle": "line",
"lineInterpolation": "smooth",
"barAlignment": 0,
"lineWidth": 3,
"fillOpacity": 20,
"gradientMode": "opacity",
"spanNulls": false,
"showPoints": "never",
"pointSize": 5,
"stacking": {
"mode": "none",
"group": "A"
},
"axisPlacement": "auto",
"axisLabel": "",
"scaleDistribution": {
"type": "linear"
},
"hideFrom": {
"tooltip": false,
"viz": false,
"legend": false
},
"thresholdsStyle": {
"mode": "off"
}
},
"color": {
"mode": "palette-classic"
},
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
},
"mappings": [],
"noValue": "_",
"unit": "kwatt"
},
"overrides": [
{
"matcher": {
"id": "byName",
"options": "kW value {domain=\"sensor\", entity_id=\"solaredge_storage_power\"}"
},
"properties": [
{
"id": "displayName",
"value": "charge (SE)"
},
{
"id": "color",
"value": {
"fixedColor": "blue",
"mode": "fixed"
}
},
{
"id": "custom.lineWidth",
"value": 1
}
]
},
{
"matcher": {
"id": "byFrameRefID",
"options": "LIGHT"
},
"properties": [
{
"id": "custom.axisPlacement",
"value": "right"
},
{
"id": "unit",
"value": "lux"
},
{
"id": "custom.drawStyle",
"value": "line"
},
{
"id": "custom.lineInterpolation",
"value": "smooth"
},
{
"id": "custom.lineWidth",
"value": 0
},
{
"id": "color",
"value": {
"fixedColor": "light-yellow",
"mode": "fixed"
}
},
{
"id": "custom.fillOpacity",
"value": 24
},
{
"id": "custom.gradientMode",
"value": "none"
}
]
},
{
"matcher": {
"id": "byName",
"options": "lx value {domain=\"sensor\", entity_id=\"front_entry_motion_sensor_light_level\"}"
},
"properties": [
{
"id": "displayName",
"value": "light"
}
]
}
]
},
"options": {
"tooltip": {
"mode": "multi"
},
"legend": {
"displayMode": "list",
"placement": "bottom",
"calcs": []
}
},
"targets": [
{
"query": "from(bucket: \"test\")\n |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\n |> filter(fn: (r) => r[\"entity_id\"] == \"solaredge_storage_power\")\n |> filter(fn: (r) => r[\"_field\"] == \"value\")\n |> filter(fn: (r) => r[\"_measurement\"] == \"kW\")\n |> map(fn: (r) => ({\n r with _value:\n if r[\"entity_id\"] == \"solaredge_storage_power\" then\n r._value * -1.0\n else\n r._value\n }))\n |> aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)\n |> yield(name: \"mean\")",
"queryType": "randomWalk",
"refId": "SOLAREDGE"
},
{
"hide": false,
"query": "from(bucket: \"test\")\n |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\n |> filter(fn: (r) => r[\"entity_id\"] == \"front_entry_motion_sensor_light_level\")\n |> filter(fn: (r) => r[\"_field\"] == \"value\")\n |> aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)\n |> yield(name: \"mean\")",
"refId": "LIGHT"
}
],
"description": ""
}