emhass 0.12.0__py3-none-any.whl → 0.12.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/command_line.py CHANGED
@@ -69,7 +69,7 @@ def set_input_data_dict(
69
69
  retrieve_hass_conf, optim_conf, plant_conf = utils.get_yaml_parse(params, logger)
70
70
  if type(retrieve_hass_conf) is bool:
71
71
  return False
72
-
72
+
73
73
  # Treat runtimeparams
74
74
  params, retrieve_hass_conf, optim_conf, plant_conf = utils.treat_runtimeparams(
75
75
  runtimeparams,
@@ -81,7 +81,7 @@ def set_input_data_dict(
81
81
  logger,
82
82
  emhass_conf,
83
83
  )
84
-
84
+
85
85
  # Define the data retrieve object
86
86
  rh = RetrieveHass(
87
87
  retrieve_hass_conf["hass_url"],
@@ -93,20 +93,22 @@ def set_input_data_dict(
93
93
  logger,
94
94
  get_data_from_file=get_data_from_file,
95
95
  )
96
-
96
+
97
97
  # Retrieve basic configuration data from hass
98
98
  if get_data_from_file:
99
99
  with open(emhass_conf["data_path"] / "test_df_final.pkl", "rb") as inp:
100
100
  _, _, _, rh.ha_config = pickle.load(inp)
101
101
  else:
102
- rh.get_ha_config()
103
-
102
+ response = rh.get_ha_config()
103
+ if type(response) is bool:
104
+ return False
105
+
104
106
  # Update the params dict using data from the HA configuration
105
107
  params = utils.update_params_with_ha_config(
106
108
  params,
107
109
  rh.ha_config,
108
110
  )
109
-
111
+
110
112
  # Define the forecast and optimization objects
111
113
  fcst = Forecast(
112
114
  retrieve_hass_conf,
@@ -444,7 +446,6 @@ def weather_forecast_cache(
444
446
  "forecast",
445
447
  logger,
446
448
  emhass_conf,
447
- {},
448
449
  )
449
450
  # Make sure weather_forecast_cache is true
450
451
  if (params != None) and (params != "null"):
emhass/retrieve_hass.py CHANGED
@@ -90,9 +90,23 @@ class RetrieveHass:
90
90
  "Authorization": "Bearer " + self.long_lived_token,
91
91
  "content-type": "application/json",
92
92
  }
93
- url = self.hass_url + "api/config"
94
- response_config = get(url, headers=headers)
95
- self.ha_config = response_config.json()
93
+ if self.hass_url == "http://supervisor/core/api":
94
+ url = self.hass_url + "/config"
95
+ else:
96
+ url = self.hass_url + "api/config"
97
+
98
+ try:
99
+ response_config = get(url, headers=headers)
100
+ except Exception:
101
+ self.logger.error("Unable to access Home Assistance instance, check URL")
102
+ self.logger.error("If using addon, try setting url and token to 'empty'")
103
+ return False
104
+
105
+ try:
106
+ self.ha_config = response_config.json()
107
+ except Exception:
108
+ self.logger.error("EMHASS was unable to obtain configuration data from HA")
109
+ return False
96
110
 
97
111
  def get_data(
98
112
  self,
emhass/utils.py CHANGED
@@ -171,6 +171,7 @@ def update_params_with_ha_config(
171
171
  'CHF': 'CHF', # Swiss Franc has no special symbol
172
172
  'CNY': '¥',
173
173
  'INR': '₹',
174
+ 'CZK': 'Kč',
174
175
  # Add more as needed
175
176
  }
176
177
  if 'currency' in ha_config.keys():
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: emhass
3
- Version: 0.12.0
3
+ Version: 0.12.2
4
4
  Summary: An Energy Management System for Home Assistant
5
5
  Author-email: David HERNANDEZ <davidusb@gmail.com>
6
6
  License: MIT
@@ -135,10 +135,7 @@ You must follow these steps to make EMHASS work properly:
135
135
  - There are multiple methods of installing and Running EMHASS. See [Installation Method](#Installation-Methods) below to pick a method that best suits your use case.
136
136
 
137
137
  2) Define all the parameters in the configuration file *(`config.json`)* or configuration page *(`YOURIP:5000/configuration`)*.
138
- ```{note}
139
-
140
- New in EMHASS v0.12.0: the default configuration does not need to retrieve any data from Home Assistant! After installing and running the add-on, EMHASS should start and it will be ready to launch an optimization.
141
- ```
138
+ - Since EMHASS v0.12.0: the default configuration does not need to retrieve any data from Home Assistant! After installing and running the add-on, EMHASS should start and it will be ready to launch an optimization.
142
139
  - See the description for each parameter in the [configuration](https://emhass.readthedocs.io/en/latest/config.html) docs.
143
140
  - EMHASS has a default configuration with 2 deferrable loads, no solar PV, no batteries and a basic load power forecasting method.
144
141
  - If you want to consider solar PV and more advanced load power forecast methods, you will need to define the main data entering EMHASS. This will be the Home Assistant sensor/variable `sensor.power_load_no_var_loads`, for the load power of your household excluding the power of the deferrable loads that you want to optimize, and the sensor/variable `sensor.power_photovoltaics` for the name of your Home Assistant variable containing the PV produced power (if solar PV is activated).
@@ -1,11 +1,11 @@
1
1
  emhass/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
- emhass/command_line.py,sha256=xXu0A87fgiv38YbEJZiK3xQZ63wEMp081YqUCNsAWcM,70688
2
+ emhass/command_line.py,sha256=4sAFhE6pBfB0SeYlhxKg_LwAOQJi_atMRurtNxYWIWA,70727
3
3
  emhass/forecast.py,sha256=_Gc8k6_8Nz87WHXKyUH6iXK956Z2TGzhL8L6t-tO_sk,63496
4
4
  emhass/machine_learning_forecaster.py,sha256=JErz50i_D59J5wXdbf_EUPb_FG45qRflv51iBA7ARXU,17417
5
5
  emhass/machine_learning_regressor.py,sha256=yFwMvVEmlgDJUsHhBT-HpNE3j2TC24e8Gmbcn9MPfeU,10690
6
6
  emhass/optimization.py,sha256=izMgRJFEP_9LHvZeX6FM1lxWyDWX3Tq2hFvu8ZP9FN4,61457
7
- emhass/retrieve_hass.py,sha256=LLZBoP5Rkyg0_uSvJSG5m-6apVoWZ6MWuXPPA-j-JsI,25617
8
- emhass/utils.py,sha256=esxcCoA38VhhugOHRvu69hJ8_V_zJkAqu0jUHW26rck,68969
7
+ emhass/retrieve_hass.py,sha256=RIzRiGzo09TO6zfDKqIClnLzQ5n2YkV97pinXPPXWsQ,26135
8
+ emhass/utils.py,sha256=fkdsncHcTW70vlwp9-JjDzJqVpa7imW07QY7rEXEpHY,68991
9
9
  emhass/web_server.py,sha256=QsqT51AdlAgNCG3NV1zbm4YkBSq_0BaC3cIEzPeZvl8,28023
10
10
  emhass/data/associations.csv,sha256=IpEZIIWYdFjkRoC5xa1pRHjwnVs_VH8G8ogbGFxLfGI,3679
11
11
  emhass/data/cec_inverters.pbz2,sha256=tK8FvAUDW0uYez8EPttdCJwHhpPofclYV6GhhNZL0Pk,168272
@@ -24,9 +24,9 @@ emhass/static/img/feather-sprite.svg,sha256=VHjMJQg88wXa9CaeYrKGhNtyK0xdd47zCqwS
24
24
  emhass/templates/configuration.html,sha256=M-_L__juYzcdGDaryGrz6LG2mguW2f1Sx6k01YfG7Dc,2885
25
25
  emhass/templates/index.html,sha256=1V44c0yyliu_z8inl0K-zmmmkhQumH3Bqk8Jj1YJPzY,3076
26
26
  emhass/templates/template.html,sha256=TkGgMecQEbFUZA4ymPwMUzNjKHsENvCgroUWbPt7G4Y,158
27
- emhass-0.12.0.dist-info/LICENSE,sha256=1X3-S1yvOCBDBeox1aK3dq00m7dA8NDtcPrpKPISzbE,1077
28
- emhass-0.12.0.dist-info/METADATA,sha256=7e1QOm_rd__64snbbStegC7hFW8q62JHdC2sHlCFhSw,49398
29
- emhass-0.12.0.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
30
- emhass-0.12.0.dist-info/entry_points.txt,sha256=6Bp1NFOGNv_fSTxYl1ke3K3h3aqAcBxI-bgq5yq-i1M,52
31
- emhass-0.12.0.dist-info/top_level.txt,sha256=L7fIX4awfmxQbAePtSdVg2e6x_HhghfReHfsKSpKr9I,7
32
- emhass-0.12.0.dist-info/RECORD,,
27
+ emhass-0.12.2.dist-info/LICENSE,sha256=1X3-S1yvOCBDBeox1aK3dq00m7dA8NDtcPrpKPISzbE,1077
28
+ emhass-0.12.2.dist-info/METADATA,sha256=ITyAlhDMWqjrmvS6aPd8EOh7MQP08sVviUiDDmjJtYQ,49387
29
+ emhass-0.12.2.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
30
+ emhass-0.12.2.dist-info/entry_points.txt,sha256=6Bp1NFOGNv_fSTxYl1ke3K3h3aqAcBxI-bgq5yq-i1M,52
31
+ emhass-0.12.2.dist-info/top_level.txt,sha256=L7fIX4awfmxQbAePtSdVg2e6x_HhghfReHfsKSpKr9I,7
32
+ emhass-0.12.2.dist-info/RECORD,,