Skip to content

Commit

Permalink
code enhancement
Browse files Browse the repository at this point in the history
  • Loading branch information
Aohzan committed Dec 15, 2023
1 parent 6e2fe1f commit 521a271
Show file tree
Hide file tree
Showing 6 changed files with 148 additions and 265 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## 4.7.0

- add some teleinfo attributes: `Avertissement depassement`, `Conso instant general`, `Puissance apparente`
- code enhancement
- bump dependencies

## 4.6.1

- fix DeviceInfo for HA 2023.8 release
Expand Down
14 changes: 6 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,10 @@ To add ecodevices to your installation, go to Configuration >> Integrations in t
If you want individual entities for more informations, you can get it from main sensor attributes, for example:

```yaml
sensor:
- platform: template
sensors:
intensity_phase_1:
unique_id: intensity_phase_1
friendly_name: "Intensité phase 1"
unit_of_measurement: "A"
value_template: "{{ state_attr('sensor.compteur_linky', 'intensite_now_ph1') | int }}"
template:
- sensor:
- name: "Intensité phase 1"
unique_id: intensity_phase_1
unit_of_measurement: "A"
state: "{{ state_attr('sensor.compteur_linky', 'intensite_now_ph1') | int }}"
```
8 changes: 1 addition & 7 deletions custom_components/ecodevices/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,22 +20,16 @@
from homeassistant.core import HomeAssistant
from homeassistant.exceptions import ConfigEntryNotReady
from homeassistant.helpers.aiohttp_client import async_get_clientsession
from homeassistant.helpers.typing import ConfigType
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator, UpdateFailed

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

_LOGGER = logging.getLogger(__name__)


async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
"""Set up the Eco-Devices integration."""
hass.data.setdefault(DOMAIN, {})
return True


async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
"""Set up Eco-Devices from a config entry."""
hass.data.setdefault(DOMAIN, {})
config = entry.data
options = entry.options

Expand Down
36 changes: 36 additions & 0 deletions custom_components/ecodevices/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,39 @@
DEFAULT_C1_NAME = "Meter 1"
DEFAULT_C2_NAME = "Meter 2"
DEFAULT_SCAN_INTERVAL = 5

TELEINFO_EXTRA_ATTR = {
"type_heures": "PTEC",
"souscription": "ISOUSC",
"intensite_max": "IMAX",
"intensite_max_ph1": "IMAX1",
"intensite_max_ph2": "IMAX2",
"intensite_max_ph3": "IMAX3",
"intensite_now": "IINST",
"intensite_now_ph1": "IINST1",
"intensite_now_ph2": "IINST2",
"intensite_now_ph3": "IINST3",
"conso_instant_general": "PPAP",
"puissance_apparente": "PAPP",
"avertissement_depassement": "ADPS",
"numero_compteur": "ADCO",
"option_tarifaire": "OPTARIF",
"index_base": "BASE",
"etat": "MOTDETAT",
"presence_potentiels": "PPOT",
# HCHP
"index_heures_creuses": "HCHC",
"index_heures_pleines": "HCHP",
"index_heures_normales": "EJPHN",
"index_heures_pointes": "EJPHPM",
"preavis_heures_pointes": "PEJP",
"groupe_horaire": "HHPHC",
# Tempo
"index_heures_creuses_jour_bleu": "BBRHCJB",
"index_heures_pleines_jour_bleu": "BBRHPJB",
"index_heures_creuses_jour_blanc": "BBRHCJW",
"index_heures_pleines_jour_blanc": "BBRHPJW",
"index_heures_creuses_jour_rouge": "BBRHCJR",
"index_heures_pleines_jour_rouge": "BBRHPJR",
"type_heures_demain": "DEMAIN",
}
4 changes: 2 additions & 2 deletions custom_components/ecodevices/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
"iot_class": "local_polling",
"issue_tracker": "https://github.com/Aohzan/ecodevices/issues",
"requirements": [
"xmltodict==0.12.0",
"xmltodict==0.13.0",
"pyecodevices==1.6.1"
],
"version": "4.6.1"
"version": "4.7.0"
}
Loading

0 comments on commit 521a271

Please sign in to comment.