chart visualization improvements, connect to service.watt42.com by default
This commit is contained in:
parent
fe0979083f
commit
cd76a9e4e0
1 changed files with 16 additions and 3 deletions
19
sample2.py
19
sample2.py
|
|
@ -93,26 +93,39 @@ def load_fc_chart(state: SystemState) -> dict:
|
||||||
{
|
{
|
||||||
'name': 'Load Forecast',
|
'name': 'Load Forecast',
|
||||||
'data': slots,
|
'data': slots,
|
||||||
'type': 'line'
|
'type': 'line',
|
||||||
|
"showSymbol": False,
|
||||||
}, {
|
}, {
|
||||||
'name': 'Battery Storage',
|
'name': 'Battery Storage',
|
||||||
'data': storage,
|
'data': storage,
|
||||||
'type': 'line',
|
'type': 'line',
|
||||||
|
"showSymbol": False,
|
||||||
'color': 'orange'
|
'color': 'orange'
|
||||||
}, {
|
}, {
|
||||||
'name': 'Battery in/out',
|
'name': 'Battery in/out',
|
||||||
'data': battery,
|
'data': battery,
|
||||||
'type': 'line',
|
'type': 'line',
|
||||||
|
"showSymbol": False,
|
||||||
'color': 'lightblue'
|
'color': 'lightblue'
|
||||||
}, {
|
}, {
|
||||||
'name': 'PV Forecast',
|
'name': 'PV Forecast',
|
||||||
'data': state.pv_forecast.slots,
|
'data': state.pv_forecast.slots,
|
||||||
'type': 'line',
|
'type': 'line',
|
||||||
|
"showSymbol": False,
|
||||||
|
"itemStyle": {
|
||||||
|
"color": "#91CC75",
|
||||||
|
"opacity": 0.5,
|
||||||
|
},
|
||||||
|
"areaStyle": {
|
||||||
|
"color": "#91CC75",
|
||||||
|
"opacity": 0.3,
|
||||||
|
},
|
||||||
'color': 'green'
|
'color': 'green'
|
||||||
}, {
|
}, {
|
||||||
'name': 'Grid in/out',
|
'name': 'Grid in/out',
|
||||||
'data': grid,
|
'data': grid,
|
||||||
'type': 'line',
|
'type': 'line',
|
||||||
|
"showSymbol": False,
|
||||||
'color': 'red'
|
'color': 'red'
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
@ -159,13 +172,13 @@ datetime_fmt = "%Y-%m-%d %H:%M:%S"
|
||||||
|
|
||||||
config_editor = panel.widgets.JSONEditor(value=state.config.model_dump(), mode='form', height=200, width=400, menu=False)
|
config_editor = panel.widgets.JSONEditor(value=state.config.model_dump(), mode='form', height=200, width=400, menu=False)
|
||||||
|
|
||||||
SCRIPT_ID = "23a6d15a-f7e3-4ff1-b3c1-94d297c972c9"
|
SCRIPT_ID = os.environ.get("SCRIPT_ID", "23a6d15a-f7e3-4ff1-b3c1-94d297c972c9")
|
||||||
|
|
||||||
async def process_config_change(_btn):
|
async def process_config_change(_btn):
|
||||||
from httpx import AsyncClient
|
from httpx import AsyncClient
|
||||||
async with AsyncClient() as client:
|
async with AsyncClient() as client:
|
||||||
response = await client.post(
|
response = await client.post(
|
||||||
f"http://localhost:8000/api/scripts/{SCRIPT_ID}/execute?system_guid={SYSTEM_ID}",
|
f"https://service.watt42.com/api/scripts/{SCRIPT_ID}/execute?system_guid={SYSTEM_ID}",
|
||||||
json={
|
json={
|
||||||
'signal': 'update_config',
|
'signal': 'update_config',
|
||||||
'request_body': config_editor.value,
|
'request_body': config_editor.value,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue