gieljnssns / kostalpiko-sensor-homeassistant

A custom component to get the readings of a Kostal Piko inverter
MIT License
12 stars 18 forks source link

IndexError #9

Closed thanasisloi7 closed 4 years ago

thanasisloi7 commented 4 years ago

Describe the bug I am trying to set this plugin but a get an error IndexError. I use PIKO 10.1 Namenlos (255) When i open the web page with myurl/index.fhtml, it wotking ok.

Any errors

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 178, in _async_setup_platform
    await asyncio.wait_for(asyncio.shield(task), SLOW_SETUP_MAX_WAIT)
  File "/usr/local/lib/python3.7/asyncio/tasks.py", line 442, in wait_for
    return fut.result()
  File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/kostal/sensor.py", line 65, in setup_platform
    dev.append(PikoInverter(data, sensor, config[CONF_NAME]))
  File "/config/custom_components/kostal/sensor.py", line 82, in __init__
    self.update()
  File "/config/custom_components/kostal/sensor.py", line 106, in update
    self.piko.update()
  File "/usr/src/homeassistant/homeassistant/util/__init__.py", line 240, in wrapper
    result = method(*args, **kwargs)
  File "/config/custom_components/kostal/sensor.py", line 237, in update
    self.data = self.piko._get_raw_content()
  File "/usr/local/lib/python3.7/site-packages/kostalpyko/kostalpyko.py", line 198, in _get_raw_content
    status = response.xpath("/html/body/form/font/table[2]/tr[8]/td[3]")[0].text.strip()
IndexError: list index out of range

Config yaml

sensor:
  - platform: kostal
    host: !secret kostal_host
    username: !secret kostal_username
    password: !secret kostal_password
    monitored_conditions:
      - solar_generator_power  # only available when using a BA sensor
      - consumption_phase_1    # only available when using a BA sensor
      - consumption_phase_2    # only available when using a BA sensor
      - consumption_phase_3    # only available when using a BA sensor
      - current_power
      - total_energy
      - daily_energy
      - string1_voltage
      - string1_current
      - string2_voltage
      - string2_current
      - l1_voltage
      - l1_power
      - l2_voltage
      - l2_power
      - l3_voltage
      - l3_power
      - status

secret:
  kostal_host: http://192.168.5.168/index.fhtml
  kostal_username: pvserver
  kostal_password: pvwr

Screenshots If applicable, add screenshots to help explain your problem.

Additional context Add any other context about the problem here.

thanasisloi7 commented 4 years ago

Please ignore the message, i use wrong host, it must be like this in secret.yaml ''' kostal_host: 'http://192.168.5.168' kostal_username: pvserver kostal_password: pvwr '''