emhass 0.8.1__py3-none-any.whl → 0.8.2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- emhass/forecast.py +3 -3
- emhass/optimization.py +3 -0
- emhass/retrieve_hass.py +1 -1
- emhass/static/advanced.html +32 -0
- emhass/static/basic.html +12 -0
- emhass/static/img/feather-sprite.svg +1 -0
- emhass/static/script.js +425 -0
- emhass/static/style.css +132 -23
- emhass/templates/index.html +36 -340
- emhass/templates/template.html +1 -0
- emhass/web_server.py +63 -19
- {emhass-0.8.1.dist-info → emhass-0.8.2.dist-info}/METADATA +30 -24
- emhass-0.8.2.dist-info/RECORD +23 -0
- emhass-0.8.1.dist-info/RECORD +0 -19
- {emhass-0.8.1.dist-info → emhass-0.8.2.dist-info}/LICENSE +0 -0
- {emhass-0.8.1.dist-info → emhass-0.8.2.dist-info}/WHEEL +0 -0
- {emhass-0.8.1.dist-info → emhass-0.8.2.dist-info}/entry_points.txt +0 -0
- {emhass-0.8.1.dist-info → emhass-0.8.2.dist-info}/top_level.txt +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: emhass
|
3
|
-
Version: 0.8.
|
3
|
+
Version: 0.8.2
|
4
4
|
Summary: An Energy Management System for Home Assistant
|
5
5
|
Home-page: https://github.com/davidusb-geek/emhass
|
6
6
|
Author: David HERNANDEZ
|
@@ -16,8 +16,8 @@ Requires-Python: >=3.9, <3.12
|
|
16
16
|
Description-Content-Type: text/markdown
|
17
17
|
License-File: LICENSE
|
18
18
|
Requires-Dist: wheel
|
19
|
-
Requires-Dist: numpy
|
20
|
-
Requires-Dist: scipy
|
19
|
+
Requires-Dist: numpy ==1.26.4
|
20
|
+
Requires-Dist: scipy ==1.12.0
|
21
21
|
Requires-Dist: pandas <=2.0.3
|
22
22
|
Requires-Dist: pvlib >=0.10.2
|
23
23
|
Requires-Dist: protobuf >=3.0.0
|
@@ -132,16 +132,16 @@ These architectures are supported: `amd64`, `armv7`, `armhf` and `aarch64`.
|
|
132
132
|
### Method 2) Using Docker in standalone mode
|
133
133
|
|
134
134
|
You can also install EMHASS using docker. This can be in the same machine as Home Assistant (if using the supervised install method) or in a different distant machine. To install first pull the latest image from docker hub:
|
135
|
-
```
|
135
|
+
```bash
|
136
136
|
docker pull davidusb/emhass-docker-standalone
|
137
137
|
```
|
138
138
|
|
139
139
|
You can also build your image locally. For this clone this repository, setup your `config_emhass.yaml` file and use the provided make file with this command:
|
140
|
-
```
|
140
|
+
```bash
|
141
141
|
make -f deploy_docker.mk clean_deploy
|
142
142
|
```
|
143
143
|
Then load the image in the .tar file:
|
144
|
-
```
|
144
|
+
```bash
|
145
145
|
docker load -i <TarFileName>.tar
|
146
146
|
```
|
147
147
|
Finally check your image tag with `docker images` and launch the docker itself:
|
@@ -159,17 +159,17 @@ docker run -it --restart always -p 5000:5000 -e "LOCAL_COSTFUN=profit" -v $(pwd)
|
|
159
159
|
|
160
160
|
With this method it is recommended to install on a virtual environment.
|
161
161
|
For this you will need `virtualenv`, install it using:
|
162
|
-
```
|
162
|
+
```bash
|
163
163
|
sudo apt install python3-virtualenv
|
164
164
|
```
|
165
165
|
Then create and activate the virtual environment:
|
166
|
-
```
|
166
|
+
```bash
|
167
167
|
virtualenv -p /usr/bin/python3 emhassenv
|
168
168
|
cd emhassenv
|
169
169
|
source bin/activate
|
170
170
|
```
|
171
171
|
Install using the distribution files:
|
172
|
-
```
|
172
|
+
```bash
|
173
173
|
python3 -m pip install emhass
|
174
174
|
```
|
175
175
|
Clone this repository to obtain the example configuration files.
|
@@ -180,7 +180,7 @@ We will suppose that this repository is cloned to:
|
|
180
180
|
This will be the root path containing the yaml configuration files (`config_emhass.yaml` and `secrets_emhass.yaml`) and the different needed folders (a `data` folder to store the optimizations results and a `scripts` folder containing the bash scripts described further below).
|
181
181
|
|
182
182
|
To upgrade the installation in the future just use:
|
183
|
-
```
|
183
|
+
```bash
|
184
184
|
python3 -m pip install --upgrade emhass
|
185
185
|
```
|
186
186
|
|
@@ -216,7 +216,7 @@ The available arguments are:
|
|
216
216
|
- `--version`: Show the current version of EMHASS.
|
217
217
|
|
218
218
|
For example, the following line command can be used to perform a day-ahead optimization task:
|
219
|
-
```
|
219
|
+
```bash
|
220
220
|
emhass --action 'dayahead-optim' --config '/home/user/emhass/config_emhass.yaml' --costfun 'profit'
|
221
221
|
```
|
222
222
|
Before running any valuable command you need to modify the `config_emhass.yaml` and `secrets_emhass.yaml` files. These files should contain the information adapted to your own system. To do this take a look at the special section for this in the [documentation](https://emhass.readthedocs.io/en/latest/config.html).
|
@@ -230,7 +230,7 @@ Then additional optimization strategies were developed, that can be used in comb
|
|
230
230
|
### Dayahead Optimization - Method 1) Add-on and docker standalone
|
231
231
|
|
232
232
|
In `configuration.yaml`:
|
233
|
-
```
|
233
|
+
```yaml
|
234
234
|
shell_command:
|
235
235
|
dayahead_optim: "curl -i -H \"Content-Type:application/json\" -X POST -d '{}' http://localhost:5000/action/dayahead-optim"
|
236
236
|
publish_data: "curl -i -H \"Content-Type:application/json\" -X POST -d '{}' http://localhost:5000/action/publish-data"
|
@@ -238,25 +238,25 @@ shell_command:
|
|
238
238
|
### Dayahead Optimization - Method 2) Legacy method using a Python virtual environment
|
239
239
|
|
240
240
|
In `configuration.yaml`:
|
241
|
-
```
|
241
|
+
```yaml
|
242
242
|
shell_command:
|
243
243
|
dayahead_optim: /home/user/emhass/scripts/dayahead_optim.sh
|
244
244
|
publish_data: /home/user/emhass/scripts/publish_data.sh
|
245
245
|
```
|
246
246
|
Create the file `dayahead_optim.sh` with the following content:
|
247
|
-
```
|
247
|
+
```bash
|
248
248
|
#!/bin/bash
|
249
249
|
. /home/user/emhassenv/bin/activate
|
250
250
|
emhass --action 'dayahead-optim' --config '/home/user/emhass/config_emhass.yaml'
|
251
251
|
```
|
252
252
|
And the file `publish_data.sh` with the following content:
|
253
|
-
```
|
253
|
+
```bash
|
254
254
|
#!/bin/bash
|
255
255
|
. /home/user/emhassenv/bin/activate
|
256
256
|
emhass --action 'publish-data' --config '/home/user/emhass/config_emhass.yaml'
|
257
257
|
```
|
258
258
|
Then specify user rights and make the files executables:
|
259
|
-
```
|
259
|
+
```bash
|
260
260
|
sudo chmod -R 755 /home/user/emhass/scripts/dayahead_optim.sh
|
261
261
|
sudo chmod -R 755 /home/user/emhass/scripts/publish_data.sh
|
262
262
|
sudo chmod +x /home/user/emhass/scripts/dayahead_optim.sh
|
@@ -265,7 +265,7 @@ sudo chmod +x /home/user/emhass/scripts/publish_data.sh
|
|
265
265
|
### Common for any installation method
|
266
266
|
|
267
267
|
In `automations.yaml`:
|
268
|
-
```
|
268
|
+
```yaml
|
269
269
|
- alias: EMHASS day-ahead optimization
|
270
270
|
trigger:
|
271
271
|
platform: time
|
@@ -282,7 +282,7 @@ In `automations.yaml`:
|
|
282
282
|
In these automations the day-ahead optimization is performed everyday at 5:30am and the data is published every 5 minutes.
|
283
283
|
|
284
284
|
The final action will be to link a sensor value in Home Assistant to control the switch of a desired controllable load. For example imagine that I want to control my water heater and that the `publish-data` action is publishing the optimized value of a deferrable load that I want to be linked to my water heater desired behavior. In this case we could use an automation like this one below to control the desired real switch:
|
285
|
-
```
|
285
|
+
```yaml
|
286
286
|
automation:
|
287
287
|
- alias: Water Heater Optimized ON
|
288
288
|
trigger:
|
@@ -297,7 +297,7 @@ automation:
|
|
297
297
|
entity_id: switch.water_heater_switch
|
298
298
|
```
|
299
299
|
A second automation should be used to turn off the switch:
|
300
|
-
```
|
300
|
+
```yaml
|
301
301
|
automation:
|
302
302
|
- alias: Water Heater Optimized OFF
|
303
303
|
trigger:
|
@@ -319,7 +319,7 @@ The `publish-data` command will push to Home Assistant the optimization results
|
|
319
319
|
The `publish-data` command will also publish PV and load forecast data on sensors `p_pv_forecast` and `p_load_forecast`. If using a battery, then the battery optimized power and the SOC will be published on sensors `p_batt_forecast` and `soc_batt_forecast`. On these sensors the future values are passed as nested attributes.
|
320
320
|
|
321
321
|
It is possible to provide custm sensor names for all the data exported by the `publish-data` command. For this, when using the `publish-data` endpoint just add some runtime parameters as dictionaries like this:
|
322
|
-
```
|
322
|
+
```yaml
|
323
323
|
shell_command:
|
324
324
|
publish_data: "curl -i -H \"Content-Type:application/json\" -X POST -d '{\"custom_load_forecast_id\": {\"entity_id\": \"sensor.p_load_forecast\", \"unit_of_measurement\": \"W\", \"friendly_name\": \"Load Power Forecast\"}}' http://localhost:5000/action/publish-data"
|
325
325
|
```
|
@@ -327,7 +327,7 @@ shell_command:
|
|
327
327
|
These keys are available to modify: `custom_pv_forecast_id`, `custom_load_forecast_id`, `custom_batt_forecast_id`, `custom_batt_soc_forecast_id`, `custom_grid_forecast_id`, `custom_cost_fun_id`, `custom_deferrable_forecast_id`, `custom_unit_load_cost_id` and `custom_unit_prod_price_id`.
|
328
328
|
|
329
329
|
If you provide the `custom_deferrable_forecast_id` then the passed data should be a list of dictionaries, like this:
|
330
|
-
```
|
330
|
+
```yaml
|
331
331
|
shell_command:
|
332
332
|
publish_data: "curl -i -H \"Content-Type:application/json\" -X POST -d '{\"custom_deferrable_forecast_id\": [{\"entity_id\": \"sensor.p_deferrable0\",\"unit_of_measurement\": \"W\", \"friendly_name\": \"Deferrable Load 0\"},{\"entity_id\": \"sensor.p_deferrable1\",\"unit_of_measurement\": \"W\", \"friendly_name\": \"Deferrable Load 1\"}]}' http://localhost:5000/action/publish-data"
|
333
333
|
```
|
@@ -377,11 +377,11 @@ The valid values to pass for both forecast data and MPC related data are explain
|
|
377
377
|
It is possible to provide EMHASS with your own forecast data. For this just add the data as list of values to a data dictionary during the call to `emhass` using the `runtimeparams` option.
|
378
378
|
|
379
379
|
For example if using the add-on or the standalone docker installation you can pass this data as list of values to the data dictionary during the `curl` POST:
|
380
|
-
```
|
380
|
+
```bash
|
381
381
|
curl -i -H 'Content-Type:application/json' -X POST -d '{"pv_power_forecast":[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 70, 141.22, 246.18, 513.5, 753.27, 1049.89, 1797.93, 1697.3, 3078.93, 1164.33, 1046.68, 1559.1, 2091.26, 1556.76, 1166.73, 1516.63, 1391.13, 1720.13, 820.75, 804.41, 251.63, 79.25, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]}' http://localhost:5000/action/dayahead-optim
|
382
382
|
```
|
383
383
|
Or if using the legacy method using a Python virtual environment:
|
384
|
-
```
|
384
|
+
```bash
|
385
385
|
emhass --action 'dayahead-optim' --config '/home/user/emhass/config_emhass.yaml' --runtimeparams '{"pv_power_forecast":[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 70, 141.22, 246.18, 513.5, 753.27, 1049.89, 1797.93, 1697.3, 3078.93, 1164.33, 1046.68, 1559.1, 2091.26, 1556.76, 1166.73, 1516.63, 1391.13, 1720.13, 820.75, 804.41, 251.63, 79.25, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]}'
|
386
386
|
```
|
387
387
|
|
@@ -454,10 +454,16 @@ When applying this controller, the following `runtimeparams` should be defined:
|
|
454
454
|
|
455
455
|
A correct call for a MPC optimization should look like:
|
456
456
|
|
457
|
+
```bash
|
458
|
+
curl -i -H 'Content-Type:application/json' -X POST -d '{"pv_power_forecast":[0, 70, 141.22, 246.18, 513.5, 753.27, 1049.89, 1797.93, 1697.3, 3078.93], "prediction_horizon":10, "soc_init":0.5,"soc_final":0.6}' http://192.168.3.159:5000/action/naive-mpc-optim
|
457
459
|
```
|
458
|
-
|
460
|
+
*Example with :`def_total_hours`, `def_start_timestep`, `def_end_timestep`.*
|
461
|
+
```bash
|
462
|
+
curl -i -H 'Content-Type:application/json' -X POST -d '{"pv_power_forecast":[0, 70, 141.22, 246.18, 513.5, 753.27, 1049.89, 1797.93, 1697.3, 3078.93], "prediction_horizon":10, "soc_init":0.5,"soc_final":0.6,"def_total_hours":[1,3],"def_start_timestep":[0,3],"def_end_timestep":[0,6]}' http://localhost:5000/action/naive-mpc-optim
|
459
463
|
```
|
460
464
|
|
465
|
+
|
466
|
+
|
461
467
|
## A machine learning forecaster
|
462
468
|
|
463
469
|
Starting in v0.4.0 a new machine learning forecaster class was introduced.
|
@@ -0,0 +1,23 @@
|
|
1
|
+
emhass/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
2
|
+
emhass/command_line.py,sha256=f8u1gNo5NhXF1dYMTFPDc3En34yH0sW4lFu3dqTJNf0,37424
|
3
|
+
emhass/forecast.py,sha256=2_Dm03_XyEVPYnKnJzA5TABYgt3tCe9_zRDGOOfFtEM,43555
|
4
|
+
emhass/machine_learning_forecaster.py,sha256=8Rm0-pltsjIYqLv01zCeO_Ij_n2HKC62dv_kCno7UsU,15640
|
5
|
+
emhass/optimization.py,sha256=M9BlbJ4f38APoIsHKLY_pfKszVWA61cPv_QnmtazkRA,37181
|
6
|
+
emhass/retrieve_hass.py,sha256=0v-CRFvhJgtT27AlDh0QL8f3PlZYNNMfw1fxGVwobg4,18356
|
7
|
+
emhass/utils.py,sha256=Slme0gYyXE9LwWO-8yOALZua7civhdhCoiv0h89ivdA,46114
|
8
|
+
emhass/web_server.py,sha256=u5UEAI4EsrZg35_M2pctwPMOK2SPblBZX8l0zjLWp5A,21300
|
9
|
+
emhass/static/advanced.html,sha256=AsT3lMD0AjvAqzAYvUPmslyOYk2C3LA-VfoSB2PwnYA,1747
|
10
|
+
emhass/static/basic.html,sha256=hJ4EgCXVNHL5nMQWkIHWjsTm_bJb0N_ZN4zFUjhxEzU,608
|
11
|
+
emhass/static/script.js,sha256=k3srZCNWLAduZzHzEjSyS2qttjKXpiI1WAh8CrJpQKY,17512
|
12
|
+
emhass/static/style.css,sha256=2sGD6OF33tx3-sAoZQvDvVcF67RkGNf3Xi0PMoRB34A,14952
|
13
|
+
emhass/static/img/emhass_icon.png,sha256=Kyx6hXQ1huJLHAq2CaBfjYXR25H9j99PSWHI0lShkaQ,19030
|
14
|
+
emhass/static/img/emhass_logo_short.svg,sha256=yzMcqtBRCV8rH84-MwnigZh45_f9Eoqwho9P8nCodJA,66736
|
15
|
+
emhass/static/img/feather-sprite.svg,sha256=VHjMJQg88wXa9CaeYrKGhNtyK0xdd47zCqwSIa-hxo8,60319
|
16
|
+
emhass/templates/index.html,sha256=OwmgZW8a4Powuzz9KOL-F3XAwSK5i0oi8RF4vJ8ptnQ,2652
|
17
|
+
emhass/templates/template.html,sha256=MXQsd1a1UcrwBUXEly7bq0jlS7Yj4kzvrLYEtjKhwtQ,237
|
18
|
+
emhass-0.8.2.dist-info/LICENSE,sha256=1X3-S1yvOCBDBeox1aK3dq00m7dA8NDtcPrpKPISzbE,1077
|
19
|
+
emhass-0.8.2.dist-info/METADATA,sha256=5CAGAS2Gb9Im0iuxfh_QMaVNyA44faS4gq43nify0PQ,34393
|
20
|
+
emhass-0.8.2.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
|
21
|
+
emhass-0.8.2.dist-info/entry_points.txt,sha256=6Bp1NFOGNv_fSTxYl1ke3K3h3aqAcBxI-bgq5yq-i1M,52
|
22
|
+
emhass-0.8.2.dist-info/top_level.txt,sha256=L7fIX4awfmxQbAePtSdVg2e6x_HhghfReHfsKSpKr9I,7
|
23
|
+
emhass-0.8.2.dist-info/RECORD,,
|
emhass-0.8.1.dist-info/RECORD
DELETED
@@ -1,19 +0,0 @@
|
|
1
|
-
emhass/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
2
|
-
emhass/command_line.py,sha256=f8u1gNo5NhXF1dYMTFPDc3En34yH0sW4lFu3dqTJNf0,37424
|
3
|
-
emhass/forecast.py,sha256=5g-UIzYZAr91KRhjUaUeat1zkhluTIeqaMLmKCRtGkI,43428
|
4
|
-
emhass/machine_learning_forecaster.py,sha256=8Rm0-pltsjIYqLv01zCeO_Ij_n2HKC62dv_kCno7UsU,15640
|
5
|
-
emhass/optimization.py,sha256=7CM5_oA16ai40RSBk_izwOPxnq-GPyGQDUjTffIp0lI,36887
|
6
|
-
emhass/retrieve_hass.py,sha256=i9kPsrIRLsl985wZERGdYbGcB79KV-NQYSmrs-_cZAk,18314
|
7
|
-
emhass/utils.py,sha256=Slme0gYyXE9LwWO-8yOALZua7civhdhCoiv0h89ivdA,46114
|
8
|
-
emhass/web_server.py,sha256=IVoqR55JwMvR0YcaqCnDfQkobGiwvCqXMe8B6-piJW8,18188
|
9
|
-
emhass/static/style.css,sha256=E1whggyNxv7U8nF-KSJMic6ZBuakjkJm_wIEXvaWcFI,13293
|
10
|
-
emhass/static/img/emhass_icon.png,sha256=Kyx6hXQ1huJLHAq2CaBfjYXR25H9j99PSWHI0lShkaQ,19030
|
11
|
-
emhass/static/img/emhass_logo_short.svg,sha256=yzMcqtBRCV8rH84-MwnigZh45_f9Eoqwho9P8nCodJA,66736
|
12
|
-
emhass/templates/index.html,sha256=1TNIX34_Z92RGBan-8M_dF5ptO4b-D9V40KCpjdJzgc,17939
|
13
|
-
emhass/templates/template.html,sha256=TkGgMecQEbFUZA4ymPwMUzNjKHsENvCgroUWbPt7G4Y,158
|
14
|
-
emhass-0.8.1.dist-info/LICENSE,sha256=1X3-S1yvOCBDBeox1aK3dq00m7dA8NDtcPrpKPISzbE,1077
|
15
|
-
emhass-0.8.1.dist-info/METADATA,sha256=kwGoL3zJ8TaHxawFVQRaM3rbUWSuGszu59OF7aGkiLM,33959
|
16
|
-
emhass-0.8.1.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
|
17
|
-
emhass-0.8.1.dist-info/entry_points.txt,sha256=6Bp1NFOGNv_fSTxYl1ke3K3h3aqAcBxI-bgq5yq-i1M,52
|
18
|
-
emhass-0.8.1.dist-info/top_level.txt,sha256=L7fIX4awfmxQbAePtSdVg2e6x_HhghfReHfsKSpKr9I,7
|
19
|
-
emhass-0.8.1.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|