Skip to content

Commit

Permalink
Fix - Solving issues with correct returns
Browse files Browse the repository at this point in the history
  • Loading branch information
davidusb-geek committed Apr 21, 2022
1 parent 7ec306b commit fa44651
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 9 deletions.
9 changes: 8 additions & 1 deletion emhass/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.1.27] - 2022-04-21
### Fix
- Fixing flask redirects and correct response returns.
- Updated to new emhass version using now pandas get_indexer method.

## [0.1.26] - 2022-04-21
### Fix
- Fixed missing imports in flask app.
Expand Down Expand Up @@ -71,4 +76,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
[0.1.22]: https://github.com/davidusb-geek/emhass-add-on/releases/tag/v0.1.22
[0.1.23]: https://github.com/davidusb-geek/emhass-add-on/releases/tag/v0.1.23
[0.1.24]: https://github.com/davidusb-geek/emhass-add-on/releases/tag/v0.1.24
[0.1.25]: https://github.com/davidusb-geek/emhass-add-on/releases/tag/v0.1.25
[0.1.25]: https://github.com/davidusb-geek/emhass-add-on/releases/tag/v0.1.25
[0.1.26]: https://github.com/davidusb-geek/emhass-add-on/releases/tag/v0.1.26
[0.1.27]: https://github.com/davidusb-geek/emhass-add-on/releases/tag/v0.1.27
10 changes: 4 additions & 6 deletions emhass/app_server.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/python

from flask import Flask, make_response, render_template, request, redirect, url_for
from flask import Flask, make_response, request, redirect, url_for
from flask_caching import Cache
from jinja2 import Environment, FileSystemLoader
from requests import get
Expand Down Expand Up @@ -68,7 +68,7 @@ def get_forecast_dates(freq, delta_forecast, timedelta_days = 0):
with options_json.open('r') as data:
options = json.load(data)
else:
app.logger.error("ERROR: options.json does not exists")
app.logger.error("options.json does not exists")

# Read example config file
if config_path.exists():
Expand All @@ -78,7 +78,7 @@ def get_forecast_dates(freq, delta_forecast, timedelta_days = 0):
optim_conf = config['optim_conf']
plant_conf = config['plant_conf']
else:
app.logger.error("ERROR: config_emhass.json does not exists")
app.logger.error("config_emhass.json does not exists")

params = {}
params['retrieve_hass_conf'] = retrieve_hass_conf
Expand All @@ -102,7 +102,7 @@ def get_forecast_dates(freq, delta_forecast, timedelta_days = 0):
def index():
app.logger.info("EMHASS server online, serving index.html...")
source_html = cache.get("source_html")
return source_html
return make_response(source_html)

@app.route('/action/<name>', methods=['POST'])
def action_call(name):
Expand Down Expand Up @@ -155,8 +155,6 @@ def action_call(name):
else:
app.logger.error("ERROR: passed action is not valid")
return redirect(url_for(".index"))
msg = f'EMHASS >> Action {name} received... \n'
return make_response(msg, 201)

def main():
# Parsing arguments
Expand Down
2 changes: 1 addition & 1 deletion emhass/config.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: EMHASS
description: Energy Management for Home Assistant
url: https://github.com/davidusb-geek/emhass
version: 0.1.26
version: 0.1.27
slug: emhass
arch:
- aarch64
Expand Down
2 changes: 1 addition & 1 deletion emhass/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ tables>=3.6.1
flask>=2.0.3
Flask-Caching>=1.10.1
plotly>=5.6.0
emhass==0.2.8
emhass==0.2.9
#git+https://github.com/davidusb-geek/emhass.git@0f67c27

0 comments on commit fa44651

Please sign in to comment.