Fast JS loading: https://web.archive.org/web/20200108190917/https://humanwhocodes.com/blog/2009/07/28/the-best-way-to-load-external-javascript/ aiohttp websockets: https://web.archive.org/web/20200108235147/https://aiohttp.readthedocs.io/en/stable/web_quickstart.html#websockets aiohttp static files: https://aiohttp.readthedocs.io/en/stable/web_reference.html#aiohttp.web.UrlDispatcher.add_static aiohttp client response: https://aiohttp.readthedocs.io/en/stable/client_reference.html#aiohttp.ClientResponse WebSocket JS specification: https://web.archive.org/web/20200109005314/https://html.spec.whatwg.org/multipage/web-sockets.html#dom-websocket Lazy loading HighCharts: https://web.archive.org/web/20200109045439/https://www.highcharts.com/stock/demo/lazy-loading Dynamicly adding data: https://web.archive.org/web/20200109045531/https://www.highcharts.com/docs/working-with-data/live-data#2-api-methods uses afterSetExtremes event on xAxis to load data, which then set's it via setData Stacked area chart: https://web.archive.org/web/20200109053708/https://www.highcharts.com/demo/area-stacked Running Python code in browser: https://github.com/brython-dev/brython Range series, for showing min/max and avg: https://www.highcharts.com/docs/chart-and-series-types/range-series Graphs ------ Note: HighCharts uses milliseconds since unix epoch for time stamps. (make an option to set the "zero" line, i.e. absolute, or consumption (i.e. net gen/consumption vs solar) Proposed graphs: Daily solar production total daily consumption total Per panel stacked production current production and consumption (5 minute intervals?) Grid Import/Export navigation: net import by hour or six hours Solar Panel navigation: solar production by hour Navigation data needs to be generated as part of the index generation. Maybe heatmap for solar panels Use removePoint and addPoint: https://web.archive.org/web/20200109083308/https://api.highcharts.com/class-reference/Highcharts.Series.html to add/remove the end null point and add points as they dynamically arrive Sample Home power Consumption dataset: https://archive.ics.uci.edu/ml/datasets/individual+household+electric+power+consumption List of Solar resources: https://energydemo.github.io/SolarDatasets/ https://pvoutput.org WebSocket Definition -------------------- Messages to the websocket: q Quit Messages from the websocket: id description c Consumption -- current power consumed Sent for each update. units kW. ng Net Grid -- What the current power draw is from the grid (negative when sending power). Sent for each update. units kW. p Solar production -- current power produced by the solar panels in aggregate. Sent for each update. units kW. ov overview of data, contains gird, production and consumption data. following is JSON object win The graph has set a window size. The two arguments are start and end. If this is the first time, NaN will be sent for both, which means to send all data. windata Data in response to a window command. The format is an object w/ the keys, production, grid and consumption. Each will be a list of data points. Each point is a pair of timestamp in miliseconds and the value for the point. It should include a point just before and just after the time range so that lines off the graph are rendered properly. One the first connection, the following messages/data will be sent: c, ng, p, ov The following will be sent as they are updated: c, ng, p