Skip to content

Commit

Permalink
Merge pull request #240 from saniho/dev
Browse files Browse the repository at this point in the history
new version
  • Loading branch information
saniho authored Sep 9, 2024
2 parents 537edbb + 577d4be commit ecb3a72
Show file tree
Hide file tree
Showing 26 changed files with 1,321 additions and 264 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/lint_python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ jobs:
- run: pytest . || true
#- run: pytest --doctest-modules . || true
#- run: shopt -s globstar && pyupgrade --py36-plus **/*.py || true
- run: safety check -i 43975
- run: safety check -i 43975 -i 70612
6 changes: 4 additions & 2 deletions .idea/apiEnedis.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 15 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ sur le [forum HACF](https://forum.hacf.fr/).**
## Bienvenue !

Cette intégration fonctionne à l'aide de la passerelle fournie par
https://enedisgateway.tech/.
https://enedisgateway.tech/ et avec https://myelectricaldata.fr/

Avant de pouvoir utiliser cette intégration, assurez vous :

Expand All @@ -23,6 +23,8 @@ Avant de pouvoir utiliser cette intégration, assurez vous :
[espace privé Enedis](https://mon-compte-client.enedis.fr/) la remontée
des informations de votre linky.

Remarque :
- La passerelle myElectriqueData est encore en test mais viendra à remplace EnedisGateway qui va disparaitre courant 2023
## Installer l'intégration

<details>
Expand Down Expand Up @@ -230,6 +232,18 @@ Cette partie n'est pas tenu à jour.
<details>
<summary><b>VERSION</b></summary>

**2.2.0** activation de myElectricData & du production sensor

**2.0.3.0** preparation pour myElectricData & corrections mineures

**ajout de la possibilité d'utiliser myElectricData d'ici peu**

Attention le service enedisGateway sera desactivé en mai 2023, mais myElectricData prendra la releve.

Pensez à vous enregistrer sur https://www.myelectricaldata.fr/

ps : le token myelectridata n'est pas compatible avec celui de enedsgateway ...

**1.2.0.0** refactoring du code

**suppression de la configuration possible par le fichier yaml, uniquement
Expand Down
9 changes: 7 additions & 2 deletions custom_components/apiEnedis/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ def __init__(self):
from .const import ( # isort:skip
CONF_TOKEN,
CONF_CODE,
CONF_SERVICE_ENEDIS,
DOMAIN,
HP_COST,
HC_COST,
Expand Down Expand Up @@ -232,6 +233,7 @@ async def async_set_options(self):
CONF_SCAN_INTERVAL: data.pop(CONF_SCAN_INTERVAL, DEFAULT_SCAN_INTERVAL),
CONF_TOKEN: data.pop(CONF_TOKEN, ""),
CONF_CODE: str(data.pop(CONF_CODE, "")),
CONF_SERVICE_ENEDIS: str(data.pop(CONF_SERVICE_ENEDIS, "")),
HP_COST: str(data.pop(HP_COST, "0.0")),
HC_COST: str(data.pop(HC_COST, "0.0")),
HEURESCREUSES_ON: bool(data.pop(HEURESCREUSES_ON, True)),
Expand All @@ -250,9 +252,10 @@ def update_OptionsMyEnedis(self):
_LOGGER.info("getInit()")
hccost = float(self.entry.options.get(HC_COST, "0.0"))
hpcost = float(self.entry.options.get(HP_COST, "0.0"))
serviceEnedis = self.entry.options.get(CONF_SERVICE_ENEDIS, "enedisGateway")
token, code = (
self.entry.options[CONF_TOKEN],
self.entry.options[CONF_CODE],
self.entry.options[CONF_CODE]
)
heurescreusesON = self.entry.options[HEURESCREUSES_ON]
heurescreusesch = self.entry.options.get(HEURES_CREUSES, "[]")
Expand All @@ -261,7 +264,8 @@ def update_OptionsMyEnedis(self):
heurescreuses = ast.literal_eval(heurescreusesch)
self._PDL_ID = code
_LOGGER.info(
"options - proc -- %s %s %s %s %s %s",
"options - proc -- %s %s %s %s %s %s %s",
serviceEnedis,
token,
code,
hccost,
Expand Down Expand Up @@ -311,6 +315,7 @@ def update_OptionsMyEnedis(self):
heuresPleinesCost=hpcost,
version=__VERSION__,
heuresCreusesON=heurescreusesON,
serviceEnedis=serviceEnedis,
)
self.clientEnedis.setPathArchive(path)
dataJson = self.clientEnedis.readDataJson()
Expand Down
21 changes: 20 additions & 1 deletion custom_components/apiEnedis/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,18 @@
DOMAIN,
CONF_TOKEN,
CONF_CODE,
CONF_SERVICE_ENEDIS,
HC_COST,
HP_COST,
HEURESCREUSES_ON,
HEURES_CREUSES,
_ENEDIS_EnedisGateway,
_ENEDIS_MyElectricData,
)


_LOGGER = logging.getLogger(__name__)
all_repos_Gateway = [_ENEDIS_EnedisGateway, _ENEDIS_MyElectricData]


class myEnedisFlowHandler( # type: ignore[call-arg]
Expand Down Expand Up @@ -46,13 +50,18 @@ def _show_setup_form(self, user_input=None, errors=None):
user_input = {}
token = ""
code = ""
serviceEnedis = "enedisGateway"
val_hc_cost = "0.0"
val_hp_cost = "0.0"
val_heures_creuses = ""
val_heurescreuses_on = True

all_repos = all_repos_Gateway
data_schema = vol.Schema(
{
vol.Required(
CONF_SERVICE_ENEDIS,
default=user_input.get(CONF_SERVICE_ENEDIS, serviceEnedis),
): vol.In(all_repos),
vol.Required(
CONF_TOKEN, default=user_input.get(CONF_TOKEN, token)
): str,
Expand Down Expand Up @@ -86,6 +95,7 @@ async def async_step_user(self, user_input=None): # pylint: disable=unused-argu

token = user_input[CONF_TOKEN] # Might be a city name or a postal code
code = user_input.get(CONF_CODE)
serviceEnedis = user_input.get(CONF_SERVICE_ENEDIS)
hc_cost = user_input.get(HC_COST)
hp_cost = user_input.get(HP_COST)
heures_creuses_on = user_input.get(HEURESCREUSES_ON)
Expand All @@ -100,6 +110,7 @@ async def async_step_user(self, user_input=None): # pylint: disable=unused-argu
data={
CONF_TOKEN: token,
CONF_CODE: code,
CONF_SERVICE_ENEDIS: serviceEnedis,
HC_COST: hc_cost,
HP_COST: hp_cost,
HEURESCREUSES_ON: heures_creuses_on,
Expand All @@ -126,9 +137,17 @@ async def async_step_init(self, user_input=None):
return self.async_create_entry(title="", data=user_input)
token = "monToken"
code = "monCode"
serviceEnedis = "enedisGateway"
val_heures_creuses = ""
all_repos = all_repos_Gateway

data_schema = vol.Schema(
{
vol.Required(
CONF_SERVICE_ENEDIS,
default=self.config_entry.options.get(CONF_SERVICE_ENEDIS,
serviceEnedis),
): vol.In(all_repos),
vol.Required(
CONF_TOKEN,
default=self.config_entry.options.get(CONF_TOKEN, token),
Expand Down
18 changes: 18 additions & 0 deletions custom_components/apiEnedis/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ def __init__(self):
# Configuration
CONF_TOKEN = "token"
CONF_CODE = "code"
# defaut
CONF_SERVICE_ENEDIS = "enedisGateway"

# 60 secondes verifications du coordinator
CONF_SCAN_INTERVAL = "conf_scan_interval"
Expand All @@ -60,9 +62,13 @@ def __init__(self):
_consommation = "consommation"
_production = "production"

_ENEDIS_MyElectricData = "myElectricalData"
_ENEDIS_EnedisGateway = "enedisGateway"

PLATFORMS = ["sensor"]

_formatDateYmd = "%Y-%m-%d"
_formatDateYmdHMS = "%Y-%m-%d %H:%M:%S"

ENTITY_NAME = "name"
ENTITY_DELAI = "delai"
Expand All @@ -72,6 +78,10 @@ def __init__(self):
ENTITY_NAME: "principal",
ENTITY_DELAI: 60,
},
"principal_production": {
ENTITY_NAME: "principal_production",
ENTITY_DELAI: 60,
},
"history_all": {
ENTITY_NAME: "history_all",
ENTITY_DELAI: 60,
Expand Down Expand Up @@ -100,6 +110,14 @@ def __init__(self):
ENTITY_NAME: "energyDetailHoursCost",
ENTITY_DELAI: 60,
},
"ecowatt": {
ENTITY_NAME: "ecowatt",
ENTITY_DELAI: 60,
},
"tempo": {
ENTITY_NAME: "tempo",
ENTITY_DELAI: 60,
},
}


Expand Down
44 changes: 0 additions & 44 deletions custom_components/apiEnedis/gitinformation.py

This file was deleted.

4 changes: 2 additions & 2 deletions custom_components/apiEnedis/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
"issue_tracker": "https://github.com/saniho/apiEnedis/issues",
"iot_class": "cloud_polling",
"config_flow": true,
"version": "1.5.1",
"version": "2.4.0",
"requirements": [
"packaging>=20.8"
],
"dependencies": [],
"codeowners": [
"@saniho"
]
}
}
Loading

0 comments on commit ecb3a72

Please sign in to comment.