Git Product home page Git Product logo

rte-ecowatt's Introduction

My EcoWatt by RTE pour Home Assistant

Composant pour exposer les niveaux Ecowatt dans un avenir prévisible. Voir https://www.monecowatt.fr/ pour l'accès web.

Installation

Utilisez hacs. Ouvrez votre instance Home Assistant et ouvrez un référentiel dans la boutique communautaire Home Assistant.

Configuration

Obtenir un accès API pour les API RTE

  • Créer un compte sur site API RTE
  • Inscrivez-vous à l'API Ecowatt et cliquez sur "Abonnez-vous à l'API", créez un nouvelle application
  • obtenir le client_id et client_secret (uuid dans les deux cas)

Configurer home-assistant

La méthode de configuration préférée consiste à utiliser l'interface utilisateur.

image info

image info

image info

image info

Vous pouvez configurer deux types de capteurs :

  • Capteurs "horaire" pour regarder le niveau écowatt X heures dans le futur. Vous pouvez regarder jusqu'à 96h pour le moment.
  • Capteurs "journalier" pour examiner le niveau d'écowatt X jours dans le futur. Vous pouvez regarder jusqu'à 3d à l'avance pour le moment. La valeur du capteur "jours" est la pire de toutes les heures de ce jour.

image info

Deux capteurs sont générés par défaut : "maintenant" (0 heure d'avance) et "aujourd'hui" (0 jour d'avance).

Un capteur supplémentaire exposant la prochaine période dégradée est également ajouté par défaut (non configurable). Il montre un début de période prochaine avec des tensions sur le réseau électrique. Pendant une telle période, il indique le début de l'heure suivante.

rte-ecowatt's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

rte-ecowatt's Issues

Les capteurs restent à 'inconnu'

Version installée : 0.4.0

Statut rte :

  • compte créé
  • abonnement à l'api ecowatt réalisé
  • abonnement web/ serveur et de type mobile testés

Statut home assistant

  • ha sous docker, version 2022.11.5
  • installation de hacs : ok
  • toutes les autres integrations sont fonctionnelles

Méthode de reproduction

  • Le dépôt à été ajouté à hacs
  • L'intégration ecowatt à été rajoutée
  • Lors de sa configuration, je copie-colle l'uuid id_client et l'uuid id_secret fourni dans l'écran de gestion de l'abonnement à l'api ecowatt
  • création d'un capteur supplémentaire pour les prévisions à j+3
  • creation d'un capteur supplémentaire pour les prévisions à j+2
  • tous les capteurs créés ont le statut 'inconnu'

Cette absence de statut est survenue dès la première installation de l'intégration, les statuts ne sont donc jamais remontés.

Aucune erreur a priori dans les logs HA, pas de domaine bloqué par le serveur dns.

Récupération données Enedis rte_ecowatt 0.6.3

Bonjour,

Voici le log debug complet de l'erreur : en fin gras italique.

2022-12-15 12:16:11.719 WARNING (SyncWorker_2) [homeassistant.loader] We found a custom integration rte_ecowatt which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2022-12-15 12:16:15.498 INFO (MainThread) [homeassistant.bootstrap] Setting up stage 2: {'zone', 'xiaomi_miio', 'ffmpeg', 'rfxtrx', 'cert_expiry', 'cover', 'rest', 'integration', 'group', 'input_number', 'device_automation', 'homeassistant_alerts', 'netatmo', 'image', 'lovelace', 'person', 'homekit', 'freebox', 'rte_ecowatt', 'scheduler', 'tag', 'application_credentials', 'diagnostics', 'dlna_dmr', 'history', 'heos', 'ibeacon', 'search', 'repairs', 'config', 'script', 'system_health', 'default_config', 'hue', 'dlna_dms', 'input_datetime', 'schedule', 'denonavr', 'input_boolean', 'input_text', 'signal_ecogaz', 'auth', 'daikin', 'logbook', 'scene', 'input_button', 'energy', 'device_tracker', 'braviatv', 'switch_as_x', 'hardware', 'analytics', 'radio_browser', 'sensor', 'mobile_app', 'climate', 'onboarding', 'my', 'sun', 'cast', 'automation', 'ble_monitor', 'blueprint', 'meteo_france', 'tts', 'persistent_notification', 'co2signal', 'map', 'counter', 'timer', 'trace', 'apple_tv', 'mqtt', 'media_source', 'ipp', 'hacs', 'file_upload', 'localtuya', 'input_select'}
2022-12-15 12:16:16.121 INFO (MainThread) [homeassistant.setup] Setting up rte_ecowatt
2022-12-15 12:16:16.121 INFO (MainThread) [homeassistant.setup] Setup of domain rte_ecowatt took 0.0 seconds
2022-12-15 12:16:16.146 INFO (MainThread) [custom_components.rte_ecowatt] Called async setup entry from __init__.py
2022-12-15 12:16:16.157 INFO (MainThread) [homeassistant.components.sensor] Setting up sensor.rte_ecowatt
2022-12-15 12:16:16.161 INFO (MainThread) [custom_components.rte_ecowatt.sensor] Called async setup entry
2022-12-15 12:16:16.161 INFO (MainThread) [custom_components.rte_ecowatt] Creating an ecowatt sensor, named Ecowatt level today
2022-12-15 12:16:16.161 INFO (MainThread) [custom_components.rte_ecowatt] Creating an ecowatt sensor, named Ecowatt level now
2022-12-15 12:16:16.161 INFO (MainThread) [custom_components.rte_ecowatt] Creating an ecowatt sensor, named Ecowatt level tomorrow
2022-12-15 12:16:16.161 INFO (MainThread) [custom_components.rte_ecowatt] Creating an ecowatt sensor, named Ecowatt level in 2 days
2022-12-15 12:16:16.161 INFO (MainThread) [custom_components.rte_ecowatt] Creating an ecowatt sensor, named Ecowatt level in 3 days
2022-12-15 12:16:16.161 DEBUG (MainThread) [custom_components.rte_ecowatt.sensor] All sensors have been restored properly
2022-12-15 12:16:16.161 DEBUG (MainThread) [custom_components.rte_ecowatt] Calling update method, 0 listeners subscribed
2022-12-15 12:16:16.161 DEBUG (MainThread) [custom_components.rte_ecowatt] Starting collecting data
2022-12-15 12:16:16.193 DEBUG (MainThread) [custom_components.rte_ecowatt] starting to restore sensor from previous data
2022-12-15 12:16:16.193 DEBUG (MainThread) [custom_components.rte_ecowatt] old state: {'entity_id': 'sensor.ecowatt_level_today', 'state': 'Situation normale', 'attributes': {'generation_time': '2022-12-14T23:00:00+01:00', 'period_start': '2022-12-15T00:00:00.494688+01:00', 'period_end': '2022-12-16T00:00:00.494688+01:00', 'level_code': 1, 'icon': 'mdi:check-circle', 'friendly_name': 'Ecowatt level today'}, 'last_changed': '2022-12-15T11:04:18.202406+00:00', 'last_updated': '2022-12-15T11:04:18.202406+00:00', 'context': {'id': '01GMAQ9Q0T86XQM026B8E9JFF3', 'parent_id': None, 'user_id': None}}
2022-12-15 12:16:16.193 DEBUG (MainThread) [custom_components.rte_ecowatt] Restoring state for ecowatt-level-in-0-days
2022-12-15 12:16:16.193 DEBUG (MainThread) [custom_components.rte_ecowatt] starting to restore sensor from previous data
2022-12-15 12:16:16.193 DEBUG (MainThread) [custom_components.rte_ecowatt] old state: {'entity_id': 'sensor.ecowatt_level_now', 'state': 'Situation normale', 'attributes': {'generation_time': '2022-12-14T23:00:00+01:00', 'period_start': '2022-12-15T11:00:00.495193+01:00', 'period_end': '2022-12-15T12:00:00.495193+01:00', 'level_code': 1, 'icon': 'mdi:check-circle', 'friendly_name': 'Ecowatt level now'}, 'last_changed': '2022-12-15T11:04:18.202606+00:00', 'last_updated': '2022-12-15T11:04:18.202606+00:00', 'context': {'id': '01GMAQ9Q0T849JBB8X45TP1F26', 'parent_id': None, 'user_id': None}}
2022-12-15 12:16:16.194 DEBUG (MainThread) [custom_components.rte_ecowatt] Restoring state for ecowatt-level-in-0-hours
2022-12-15 12:16:16.194 DEBUG (MainThread) [custom_components.rte_ecowatt] starting to restore sensor from previous data
2022-12-15 12:16:16.194 DEBUG (MainThread) [custom_components.rte_ecowatt] old state: {'entity_id': 'sensor.ecowatt_level_tomorrow', 'state': 'Situation normale', 'attributes': {'generation_time': '2022-12-14T23:00:00+01:00', 'period_start': '2022-12-16T00:00:00.495658+01:00', 'period_end': '2022-12-17T00:00:00.495658+01:00', 'level_code': 1, 'icon': 'mdi:check-circle', 'friendly_name': 'Ecowatt level tomorrow'}, 'last_changed': '2022-12-15T11:04:18.202766+00:00', 'last_updated': '2022-12-15T11:04:18.202766+00:00', 'context': {'id': '01GMAQ9Q0T9NWHA3Q8HFCDMZBB', 'parent_id': None, 'user_id': None}}
2022-12-15 12:16:16.194 DEBUG (MainThread) [custom_components.rte_ecowatt] Restoring state for ecowatt-level-in-1-days
2022-12-15 12:16:16.194 DEBUG (MainThread) [custom_components.rte_ecowatt] starting to restore sensor from previous data
2022-12-15 12:16:16.194 DEBUG (MainThread) [custom_components.rte_ecowatt] old state: {'entity_id': 'sensor.ecowatt_level_in_2_days', 'state': 'Situation normale', 'attributes': {'generation_time': '2022-12-14T23:00:00+01:00', 'period_start': '2022-12-17T00:00:00.495746+01:00', 'period_end': '2022-12-18T00:00:00.495746+01:00', 'level_code': 1, 'icon': 'mdi:check-circle', 'friendly_name': 'Ecowatt level in 2 days'}, 'last_changed': '2022-12-15T11:04:18.202923+00:00', 'last_updated': '2022-12-15T11:04:18.202923+00:00', 'context': {'id': '01GMAQ9Q0TMHKB1ERDZ4PM3WC9', 'parent_id': None, 'user_id': None}}
2022-12-15 12:16:16.194 DEBUG (MainThread) [custom_components.rte_ecowatt] Restoring state for ecowatt-level-in-2-days
2022-12-15 12:16:16.194 DEBUG (MainThread) [custom_components.rte_ecowatt] starting to restore sensor from previous data
2022-12-15 12:16:16.194 DEBUG (MainThread) [custom_components.rte_ecowatt] old state: {'entity_id': 'sensor.ecowatt_level_in_3_days', 'state': 'Situation normale', 'attributes': {'generation_time': '2022-12-14T23:00:00+01:00', 'period_start': '2022-12-18T00:00:00.495814+01:00', 'period_end': '2022-12-19T00:00:00.495814+01:00', 'level_code': 1, 'icon': 'mdi:check-circle', 'friendly_name': 'Ecowatt level in 3 days'}, 'last_changed': '2022-12-15T11:04:18.203073+00:00', 'last_updated': '2022-12-15T11:04:18.203073+00:00', 'context': {'id': '01GMAQ9Q0V5ANH0X7PETDFRNW7', 'parent_id': None, 'user_id': None}}
2022-12-15 12:16:16.194 DEBUG (MainThread) [custom_components.rte_ecowatt] Restoring state for ecowatt-level-in-3-days
2022-12-15 12:16:16.194 DEBUG (MainThread) [custom_components.rte_ecowatt] starting to restore sensor from previous data
2022-12-15 12:16:16.194 DEBUG (MainThread) [custom_components.rte_ecowatt] old state: {'entity_id': 'sensor.electricity_distributor', 'state': 'unknown', 'attributes': {'friendly_name': 'Electricity distributor'}, 'last_changed': '2022-12-15T11:04:18.203246+00:00', 'last_updated': '2022-12-15T11:04:18.203246+00:00', 'context': {'id': '01GMAQ9Q0VWWEPH8RSC70J76PH', 'parent_id': None, 'user_id': None}}
2022-12-15 12:16:16.194 DEBUG (MainThread) [custom_components.rte_ecowatt] Stored state was 'unknown', starting from scratch
2022-12-15 12:16:16.195 DEBUG (MainThread) [custom_components.rte_ecowatt] starting to restore sensor from previous data
2022-12-15 12:16:16.195 DEBUG (MainThread) [custom_components.rte_ecowatt] old state: {'entity_id': 'sensor.detected_address', 'state': 'unknown', 'attributes': {'friendly_name': 'Detected address'}, 'last_changed': '2022-12-15T11:04:18.203409+00:00', 'last_updated': '2022-12-15T11:04:18.203409+00:00', 'context': {'id': '01GMAQ9Q0VRQV3CVG9Z5RPSY8A', 'parent_id': None, 'user_id': None}}
2022-12-15 12:16:16.195 DEBUG (MainThread) [custom_components.rte_ecowatt] Stored state was 'unknown', starting from scratch
2022-12-15 12:16:16.221 INFO (MainThread) [homeassistant.components.calendar] Setting up calendar.rte_ecowatt
2022-12-15 12:16:16.226 INFO (MainThread) [custom_components.rte_ecowatt.calendar] Called async setup entry for calendar
2022-12-15 12:16:16.226 INFO (MainThread) [custom_components.rte_ecowatt.calendar] We finished the setup of ecowatt *calendar*
2022-12-15 12:16:17.968 DEBUG (MainThread) [custom_components.rte_ecowatt] Fetched token eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJtZWdhY2FjaGUiLCJzdWIiOiJhcGlfcmVxdWVzdCIsImlhdCI6IjIwMjItMTItMTVUMTE6MTY6MTYuODA3WiIsImV4cCI6IjIwMjItMTItMTVUMTE6MjI6MTYuODA3WiJ9.KoUfuMtOKXI7ZGNYrCg1Y9t7FH4sQBdpyd0IJyfCBVQ from enedis api
_**2022-12-15 12:16:19.286 DEBUG (MainThread) [custom_components.rte_ecowatt] Data received from api-adresse.data.gouv.fr: {'type': 'FeatureCollection', 'version': 'draft', 'features': [{'type': 'Feature', 'geometry': {'type': 'Point', 'coordinates': [4.954591, 48.803923]}, 'properties': {'label': 'Contrisson', 'score': 0.9999999696197562, 'id': '55125', 'type': 'municipality', 'name': 'Contrisson', 'postcode': '55800', 'citycode': '55125', 'x': 843545.98, 'y': 6857759.72, 'population': 797, 'city': 'Contrisson', 'context': '55, Meuse, Grand Est', 'importance': 0.2793, 'distance': 8}}], 'attribution': 'BAN', 'licence': 'ETALAB-2.0', 'limit': 1}
2022-12-15 12:16:19.286 DEBUG (MainThread) [custom_components.rte_ecowatt] Finished fetching enedis api data in 3.125 seconds (success: False)
2022-12-15 12:16:19.286 DEBUG (MainThread) [custom_components.rte_ecowatt] Last coordinator failed, assuming state has not changed
2022-12-15 12:16:19.286 DEBUG (MainThread) [custom_components.rte_ecowatt] Last coordinator failed, assuming state has not changed
2022-12-15 12:16:19.286 DEBUG (MainThread) [custom_components.rte_ecowatt] Last coordinator failed, assuming state has not changed
2022-12-15 12:16:19.286 ERROR (MainThread) [homeassistant.components.sensor] Error while setting up rte_ecowatt platform for sensor**_
File "/config/custom_components/rte_ecowatt/__init__.py", line 567, in update_method
File "/config/custom_components/rte_ecowatt/__init__.py", line 528, in fetch_street_and_insee_code
File "/config/custom_components/rte_ecowatt/__init__.py", line 593, in update_method
File "/config/custom_components/rte_ecowatt/sensor.py", line 92, in async_setup_entry

Error while setting up rte_ecowatt platform for sensor

Bonjour

Premiere installation sur Home Assistant 2022.9.5

  api_client_id: xx
  api_client_secret: xx
  sensors:
    - unit: days
      shift: 2
Traceback (most recent call last):
File "/config/custom_components/rte_ecowatt/sensor.py", line 141, in update_method
api_result = await client.get(url, headers=headers)
File "/usr/local/lib/python3.10/site-packages/aiohttp/client.py", line 559, in _request
await resp.start(conn)
File "/usr/local/lib/python3.10/site-packages/aiohttp/client_reqrep.py", line 898, in start
message, payload = await protocol.read() # type: ignore[union-attr]
File "/usr/local/lib/python3.10/site-packages/aiohttp/streams.py", line 616, in read
await self._waiter
aiohttp.client_exceptions.ServerDisconnectedError: Server disconnected
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 205, in _async_refresh
self.data = await self._async_update_data()
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 164, in _async_update_data
return await self.update_method()
File "/config/custom_components/rte_ecowatt/sensor.py", line 166, in update_method
raise UpdateFailed(f"Error communicating with API: {err}")
homeassistant.helpers.update_coordinator.UpdateFailed: Error communicating with API: Server disconnected
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 281, in _async_setup_platform
await asyncio.shield(task)
File "/config/custom_components/rte_ecowatt/sensor.py", line 99, in async_setup_platform
await coordinator.async_config_entry_first_refresh()
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 178, in async_config_entry_first_refresh
raise ex
homeassistant.exceptions.ConfigEntryNotReady: Error communicating with API: Server disconnected```

Init erreur

Bonjour,

je viens d'installer via HACS, redémarrer et configuré

Screenshot 2023-12-13 at 11 19 47

Mais je vois les erreurs suivantes. Testé avec les params par defaut ainsi que 48 heures et 3 jours

Cette erreur provient d'une intégration personnalisée

Logger: custom_components.rte_ecowatt
Source: helpers/update_coordinator.py:300
Integration: My EcoWatt by RTE (documentation, issues)
First occurred: 11:11:28 (1 occurrences)
Last logged: 11:11:28

Unexpected error fetching ecowatt api data: the JSON object must be str, bytes or bytearray, not list
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 300, in _async_refresh
    self.data = await self._async_update_data()
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 256, in _async_update_data
    return await self.update_method()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/rte_ecowatt/__init__.py", line 189, in update_method
    signals = json.loads(body)["signals"]
              ^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/json/__init__.py", line 339, in loads
    raise TypeError(f'the JSON object must be str, bytes or bytearray, '
TypeError: the JSON object must be str, bytes or bytearray, not list
Logger: homeassistant.components.sensor
Source: helpers/entity_platform.py:361
Integration: Capteur (documentation, issues)
First occurred: 11:11:28 (1 occurrences)
Last logged: 11:11:28

Error while setting up rte_ecowatt platform for sensor
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 300, in _async_refresh
    self.data = await self._async_update_data()
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 256, in _async_update_data
    return await self.update_method()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/rte_ecowatt/__init__.py", line 189, in update_method
    signals = json.loads(body)["signals"]
              ^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/json/__init__.py", line 339, in loads
    raise TypeError(f'the JSON object must be str, bytes or bytearray, '
TypeError: the JSON object must be str, bytes or bytearray, not list

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 361, in _async_setup_platform
    await asyncio.shield(task)
  File "/config/custom_components/rte_ecowatt/sensor.py", line 82, in async_setup_entry
    await rte_coordinator.async_config_entry_first_refresh()
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 272, in async_config_entry_first_refresh
    raise ex
homeassistant.exceptions.ConfigEntryNotReady: the JSON object must be str, bytes or bytearray, not list

```

Uniformisation des noms de calendrier

Salut,
Sur la version 0.6.0 les calendriers se créent bien
image
et
image
Par contre, est-ce utile d'appeler le premier avec calendar à la fin calendar.ecowatt_downgraded_level_calendar ? Si oui alors il faut faire pareil sur le deuxième
@++

Erreur avec l'intégration 0.6.5

J'ai un problème avec cette API à jour depuis mon HA à jour.

J'ai cette erreur dans les journaux.

Logger: homeassistant.components.sensor
Source: helpers/update_coordinator.py:197
Integration: Capteur (documentation, issues)
First occurred: 15:34:28 (2 occurrences)
Last logged: 15:35:22

Error while setting up rte_ecowatt platform for sensor
Traceback (most recent call last):
  File "/config/custom_components/rte_ecowatt/__init__.py", line 595, in update_method
    shedding_event["start_date"] = self._parse_enedis_time(
  File "/config/custom_components/rte_ecowatt/__init__.py", line 610, in _parse_enedis_time
    a = datetime.strptime(time_string, "%d/%m/%Y %H:%M")
  File "/usr/local/lib/python3.10/_strptime.py", line 568, in _strptime_datetime
    tt, fraction, gmtoff_fraction = _strptime(data_string, format)
  File "/usr/local/lib/python3.10/_strptime.py", line 352, in _strptime
    raise ValueError("unconverted data remains: %s" %
ValueError: unconverted data remains: :00

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 225, in _async_refresh
    self.data = await self._async_update_data()
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 181, in _async_update_data
    return await self.update_method()
  File "/config/custom_components/rte_ecowatt/__init__.py", line 607, in update_method
    raise UpdateFailed(f"Error communicating with API: {err}")
homeassistant.helpers.update_coordinator.UpdateFailed: Error communicating with API: unconverted data remains: :00

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 281, in _async_setup_platform
    await asyncio.shield(task)
  File "/config/custom_components/rte_ecowatt/sensor.py", line 92, in async_setup_entry
    await enedis_coordinator.async_config_entry_first_refresh()
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 197, in async_config_entry_first_refresh
    raise ex
homeassistant.exceptions.ConfigEntryNotReady: Error communicating with API: unconverted data remains: :00

J'ai tenté la suppression, redémarrage de HA, ajout de l'intégration avec mon ID Client et mon ID Secret, redémarrage HA.

How present data in dashboard

Hi,

Many thanks for this extension !!

I'm wondering what is the best presentation to integrate data in HA dashboard ?

Could you share some examples of dashboard integration please ?

Thank you !

Entité manquante

Bonjour,

J'ai vu sur le forum de HACF qu'il y a une entité Next load sheddings qui indique le prochain évènement de délestage au niveau local.
Chez moi cette entité n’apparait pas.
image

Est-ce que c'est normal ou il y a quelque chose à faire pour l'activer?

En tout cas merci pour le travail que tu a fait.

TypeError: unsupported operand type(s) for |: 'types.GenericAlias' and 'NoneType'

Après la mise à jour en version 0.2.1, j'ai tenté la reconfiguration en utilisant l'interface et j'ai cette erreur dans les logs d'Home Assistant :

Oct 05 22:52:20 skinner hass[15374]: 2022-10-05 22:52:20.431 ERROR (MainThread) [homeassistant.loader] Unexpected exception importing platform custom_components.rte_ecowatt.config_flow
Oct 05 22:52:20 skinner hass[15374]: Traceback (most recent call last):
Oct 05 22:52:20 skinner hass[15374]:   File "/srv/homeassistant/lib/python3.9/site-packages/homeassistant/loader.py", line 722, in get_platform
Oct 05 22:52:20 skinner hass[15374]:     cache[full_name] = self._import_platform(platform_name)
Oct 05 22:52:20 skinner hass[15374]:   File "/srv/homeassistant/lib/python3.9/site-packages/homeassistant/loader.py", line 739, in _import_platform
Oct 05 22:52:20 skinner hass[15374]:     return importlib.import_module(f"{self.pkg_path}.{platform_name}")
Oct 05 22:52:20 skinner hass[15374]:   File "/usr/lib/python3.9/importlib/__init__.py", line 127, in import_module
Oct 05 22:52:20 skinner hass[15374]:     return _bootstrap._gcd_import(name[level:], package, level)
Oct 05 22:52:20 skinner hass[15374]:   File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
Oct 05 22:52:20 skinner hass[15374]:   File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
Oct 05 22:52:20 skinner hass[15374]:   File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
Oct 05 22:52:20 skinner hass[15374]:   File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
Oct 05 22:52:20 skinner hass[15374]:   File "<frozen importlib._bootstrap_external>", line 790, in exec_module
Oct 05 22:52:20 skinner hass[15374]:   File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
Oct 05 22:52:20 skinner hass[15374]:   File "/srv/homeassistant/.homeassistant/custom_components/rte_ecowatt/config_flow.py", line 29, in <module>
Oct 05 22:52:20 skinner hass[15374]:     class SetupConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
Oct 05 22:52:20 skinner hass[15374]:   File "/srv/homeassistant/.homeassistant/custom_components/rte_ecowatt/config_flow.py", line 30, in SetupConfigFlow
Oct 05 22:52:20 skinner hass[15374]:     async def async_step_user(self, user_input: dict[str, Any] | None = None):
Oct 05 22:52:20 skinner hass[15374]: TypeError: unsupported operand type(s) for |: 'types.GenericAlias' and 'NoneType'
Oct 05 22:52:20 skinner hass[15374]: 2022-10-05 22:52:20.436 ERROR (MainThread) [homeassistant.config_entries] Error occurred loading configuration flow for integration rte_ecowatt: Exception importing custom_components.rte_ecowatt.config_flow

Ça ressemble à un problème de compatibilité entre versions de python, donc je précise que je suis en python 3.9.2. J'ai corrigé le problème en supprimant le typage du paramètre user_input des méthodes de la classe SetupConfigFlow et j'ai pu finaliser la configuration de l'intégration via l'interface.

No configuration UI

I have no way to configure the API, i.e. giving my client id and secret id.
Capture d’écran 2022-11-24 182202

Error doing job: Task exception was never retrieved

Bonjour

C'est encore moi. Cela fait deux nuits de suite où j'ai cette erreur qui apparaît.

Logger: homeassistant
Source: custom_components/rte_ecowatt/init.py:483
Integration: My EcoWatt by RTE (documentation, issues)
First occurred: 00:02:33 (1 occurrences)
Last logged: 00:02:33

Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File "/config/custom_components/rte_ecowatt/init.py", line 463, in _find_ecowatt_level
ecowatt_data = next(
StopIteration

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 168, in _handle_refresh_interval
await self._async_refresh(log_failures=True, scheduled=True)
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 316, in _async_refresh
self.async_update_listeners()
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 121, in async_update_listeners
update_callback()
File "/config/custom_components/rte_ecowatt/init.py", line 348, in _handle_coordinator_update
ecowatt_level = self._find_ecowatt_level()
File "/config/custom_components/rte_ecowatt/init.py", line 483, in _find_ecowatt_level
raise RuntimeError(
RuntimeError: Unable to find ecowatt level for 2022-12-28

J'ai comme l'impression que le J+3 pose problème. Pourtant jusqu'au 23 décembre, je n'avais aucune erreur.

can't restart HA after new release

After having loaded the last version of today 16/12/2022
HA can't restart and I have got this message when checking the config :
Invalid config for [sensor.rte_ecowatt]: required key not provided @ data['enedis_load_shedding']. Got None. (See ?, line ?).

any idea ?

No sensor are created with graphical integration

Here is what I did.
I've removed previous HACS repo, removed rte-ecowatt config from yaml, deleted according sensors and reboot.
I've clicked on installation button from github site, selected beta 0.2.1 and installed it (no info for rebooting at end of installation, I don't know if it's normal), then rebooted.
I've added new integration, choosed rte-ecowatt, filled my credential, choosed "default sensors" and validated but no sensor were created.

Here is the error from log

Logger: homeassistant.components.sensor
Source: custom_components/rte_ecowatt/sensor.py:61
Integration: Capteur (documentation, issues)
First occurred: 07:58:57 (1 occurrences)
Last logged: 07:58:57

Error while setting up rte_ecowatt platform for sensor
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 281, in _async_setup_platform
    await asyncio.shield(task)
  File "/config/custom_components/rte_ecowatt/sensor.py", line 61, in async_setup_entry
    for sensor_config in entry.data["sensors"]:
KeyError: 'sensors'

Error communicating with RTE API: requests too frequent to RTE API

Salut,

Après configuration qui se passe bien, je récupère les valeurs ça fonctionne, c'est nickel !

Par contre au bout de quelque minutes j'ai droits à cette erreur :

Logger: homeassistant.components.sensor
Source: helpers/update_coordinator.py:178
Integration: Capteur ([documentation](https://www.home-assistant.io/integrations/sensor), [issues](https://github.com/home-assistant/home-assistant/issues?q=is%3Aissue+is%3Aopen+label%3A%22integration%3A+sensor%22))
First occurred: 10:28:37 (1 occurrences)
Last logged: 10:28:37

Error while setting up rte_ecowatt platform for sensor
Traceback (most recent call last):
  File "/config/custom_components/rte_ecowatt/sensor.py", line 146, in update_method
    raise UpdateFailed(
homeassistant.helpers.update_coordinator.UpdateFailed: Error communicating with RTE API: requests too frequent to RTE API

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 205, in _async_refresh
    self.data = await self._async_update_data()
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 164, in _async_update_data
    return await self.update_method()
  File "/config/custom_components/rte_ecowatt/sensor.py", line 166, in update_method
    raise UpdateFailed(f"Error communicating with API: {err}")
homeassistant.helpers.update_coordinator.UpdateFailed: Error communicating with API: Error communicating with RTE API: requests too frequent to RTE API

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 281, in _async_setup_platform
    await asyncio.shield(task)
  File "/config/custom_components/rte_ecowatt/sensor.py", line 99, in async_setup_platform
    await coordinator.async_config_entry_first_refresh()
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 178, in async_config_entry_first_refresh
    raise ex
homeassistant.exceptions.ConfigEntryNotReady: Error communicating with API: Error communicating with RTE API: requests too frequent to RTE API

J'ai regarder sur data.rte-france.com sur mon app si il y avait des quotas d'appelle API. J'ai rien trouvé.

Super taff byw, dispo pour test plus d'infos.

Capteurs par région?

Bonjour, un grand merci tout d'abord pour le développement de cet API pour HASSIO :)
Il semble que ce capteur reprends la valeur ecowatt nationale, est il possible de paramétrer pour récupérer une version régionale?
Merci d'avance !

Often no connection, breaking logic

Quite often (almost daily) the connection fails and this break my logic, the sensor state becomes no long erSiutaion Normale but unknown and I cannot run automations/conditions against that ..i.e. there are too many state-options if I want an alert that differs from "Situation Normale"
As the connection can probably not be resolved wihtout kicking Enedis, please consider error catching and default state

Error while setting up rte_ecowatt platform for sensor
Traceback (most recent call last):
  File "/config/custom_components/rte_ecowatt/__init__.py", line 560, in update_method
    raise UpdateFailed("Failed fetching enedis data at step 1")
homeassistant.helpers.update_coordinator.UpdateFailed: Failed fetching enedis data at step 1

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 258, in _async_refresh
    self.data = await self._async_update_data()
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 217, in _async_update_data
    return await self.update_method()
  File "/config/custom_components/rte_ecowatt/__init__.py", line 609, in update_method
    raise UpdateFailed(f"Error communicating with API: {err}")
homeassistant.helpers.update_coordinator.UpdateFailed: Error communicating with API: Failed fetching enedis data at step 1

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 304, in _async_setup_platform
    await asyncio.shield(task)
  File "/config/custom_components/rte_ecowatt/sensor.py", line 92, in async_setup_entry
    await enedis_coordinator.async_config_entry_first_refresh()
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 233, in async_config_entry_first_refresh
    raise ex
homeassistant.exceptions.ConfigEntryNotReady: Error communicating with API: Failed fetching enedis data at step 1

Ne fonctionn plus depuis version Home Assistant 2024.1.5

Depuis ma monté de version de Home Assistant
Les sensors restent en mode inconnu.
Trace dans log :
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 300, in _async_refresh
self.data = await self._async_update_data()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 256, in _async_update_data
return await self.update_method()
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/rte_ecowatt/init.py", line 189, in update_method
signals = json.loass(body)["signals"]
~~~~~~~~~~~~~~~~^^^^^^^^^^^
TypeError: string indices must be integers, not 'str'

Que faut-il corriger pour redémarrer cette intégration.
Nota ; je suis sur Nas Synology avec Docker
Merci

Unable to find ecowatt level dans le futur

    Salut et merci pour vos efforts.

Tout marche pas mal jusqu’à ce que je choisisse une entité "Jour + x heures"

2022-12-05 21:08:30.001 DEBUG (MainThread) [custom_components.rte_ecowatt] Calling update method, 5 listeners subscribed 2022-12-05 21:08:30.001 DEBUG (MainThread) [custom_components.rte_ecowatt] Starting collecting data 2022-12-05 21:08:30.279 DEBUG (MainThread) [custom_components.rte_ecowatt] Fetched a token for RTE API 2022-12-05 21:08:30.377 INFO (MainThread) [custom_components.rte_ecowatt] data received, status code: 200 2022-12-05 21:08:30.377 DEBUG (MainThread) [custom_components.rte_ecowatt] api response body: {"signals":[{"GenerationFichier":"2022-12-04T23:00:00+01:00","jour":"2022-12-05T00:00:00+01:00","dvalue":1,"message":"Pas d\u2019alerte.","values":[{"pas":0,"hvalue":1},{"pas":1,"hvalue":1},{"pas":2,"hvalue":1},{"pas":3,"hvalue":1},{"pas":4,"hvalue":1},{"pas":5,"hvalue":1},{"pas":6,"hvalue":1},{"pas":7,"hvalue":1},{"pas":8,"hvalue":1},{"pas":9,"hvalue":1},{"pas":10,"hvalue":1},{"pas":11,"hvalue":1},{"pas":12,"hvalue":1},{"pas":13,"hvalue":1},{"pas":14,"hvalue":1},{"pas":15,"hvalue":1},{"pas":16,"hvalue":1},{"pas":17,"hvalue":1},{"pas":18,"hvalue":1},{"pas":19,"hvalue":1},{"pas":20,"hvalue":1},{"pas":21,"hvalue":1},{"pas":22,"hvalue":1},{"pas":23,"hvalue":1}]},{"GenerationFichier":"2022-12-04T23:00:00+01:00","jour":"2022-12-06T00:00:00+01:00","dvalue":1,"message":"Pas d\u2019alerte.","values":[{"pas":0,"hvalue":1},{"pas":1,"hvalue":1},{"pas":2,"hvalue":1},{"pas":3,"hvalue":1},{"pas":4,"hvalue":1},{"pas":5,"hvalue":1},{"pas":6,"hvalue":1},{"pas":7,"hvalue":1},{"pas":8,"hvalue":1},{"pas":9,"hvalue":1},{"pas":10,"hvalue":1},{"pas":11,"hvalue":1},{"pas":12,"hvalue":1},{"pas":13,"hvalue":1},{"pas":14,"hvalue":1},{"pas":15,"hvalue":1},{"pas":16,"hvalue":1},{"pas":17,"hvalue":1},{"pas":18,"hvalue":1},{"pas":19,"hvalue":1},{"pas":20,"hvalue":1},{"pas":21,"hvalue":1},{"pas":22,"hvalue":1},{"pas":23,"hvalue":1}]},{"GenerationFichier":"2022-12-04T23:00:00+01:00","jour":"2022-12-07T00:00:00+01:00","dvalue":1,"message":"Pas d\u2019alerte.","values":[{"pas":0,"hvalue":1},{"pas":1,"hvalue":1},{"pas":2,"hvalue":1},{"pas":3,"hvalue":1},{"pas":4,"hvalue":1},{"pas":5,"hvalue":1},{"pas":6,"hvalue":1},{"pas":7,"hvalue":1},{"pas":8,"hvalue":1},{"pas":9,"hvalue":1},{"pas":10,"hvalue":1},{"pas":11,"hvalue":1},{"pas":12,"hvalue":1},{"pas":13,"hvalue":1},{"pas":14,"hvalue":1},{"pas":15,"hvalue":1},{"pas":16,"hvalue":1},{"pas":17,"hvalue":1},{"pas":18,"hvalue":1},{"pas":19,"hvalue":1},{"pas":20,"hvalue":1},{"pas":21,"hvalue":1},{"pas":22,"hvalue":1},{"pas":23,"hvalue":1}]},{"GenerationFichier":"2022-12-04T23:00:00+01:00","jour":"2022-12-08T00:00:00+01:00","dvalue":1,"message":"Pas d\u2019alerte.","values":[{"pas":0,"hvalue":1},{"pas":1,"hvalue":1},{"pas":2,"hvalue":1},{"pas":3,"hvalue":1},{"pas":4,"hvalue":1},{"pas":5,"hvalue":1},{"pas":6,"hvalue":1},{"pas":7,"hvalue":1},{"pas":8,"hvalue":1},{"pas":9,"hvalue":1},{"pas":10,"hvalue":1},{"pas":11,"hvalue":1},{"pas":12,"hvalue":1},{"pas":13,"hvalue":1},{"pas":14,"hvalue":1},{"pas":15,"hvalue":1},{"pas":16,"hvalue":1},{"pas":17,"hvalue":1},{"pas":18,"hvalue":1},{"pas":19,"hvalue":1},{"pas":20,"hvalue":1},{"pas":21,"hvalue":1},{"pas":22,"hvalue":1},{"pas":23,"hvalue":1}]}]} 2022-12-05 21:08:30.379 DEBUG (MainThread) [custom_components.rte_ecowatt] data parsed: [{'GenerationFichier': '2022-12-04T23:00:00+01:00', 'jour': '2022-12-05T00:00:00+01:00', 'dvalue': 1, 'message': 'Pas d’alerte.', 'values': [{'pas': 0, 'hvalue': 1}, {'pas': 1, 'hvalue': 1}, {'pas': 2, 'hvalue': 1}, {'pas': 3, 'hvalue': 1}, {'pas': 4, 'hvalue': 1}, {'pas': 5, 'hvalue': 1}, {'pas': 6, 'hvalue': 1}, {'pas': 7, 'hvalue': 1}, {'pas': 8, 'hvalue': 1}, {'pas': 9, 'hvalue': 1}, {'pas': 10, 'hvalue': 1}, {'pas': 11, 'hvalue': 1}, {'pas': 12, 'hvalue': 1}, {'pas': 13, 'hvalue': 1}, {'pas': 14, 'hvalue': 1}, {'pas': 15, 'hvalue': 1}, {'pas': 16, 'hvalue': 1}, {'pas': 17, 'hvalue': 1}, {'pas': 18, 'hvalue': 1}, {'pas': 19, 'hvalue': 1}, {'pas': 20, 'hvalue': 1}, {'pas': 21, 'hvalue': 1}, {'pas': 22, 'hvalue': 1}, {'pas': 23, 'hvalue': 1}], 'date': datetime.date(2022, 12, 5)}, {'GenerationFichier': '2022-12-04T23:00:00+01:00', 'jour': '2022-12-06T00:00:00+01:00', 'dvalue': 1, 'message': 'Pas d’alerte.', 'values': [{'pas': 0, 'hvalue': 1}, {'pas': 1, 'hvalue': 1}, {'pas': 2, 'hvalue': 1}, {'pas': 3, 'hvalue': 1}, {'pas': 4, 'hvalue': 1}, {'pas': 5, 'hvalue': 1}, {'pas': 6, 'hvalue': 1}, {'pas': 7, 'hvalue': 1}, {'pas': 8, 'hvalue': 1}, {'pas': 9, 'hvalue': 1}, {'pas': 10, 'hvalue': 1}, {'pas': 11, 'hvalue': 1}, {'pas': 12, 'hvalue': 1}, {'pas': 13, 'hvalue': 1}, {'pas': 14, 'hvalue': 1}, {'pas': 15, 'hvalue': 1}, {'pas': 16, 'hvalue': 1}, {'pas': 17, 'hvalue': 1}, {'pas': 18, 'hvalue': 1}, {'pas': 19, 'hvalue': 1}, {'pas': 20, 'hvalue': 1}, {'pas': 21, 'hvalue': 1}, {'pas': 22, 'hvalue': 1}, {'pas': 23, 'hvalue': 1}], 'date': datetime.date(2022, 12, 6)}, {'GenerationFichier': '2022-12-04T23:00:00+01:00', 'jour': '2022-12-07T00:00:00+01:00', 'dvalue': 1, 'message': 'Pas d’alerte.', 'values': [{'pas': 0, 'hvalue': 1}, {'pas': 1, 'hvalue': 1}, {'pas': 2, 'hvalue': 1}, {'pas': 3, 'hvalue': 1}, {'pas': 4, 'hvalue': 1}, {'pas': 5, 'hvalue': 1}, {'pas': 6, 'hvalue': 1}, {'pas': 7, 'hvalue': 1}, {'pas': 8, 'hvalue': 1}, {'pas': 9, 'hvalue': 1}, {'pas': 10, 'hvalue': 1}, {'pas': 11, 'hvalue': 1}, {'pas': 12, 'hvalue': 1}, {'pas': 13, 'hvalue': 1}, {'pas': 14, 'hvalue': 1}, {'pas': 15, 'hvalue': 1}, {'pas': 16, 'hvalue': 1}, {'pas': 17, 'hvalue': 1}, {'pas': 18, 'hvalue': 1}, {'pas': 19, 'hvalue': 1}, {'pas': 20, 'hvalue': 1}, {'pas': 21, 'hvalue': 1}, {'pas': 22, 'hvalue': 1}, {'pas': 23, 'hvalue': 1}], 'date': datetime.date(2022, 12, 7)}, {'GenerationFichier': '2022-12-04T23:00:00+01:00', 'jour': '2022-12-08T00:00:00+01:00', 'dvalue': 1, 'message': 'Pas d’alerte.', 'values': [{'pas': 0, 'hvalue': 1}, {'pas': 1, 'hvalue': 1}, {'pas': 2, 'hvalue': 1}, {'pas': 3, 'hvalue': 1}, {'pas': 4, 'hvalue': 1}, {'pas': 5, 'hvalue': 1}, {'pas': 6, 'hvalue': 1}, {'pas': 7, 'hvalue': 1}, {'pas': 8, 'hvalue': 1}, {'pas': 9, 'hvalue': 1}, {'pas': 10, 'hvalue': 1}, {'pas': 11, 'hvalue': 1}, {'pas': 12, 'hvalue': 1}, {'pas': 13, 'hvalue': 1}, {'pas': 14, 'hvalue': 1}, {'pas': 15, 'hvalue': 1}, {'pas': 16, 'hvalue': 1}, {'pas': 17, 'hvalue': 1}, {'pas': 18, 'hvalue': 1}, {'pas': 19, 'hvalue': 1}, {'pas': 20, 'hvalue': 1}, {'pas': 21, 'hvalue': 1}, {'pas': 22, 'hvalue': 1}, {'pas': 23, 'hvalue': 1}], 'date': datetime.date(2022, 12, 8)}] 2022-12-05 21:08:30.379 INFO (MainThread) [custom_components.rte_ecowatt] Fetching ecowatt api data recovered 2022-12-05 21:08:30.379 DEBUG (MainThread) [custom_components.rte_ecowatt] Finished fetching ecowatt api data in 0.378 seconds (success: True) 2022-12-05 21:08:30.379 DEBUG (MainThread) [custom_components.rte_ecowatt] Looking for 2022-12-05 21:08:30.379825+01:00 2022-12-05 21:08:30.380 INFO (MainThread) [custom_components.rte_ecowatt] updated 'Next downgraded period' 2022-12-05 21:08:30.380 DEBUG (MainThread) [custom_components.rte_ecowatt] Looking for 2022-12-09 19:08:30.380546+01:00 2022-12-05 21:08:30.380 INFO (MainThread) [custom_components.rte_ecowatt] Data for relevant day: None 2022-12-05 21:08:30.380 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved Traceback (most recent call last): File "/config/custom_components/rte_ecowatt/__init__.py", line 392, in _find_ecowatt_level ecowatt_data = next( StopIteration During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 151, in _handle_refresh_interval await self._async_refresh(log_failures=True, scheduled=True) File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 283, in _async_refresh self.async_update_listeners() File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 110, in async_update_listeners update_callback() File "/config/custom_components/rte_ecowatt/__init__.py", line 325, in _handle_coordinator_update ecowatt_level = self._find_ecowatt_level() File "/config/custom_components/rte_ecowatt/__init__.py", line 416, in _find_ecowatt_level raise RuntimeError( RuntimeError: Unable to find ecowatt level for 2022-12-09 19:08:30.380546+01:00 (hour shift: 22)

A noter que le (hour shift: 22) change suivant le nombre d'heure que je demande.
Si je peux vous être utile...

Originally posted by @michelsup in #28 (comment)

Problème avec 2023.2

Detected integration that called async_setup_platforms instead of awaiting async_forward_entry_setups; this will fail in version 2023.3. Please report issue to the custom integration author for rte_ecowatt using this method at custom_components/rte_ecowatt/__init__.py, line 65: hass.config_entries.async_setup_platforms(

Voir hacs/integration#3038

Update required for next HA Version

Recently updated to HA 2023.2.0 and the following warning message raised in logs

Source: helpers/frame.py:77
First occurred: 18:42:02 (1 occurrences)
Last logged: 18:42:02

Detected integration that called async_setup_platforms instead of awaiting async_forward_entry_setups; this will fail in version 2023.3. Please report issue to the custom integration author for rte_ecowatt using this method at custom_components/rte_ecowatt/__init__.py, line 65: hass.config_entries.async_setup_platforms(

Thus it seems that the component requires update to continue working after release 2023.3.
Just a warning for the moment.
I'll see if I can give a try fixing it. For the moment jsut logging :-)

Exception depuis 0.7.0

Bonjour,

J'ai mis à jour vers la version 0.7.0 en suivant ce qui était préconisé à savoir suppression de l'intégration, réinstallation avec nouvelle clé API v5 puis ajout des sensors pour le lendemain et pour j+2.

Cependant, maintenant, les sensors ne sont pas tous peuplés, certains sont en état unknown et le logger remonte assez souvent l'erreur suivante :

Cette erreur provient d'une intégration personnalisée

Logger: homeassistant
Source: custom_components/rte_ecowatt/__init__.py:379
Integration: My EcoWatt by RTE (documentation, issues)
First occurred: 17:25:19 (15 occurrences)
Last logged: 21:09:19

Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 233, in _handle_refresh_interval
    await self._async_refresh(log_failures=True, scheduled=True)
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 389, in _async_refresh
    self.async_update_listeners()
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 172, in async_update_listeners
    update_callback()
  File "/config/custom_components/rte_ecowatt/__init__.py", line 368, in _handle_coordinator_update
    self._state = self._level2string(ecowatt_level)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/rte_ecowatt/__init__.py", line 379, in _level2string
    return {
           ^
KeyError: 0

Ci-dessous une capture des états des sensors dont certains sont unknown, sûrement à cause de l'erreur précédente :
image

Erreur lors de l'initialisation

Lors de la mise à jour vers la version 0.9.0 (utilisation de l'api V4 pour le moment).

Logger: custom_components.rte_ecowatt
Source: helpers/update_coordinator.py:300
Integration: My EcoWatt by RTE ([documentation](https://github.com/kamaradclimber/rte-ecowatt), [issues](https://github.com/kamaradclimber/rte-ecowatt/issues))
First occurred: 18:22:50 (1 occurrences)
Last logged: 18:22:50

Unexpected error fetching ecowatt api data: the JSON object must be str, bytes or bytearray, not list
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 300, in _async_refresh
    self.data = await self._async_update_data()
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 256, in _async_update_data
    return await self.update_method()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/rte_ecowatt/__init__.py", line 189, in update_method
    signals = json.loads(body)["signals"]
              ^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/json/__init__.py", line 339, in loads
    raise TypeError(f'the JSON object must be str, bytes or bytearray, '
TypeError: the JSON object must be str, bytes or bytearray, not list

Idem #77 , mais ne disparait pas ;-)
HA 2023.12.3

Erreurs lors de l'ajout du capteur délestage ENEDIS, semble bloquer le rafraichissement de tous les capteurs RTE

Bonjour,

Quand j'ajoute le capteur ecowatt par défaut, j'ai bien les valeurs qui remontent. Mais, dès que j'ajoute le capteur des délestages d'ENEDIS, je perds toute info dans le capteur Ecowatt et n'en ai aucune dans celui ENEDIS. Voici le log:

2023-11-28 21:34:44.379 DEBUG (MainThread) [custom_components.rte_ecowatt] Restoring state for enedis-electricity-distributor
2023-11-28 21:34:44.381 DEBUG (MainThread) [custom_components.rte_ecowatt] starting to restore sensor from previous data
2023-11-28 21:34:44.381 DEBUG (MainThread) [custom_components.rte_ecowatt] Restoring state for enedis-sent-address
2023-11-28 21:34:44.547 WARNING (MainThread) [custom_components.rte_ecowatt] Failure to fetch data from /shedding/state_js endpoint: <html>
<head><title>503 Service Temporarily Unavailable</title></head>
<body>
<center><h1>503 Service Temporarily Unavailable</h1></center>
</body>
</html>

2023-11-28 21:34:44.548 DEBUG (MainThread) [custom_components.rte_ecowatt] Finished fetching enedis api data in 0.176 seconds (success: False)
2023-11-28 21:34:44.548 DEBUG (MainThread) [custom_components.rte_ecowatt] Last coordinator failed, assuming state has not changed
2023-11-28 21:34:44.548 DEBUG (MainThread) [custom_components.rte_ecowatt] Last coordinator failed, assuming state has not changed
2023-11-28 21:34:44.548 DEBUG (MainThread) [custom_components.rte_ecowatt] Last coordinator failed, assuming state has not changed
2023-11-28 21:34:44.548 ERROR (MainThread) [homeassistant.components.sensor] Error while setting up rte_ecowatt platform for sensor
Traceback (most recent call last):
  File "/config/custom_components/rte_ecowatt/__init__.py", line 625, in update_method
    raise UpdateFailed("Failed fetching enedis data at step 1")
homeassistant.helpers.update_coordinator.UpdateFailed: Failed fetching enedis data at step 1

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 290, in _async_refresh
    self.data = await self._async_update_data()
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 246, in _async_update_data
    return await self.update_method()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/rte_ecowatt/__init__.py", line 674, in update_method
    raise UpdateFailed(f"Error communicating with API: {err}")
homeassistant.helpers.update_coordinator.UpdateFailed: Error communicating with API: Failed fetching enedis data at step 1

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 359, in _async_setup_platform
    await asyncio.shield(task)
  File "/config/custom_components/rte_ecowatt/sensor.py", line 92, in async_setup_entry
    await enedis_coordinator.async_config_entry_first_refresh()
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 262, in async_config_entry_first_refresh
    raise ex
homeassistant.exceptions.ConfigEntryNotReady: Error communicating with API: Failed fetching enedis data at step 1

Merci d'avance pour le correctif !

Plus rien ne remonte

bonjour
Plus rien ne remonte au niveau des sensors

dans le log HA

homeassistant.helpers.update_coordinator.UpdateFailed: Error communicating with API: Error communicating with RTE API: status code was 403

Capture

erreur apres mise à jour 6.3

Bonjour @kamaradclimber

Après la mise à jour de 0.4.2 en 0.6.3. l'intégration à planté, j'ai le message : Le flux de configuration n'a pas pu être chargé: {"message":"Invalid handler specified"} qui s'affiche lors du clic sur l'intégration.
Et ce même après désinstallation / réinstallation complète dans HACS. (avec bien sûr des redémarrages à chaque étapes)

Une idée de ce qui pourrait clocher ?

 Logger: homeassistant.config_entries
Source: config_entries.py:810
First occurred: 13:45:47 (2 occurrences)
Last logged: 13:49:32
Error occurred loading configuration flow for integration rte_ecowatt: Exception importing custom_components.rte_ecowatt.config_flow
Cette erreur provient d'une intégration personnalisée

Logger: homeassistant.loader
Source: custom_components/rte_ecowatt/__init__.py:245
Integration: rte_ecowatt (documentation, issues)
First occurred: 13:45:46 (2 occurrences)
Last logged: 13:49:32

Unexpected exception importing platform custom_components.rte_ecowatt.config_flow
Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.9/site-packages/homeassistant/loader.py", line 728, in get_platform
    cache[full_name] = self._import_platform(platform_name)
  File "/srv/homeassistant/lib/python3.9/site-packages/homeassistant/loader.py", line 745, in _import_platform
    return importlib.import_module(f"{self.pkg_path}.{platform_name}")
  File "/usr/lib/python3.9/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 972, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 790, in exec_module
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  File "/home/homeassistant/.homeassistant/custom_components/rte_ecowatt/__init__.py", line 237, in <module>
    class DowngradedEcowattLevelCalendar(CoordinatorEntity, CalendarEntity):
  File "/home/homeassistant/.homeassistant/custom_components/rte_ecowatt/__init__.py", line 245, in DowngradedEcowattLevelCalendar
    def event(self) -> CalendarEvent | None:
TypeError: unsupported operand type(s) for |: 'type' and 'NoneType'

Error doing job: Task exception was never retrieved

Hello

Seconde erreur

Source: custom_components/rte_ecowatt/__init__.py:356
Integration: My EcoWatt by RTE ([documentation](https://github.com/kamaradclimber/rte-ecowatt), [issues](https://github.com/kamaradclimber/rte-ecowatt/issues))
First occurred: 22:40:05 (2 occurrences)
Last logged: 22:56:05

Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/config/custom_components/rte_ecowatt/__init__.py", line 332, in _find_ecowatt_level
    ecowatt_data = next(
StopIteration

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 151, in _handle_refresh_interval
    await self._async_refresh(log_failures=True, scheduled=True)
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 283, in _async_refresh
    self.async_update_listeners()
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 110, in async_update_listeners
    update_callback()
  File "/config/custom_components/rte_ecowatt/__init__.py", line 265, in _handle_coordinator_update
    ecowatt_level = self._find_ecowatt_level()
  File "/config/custom_components/rte_ecowatt/__init__.py", line 356, in _find_ecowatt_level
    raise RuntimeError(
RuntimeError: Unable to find ecowatt level for 2022-11-05 21:40:05.239338+01:00 (hour shift: 23)```

pas de data Error communicating with API: Error communicating with RTE API: requests too frequent to RTE API

image
hello merci pour le repo ! j'ai tout implémenté mais je n'ai pas de data qui remonte.

J'ai loggué cette erreur :

homeassistant.helpers.update_coordinator.UpdateFailed: Error communicating with RTE API: requests too frequent to RTE API

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 283, in _async_refresh
    self.data = await self._async_update_data()
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 242, in _async_update_data
    return await self.update_method()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/rte_ecowatt/__init__.py", line 206, in update_method
    raise UpdateFailed(f"Error communicating with API: {err}")
homeassistant.helpers.update_coordinator.UpdateFailed: Error communicating with API: Error communicating with RTE API: requests too frequent to RTE API

Erreur

Salut j'ai cette erreur la
Logger: homeassistant.components.sensor
Source: helpers/update_coordinator.py:258
Integration: Capteur (documentation, issues)
First occurred: 20:14:02 (1 occurrences)
Last logged: 20:14:02

Error while setting up rte_ecowatt platform for sensor
Traceback (most recent call last):
File "/config/custom_components/rte_ecowatt/init.py", line 187, in update_method
raise UpdateFailed(
homeassistant.helpers.update_coordinator.UpdateFailed: Error communicating with RTE API: requests too frequent to RTE API

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 283, in _async_refresh
self.data = await self._async_update_data()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 242, in _async_update_data
return await self.update_method()
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/rte_ecowatt/init.py", line 206, in update_method
raise UpdateFailed(f"Error communicating with API: {err}")
homeassistant.helpers.update_coordinator.UpdateFailed: Error communicating with API: Error communicating with RTE API: requests too frequent to RTE API

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 353, in _async_setup_platform
await asyncio.shield(task)
File "/config/custom_components/rte_ecowatt/sensor.py", line 98, in async_setup_entry
await rte_coordinator.async_config_entry_first_refresh()
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 258, in async_config_entry_first_refresh
raise ex
homeassistant.exceptions.ConfigEntryNotReady: Error communicating with API: Error communicating with RTE API: requests too frequent to RTE API

Repository kamaradclimber/rte-ecowatt not found

Hello,

Tout d'abord merci énormément pour ce partage !
Je n'arrive pas à trouver l'integration sous HACS que ce soit par le lien ou en recherchant manuellement.
Repository kamaradclimber/rte-ecowatt not found

Error in adress detection

The address detected give Insee code instead of Zip code.
I don't if its a bug or if this the way it is supposed to work with Enedis API.

Valeurs possibles

Bonjour

Merci pour le travail !
Question : quelles sont les différentes valeurs possibles pour les sensors?

merci !

Apres personalisation les sensors deviennent indisponibles

Voila le problème que je rencontre si je veux personnaliser une entree de l'intégration rte_ecowatt
Dans une carte de type entities, sélectionner un capteur, dans l'onglet paramètre changer le nom ou l’icône et valider: le capteur devient indisponible. pas d'erreur particulière dans les logs d'HA.
Si on redémarre HA, le capteur est a nouveau disponible avec son nouveau nom.

Reconfiguration only works once after HA restart

When trying to add "new" sensors, the sequence works only once after HA restart.

Scenario:

  • add integration, restart HA
  • configure the integration with default settings
  • reconfigure the integration to add a new sensor => it works as expected
  • reconfigure the integration to add another sensor => nothing happens (but not error is triggered, we get information that update proceeded correctly)

This behavior seemed to have appeared with #31 but I can't explain it so far.

Impossibilité de configurer un nouveau capteur (granularité journalière)

Les capteurs par défaut (now et today) sont bien renseignés, 2 nouveaux capteurs (tomorrow et 2 days) ne sont jamais mis à jour (valeur : Inconnu).

Un redémarrage de HA ne change rien.

Logger: homeassistant.components.sensor
Source: helpers/entity_platform.py:520
Integration: Capteur (documentation, issues)
First occurred: 14:05:45 (1 occurrences)
Last logged: 14:05:45
Platform rte_ecowatt does not generate unique IDs. ID ecowatt-level-in-1-days already exists - ignoring sensor.ecowatt_level_tomorrow

TypeError: object StoredState can't be used in 'await' expression i

Bonjour, avec la dernière version de l'image Docker de homeassistant, utilisant python 3.11, j'ai cette erreur dans les logs:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 471, in async_add_entities
    await asyncio.gather(*tasks)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 749, in _async_add_entity
    await entity.add_to_platform_finish()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 849, in add_to_platform_finish
    await self.async_added_to_hass()
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 421, in async_added_to_hass
    await super().async_added_to_hass()
  File "/config/custom_components/rte_ecowatt/__init__.py", line 220, in async_added_to_hass
    if (last_stored_state := await self._async_get_restored_data()) is not None:
                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: object StoredState can't be used in 'await' expression

Comment la corriger?

Merci d'avance, et merci pour votre intégration bien pratique !

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.