sberthelot / teleinfo-home-assistant

French TIC/Teleinfo integration for Home Assistant (needs a serial dongle/interface)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Fail to finish integration

fulup-bzh opened this issue · comments

Just reinstalled a fresh HA and tried this extension with no success:

Despite the modification on configuration (see here after remarks) the extension does not start

 WARNING (MainThread) [homeassistant.bootstrap] Waiting on integrations to complete setup: sensor.enedis
2022-10-15 19:40:22.388 WARNING (MainThread) [homeassistant.components.sensor] Timed out adding entities for domain sensor with platform enedis after 500s
2022-10-15 19:40:22.429 ERROR (MainThread) [homeassistant.helpers.event] Error while processing template: Template("{{ states.sensor.enedis_teleinfo.attributes["PRM"] }}")
Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.9/site-packages/homeassistant/helpers/template.py", line 420, in async_render
    render_result = _render_with_context(self.template, compiled, **kwargs)
  File "/srv/homeassistant/lib/python3.9/site-packages/homeassistant/helpers/template.py", line 1915, in _render_with_context
    return template.render(**kwargs)
  File "/srv/homeassistant/lib/python3.9/site-packages/jinja2/environment.py", line 1301, in render
    self.environment.handle_exception()
  File "/srv/homeassistant/lib/python3.9/site-packages/jinja2/environment.py", line 936, in handle_exception
    raise rewrite_traceback_stack(source=source)
  File "<template>", line 1, in top-level template code
  File "/srv/homeassistant/lib/python3.9/site-packages/jinja2/sandbox.py", line 303, in getitem

Note that documentation should be updated:

  • extension name is ENEDIS but config sample still point on TELEINFO
    • replace 1st line "plateform: teleinfo" with "plateform: enedis"
  • When using default Rasbery TTY port, console should be stop and homeassistant user should be able to access group tty

Few progress:

  • it is not enough to remove systemctl stop serial-getty@ttyAMA0.service
  • should also remove serial console from /boot/cmdline.txt otherwise agetty restart aumatically
  • without agetty in place /dev/ttyAMA0 below to 'dialout' group also homeassistant should have access to this group
  • usermod -a -G dialout homeassistant

I now see Enedis-Teleinfo, nevertheless I still get an error within the log

2022-10-21 12:26:00.250 ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.enedis_teleinfo fails
Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.9/site-packages/homeassistant/helpers/entity.py", line 515, in async_update_ha_state
    await self.async_device_update()
  File "/srv/homeassistant/lib/python3.9/site-packages/homeassistant/helpers/entity.py", line 710, in async_device_update
    raise exc
  File "/usr/lib/python3.9/concurrent/futures/thread.py", line 52, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/homeassistant/.homeassistant/custom_components/teleinfo/sensor.py", line 122, in update
    _LOGGER.debug(" Got : [%s] =  (%s)", name, value)
UnboundLocalError: local variable 'name' referenced before assignment
2022-10-21 12:27:00.191 ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.enedis_teleinfo fails
Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.9/site-packages/homeassistant/helpers/entity.py", line 515, in async_update_ha_state
    await self.async_device_update()
  File "/srv/homeassistant/lib/python3.9/site-packages/homeassistant/helpers/entity.py", line 710, in async_device_update
    raise exc