emhass 0.8.0__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 +66 -23
- {emhass-0.8.0.dist-info → emhass-0.8.2.dist-info}/METADATA +37 -25
- emhass-0.8.2.dist-info/RECORD +23 -0
- emhass-0.8.0.dist-info/RECORD +0 -19
- {emhass-0.8.0.dist-info → emhass-0.8.2.dist-info}/LICENSE +0 -0
- {emhass-0.8.0.dist-info → emhass-0.8.2.dist-info}/WHEEL +0 -0
- {emhass-0.8.0.dist-info → emhass-0.8.2.dist-info}/entry_points.txt +0 -0
- {emhass-0.8.0.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,38 +132,44 @@ 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:
|
148
|
-
```
|
148
|
+
```bash
|
149
149
|
docker run -it --restart always -p 5000:5000 -e "LOCAL_COSTFUN=profit" -v $(pwd)/config_emhass.yaml:/app/config_emhass.yaml -v $(pwd)/secrets_emhass.yaml:/app/secrets_emhass.yaml --name DockerEMHASS <REPOSITORY:TAG>
|
150
150
|
```
|
151
|
+
- If you wish to keep a local, persistent copy of the EMHASS generated data, create a local folder on your device, then mount said folder inside the container.
|
152
|
+
```bash
|
153
|
+
mkdir -p $(pwd)/data #linux: create data folder on local device
|
154
|
+
|
155
|
+
docker run -it --restart always -p 5000:5000 -e "LOCAL_COSTFUN=profit" -v $(pwd)/config_emhass.yaml:/app/config_emhass.yaml -v $(pwd)/data:/app/data -v $(pwd)/secrets_emhass.yaml:/app/secrets_emhass.yaml --name DockerEMHASS <REPOSITORY:TAG>
|
156
|
+
```
|
151
157
|
|
152
158
|
### Method 3) Legacy method using a Python virtual environment
|
153
159
|
|
154
160
|
With this method it is recommended to install on a virtual environment.
|
155
161
|
For this you will need `virtualenv`, install it using:
|
156
|
-
```
|
162
|
+
```bash
|
157
163
|
sudo apt install python3-virtualenv
|
158
164
|
```
|
159
165
|
Then create and activate the virtual environment:
|
160
|
-
```
|
166
|
+
```bash
|
161
167
|
virtualenv -p /usr/bin/python3 emhassenv
|
162
168
|
cd emhassenv
|
163
169
|
source bin/activate
|
164
170
|
```
|
165
171
|
Install using the distribution files:
|
166
|
-
```
|
172
|
+
```bash
|
167
173
|
python3 -m pip install emhass
|
168
174
|
```
|
169
175
|
Clone this repository to obtain the example configuration files.
|
@@ -174,7 +180,7 @@ We will suppose that this repository is cloned to:
|
|
174
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).
|
175
181
|
|
176
182
|
To upgrade the installation in the future just use:
|
177
|
-
```
|
183
|
+
```bash
|
178
184
|
python3 -m pip install --upgrade emhass
|
179
185
|
```
|
180
186
|
|
@@ -210,7 +216,7 @@ The available arguments are:
|
|
210
216
|
- `--version`: Show the current version of EMHASS.
|
211
217
|
|
212
218
|
For example, the following line command can be used to perform a day-ahead optimization task:
|
213
|
-
```
|
219
|
+
```bash
|
214
220
|
emhass --action 'dayahead-optim' --config '/home/user/emhass/config_emhass.yaml' --costfun 'profit'
|
215
221
|
```
|
216
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).
|
@@ -224,7 +230,7 @@ Then additional optimization strategies were developed, that can be used in comb
|
|
224
230
|
### Dayahead Optimization - Method 1) Add-on and docker standalone
|
225
231
|
|
226
232
|
In `configuration.yaml`:
|
227
|
-
```
|
233
|
+
```yaml
|
228
234
|
shell_command:
|
229
235
|
dayahead_optim: "curl -i -H \"Content-Type:application/json\" -X POST -d '{}' http://localhost:5000/action/dayahead-optim"
|
230
236
|
publish_data: "curl -i -H \"Content-Type:application/json\" -X POST -d '{}' http://localhost:5000/action/publish-data"
|
@@ -232,25 +238,25 @@ shell_command:
|
|
232
238
|
### Dayahead Optimization - Method 2) Legacy method using a Python virtual environment
|
233
239
|
|
234
240
|
In `configuration.yaml`:
|
235
|
-
```
|
241
|
+
```yaml
|
236
242
|
shell_command:
|
237
243
|
dayahead_optim: /home/user/emhass/scripts/dayahead_optim.sh
|
238
244
|
publish_data: /home/user/emhass/scripts/publish_data.sh
|
239
245
|
```
|
240
246
|
Create the file `dayahead_optim.sh` with the following content:
|
241
|
-
```
|
247
|
+
```bash
|
242
248
|
#!/bin/bash
|
243
249
|
. /home/user/emhassenv/bin/activate
|
244
250
|
emhass --action 'dayahead-optim' --config '/home/user/emhass/config_emhass.yaml'
|
245
251
|
```
|
246
252
|
And the file `publish_data.sh` with the following content:
|
247
|
-
```
|
253
|
+
```bash
|
248
254
|
#!/bin/bash
|
249
255
|
. /home/user/emhassenv/bin/activate
|
250
256
|
emhass --action 'publish-data' --config '/home/user/emhass/config_emhass.yaml'
|
251
257
|
```
|
252
258
|
Then specify user rights and make the files executables:
|
253
|
-
```
|
259
|
+
```bash
|
254
260
|
sudo chmod -R 755 /home/user/emhass/scripts/dayahead_optim.sh
|
255
261
|
sudo chmod -R 755 /home/user/emhass/scripts/publish_data.sh
|
256
262
|
sudo chmod +x /home/user/emhass/scripts/dayahead_optim.sh
|
@@ -259,7 +265,7 @@ sudo chmod +x /home/user/emhass/scripts/publish_data.sh
|
|
259
265
|
### Common for any installation method
|
260
266
|
|
261
267
|
In `automations.yaml`:
|
262
|
-
```
|
268
|
+
```yaml
|
263
269
|
- alias: EMHASS day-ahead optimization
|
264
270
|
trigger:
|
265
271
|
platform: time
|
@@ -276,7 +282,7 @@ In `automations.yaml`:
|
|
276
282
|
In these automations the day-ahead optimization is performed everyday at 5:30am and the data is published every 5 minutes.
|
277
283
|
|
278
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:
|
279
|
-
```
|
285
|
+
```yaml
|
280
286
|
automation:
|
281
287
|
- alias: Water Heater Optimized ON
|
282
288
|
trigger:
|
@@ -291,7 +297,7 @@ automation:
|
|
291
297
|
entity_id: switch.water_heater_switch
|
292
298
|
```
|
293
299
|
A second automation should be used to turn off the switch:
|
294
|
-
```
|
300
|
+
```yaml
|
295
301
|
automation:
|
296
302
|
- alias: Water Heater Optimized OFF
|
297
303
|
trigger:
|
@@ -313,7 +319,7 @@ The `publish-data` command will push to Home Assistant the optimization results
|
|
313
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.
|
314
320
|
|
315
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:
|
316
|
-
```
|
322
|
+
```yaml
|
317
323
|
shell_command:
|
318
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"
|
319
325
|
```
|
@@ -321,7 +327,7 @@ shell_command:
|
|
321
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`.
|
322
328
|
|
323
329
|
If you provide the `custom_deferrable_forecast_id` then the passed data should be a list of dictionaries, like this:
|
324
|
-
```
|
330
|
+
```yaml
|
325
331
|
shell_command:
|
326
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"
|
327
333
|
```
|
@@ -371,11 +377,11 @@ The valid values to pass for both forecast data and MPC related data are explain
|
|
371
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.
|
372
378
|
|
373
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:
|
374
|
-
```
|
380
|
+
```bash
|
375
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
|
376
382
|
```
|
377
383
|
Or if using the legacy method using a Python virtual environment:
|
378
|
-
```
|
384
|
+
```bash
|
379
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]}'
|
380
386
|
```
|
381
387
|
|
@@ -448,10 +454,16 @@ When applying this controller, the following `runtimeparams` should be defined:
|
|
448
454
|
|
449
455
|
A correct call for a MPC optimization should look like:
|
450
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
|
451
459
|
```
|
452
|
-
|
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
|
453
463
|
```
|
454
464
|
|
465
|
+
|
466
|
+
|
455
467
|
## A machine learning forecaster
|
456
468
|
|
457
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.0.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=qGfkjlMr5UDD-UsuWpTPiJG-yyGm8cONsokws5qzB8s,18177
|
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.0.dist-info/LICENSE,sha256=1X3-S1yvOCBDBeox1aK3dq00m7dA8NDtcPrpKPISzbE,1077
|
15
|
-
emhass-0.8.0.dist-info/METADATA,sha256=-06Yn_Uyb32Etf0U375lePGY9h3VQUiUiLfjPVSezuo,33456
|
16
|
-
emhass-0.8.0.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
|
17
|
-
emhass-0.8.0.dist-info/entry_points.txt,sha256=6Bp1NFOGNv_fSTxYl1ke3K3h3aqAcBxI-bgq5yq-i1M,52
|
18
|
-
emhass-0.8.0.dist-info/top_level.txt,sha256=L7fIX4awfmxQbAePtSdVg2e6x_HhghfReHfsKSpKr9I,7
|
19
|
-
emhass-0.8.0.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|