Skip to content

Commit 521a271

Browse files
committed
code enhancement
1 parent 6e2fe1f commit 521a271

File tree

6 files changed

+148
-265
lines changed

6 files changed

+148
-265
lines changed

CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Changelog
22

3+
## 4.7.0
4+
5+
- add some teleinfo attributes: `Avertissement depassement`, `Conso instant general`, `Puissance apparente`
6+
- code enhancement
7+
- bump dependencies
8+
39
## 4.6.1
410

511
- fix DeviceInfo for HA 2023.8 release

README.md

+6-8
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,10 @@ To add ecodevices to your installation, go to Configuration >> Integrations in t
3333
If you want individual entities for more informations, you can get it from main sensor attributes, for example:
3434

3535
```yaml
36-
sensor:
37-
- platform: template
38-
sensors:
39-
intensity_phase_1:
40-
unique_id: intensity_phase_1
41-
friendly_name: "Intensité phase 1"
42-
unit_of_measurement: "A"
43-
value_template: "{{ state_attr('sensor.compteur_linky', 'intensite_now_ph1') | int }}"
36+
template:
37+
- sensor:
38+
- name: "Intensité phase 1"
39+
unique_id: intensity_phase_1
40+
unit_of_measurement: "A"
41+
state: "{{ state_attr('sensor.compteur_linky', 'intensite_now_ph1') | int }}"
4442
```

custom_components/ecodevices/__init__.py

+1-7
Original file line numberDiff line numberDiff line change
@@ -20,22 +20,16 @@
2020
from homeassistant.core import HomeAssistant
2121
from homeassistant.exceptions import ConfigEntryNotReady
2222
from homeassistant.helpers.aiohttp_client import async_get_clientsession
23-
from homeassistant.helpers.typing import ConfigType
2423
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator, UpdateFailed
2524

2625
from .const import CONTROLLER, COORDINATOR, DOMAIN, PLATFORMS, UNDO_UPDATE_LISTENER
2726

2827
_LOGGER = logging.getLogger(__name__)
2928

3029

31-
async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
32-
"""Set up the Eco-Devices integration."""
33-
hass.data.setdefault(DOMAIN, {})
34-
return True
35-
36-
3730
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
3831
"""Set up Eco-Devices from a config entry."""
32+
hass.data.setdefault(DOMAIN, {})
3933
config = entry.data
4034
options = entry.options
4135

custom_components/ecodevices/const.py

+36
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,39 @@
2424
DEFAULT_C1_NAME = "Meter 1"
2525
DEFAULT_C2_NAME = "Meter 2"
2626
DEFAULT_SCAN_INTERVAL = 5
27+
28+
TELEINFO_EXTRA_ATTR = {
29+
"type_heures": "PTEC",
30+
"souscription": "ISOUSC",
31+
"intensite_max": "IMAX",
32+
"intensite_max_ph1": "IMAX1",
33+
"intensite_max_ph2": "IMAX2",
34+
"intensite_max_ph3": "IMAX3",
35+
"intensite_now": "IINST",
36+
"intensite_now_ph1": "IINST1",
37+
"intensite_now_ph2": "IINST2",
38+
"intensite_now_ph3": "IINST3",
39+
"conso_instant_general": "PPAP",
40+
"puissance_apparente": "PAPP",
41+
"avertissement_depassement": "ADPS",
42+
"numero_compteur": "ADCO",
43+
"option_tarifaire": "OPTARIF",
44+
"index_base": "BASE",
45+
"etat": "MOTDETAT",
46+
"presence_potentiels": "PPOT",
47+
# HCHP
48+
"index_heures_creuses": "HCHC",
49+
"index_heures_pleines": "HCHP",
50+
"index_heures_normales": "EJPHN",
51+
"index_heures_pointes": "EJPHPM",
52+
"preavis_heures_pointes": "PEJP",
53+
"groupe_horaire": "HHPHC",
54+
# Tempo
55+
"index_heures_creuses_jour_bleu": "BBRHCJB",
56+
"index_heures_pleines_jour_bleu": "BBRHPJB",
57+
"index_heures_creuses_jour_blanc": "BBRHCJW",
58+
"index_heures_pleines_jour_blanc": "BBRHPJW",
59+
"index_heures_creuses_jour_rouge": "BBRHCJR",
60+
"index_heures_pleines_jour_rouge": "BBRHPJR",
61+
"type_heures_demain": "DEMAIN",
62+
}

custom_components/ecodevices/manifest.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
"iot_class": "local_polling",
1111
"issue_tracker": "https://github.com/Aohzan/ecodevices/issues",
1212
"requirements": [
13-
"xmltodict==0.12.0",
13+
"xmltodict==0.13.0",
1414
"pyecodevices==1.6.1"
1515
],
16-
"version": "4.6.1"
16+
"version": "4.7.0"
1717
}

0 commit comments

Comments
 (0)