rcasula / kostalpiko-homeassistant

19 stars 14 forks source link

Can't connect to my Piko 17 #25

Open P1Rebo opened 1 year ago

P1Rebo commented 1 year ago

Hi @rcasula,

thanks for maintaining this piece of code!! I added your HACS folder to my custom_components and tried to add your integration via the front-end. I entered the IP address http://192.168.52.152

Log says the following. Can you help here? Thanks a lot!

Logger: aiohttp.server
Source: custom_components/kostal/config_flow.py:64
Integration: Kostal Piko ([documentation](https://github.com/rcasula/kostalpiko-homeassistant))
First occurred: 20:22:15 (3 occurrences)
Last logged: 20:23:50

Error handling request
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/aiohttp/web_protocol.py", line 435, in _handle_request
    resp = await request_handler(request)
  File "/usr/local/lib/python3.10/site-packages/aiohttp/web_app.py", line 504, in _handle
    resp = await handler(request)
  File "/usr/local/lib/python3.10/site-packages/aiohttp/web_middlewares.py", line 117, in impl
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 60, in security_filter_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 100, in forwarded_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 28, in request_context_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 80, in ban_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 236, in auth_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 145, in handle
    result = await result
  File "/usr/src/homeassistant/homeassistant/components/config/config_entries.py", line 180, in post
    return await super().post(request, flow_id)
  File "/usr/src/homeassistant/homeassistant/components/http/data_validator.py", line 72, in wrapper
    result = await method(view, request, data, *args, **kwargs)
  File "/usr/src/homeassistant/homeassistant/helpers/data_entry_flow.py", line 110, in post
    result = await self._flow_mgr.async_configure(flow_id, data)
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 253, in async_configure
    result = await self._async_handle_step(
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 335, in _async_handle_step
    result: FlowResult = await getattr(flow, method)(user_input)
  File "/config/custom_components/kostal/config_flow.py", line 85, in async_step_user
    can_connect = await self.hass.async_add_executor_job(
  File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/kostal/config_flow.py", line 64, in _check_host
    response = piko._get_info()
  File "/usr/local/lib/python3.10/site-packages/kostalpiko/kostalpiko.py", line 115, in _get_info
    serial = response.xpath("/html/body/form/font/table/tr[2]/td[3]")[
IndexError: list index out of range
rcasula commented 1 year ago

Hi, which PIKO inverter do you have?

P1Rebo commented 1 year ago

Hi, I have the Piko 17 inverter.

rcasula commented 1 year ago

Would you be able to provide me the html page of your PIKO?

P1Rebo commented 1 year ago

Sure!

<html>
<body>
<!--StartFragment-->

<!DOCTYPE html>
--
  | <html ng-app="kbApp" ng-controller="kbAppCtrl">
  | <head>
  | <link rel="icon" href="/assets/favicon.ico">
  | <title ng-bind="inverterTypeName + ' <> ' + inverterName"></title>
  | <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
  | <meta http-equiv="X-UA-Compatible" content="IE=Edge"/>
  | <!--Deaktivate Chaching to avoid problems-->
  | <meta http-equiv="cache-control: private, max-age=0, no-cache" content="no-store" />
  | <meta http-equiv="expires" content="0" />
  | <meta http-equiv="pragma" content="no-cache" />
  |  
  | <!-- compiled CSS -->
  | <link rel="stylesheet" type="text/css" href="assets/kbApp-1.1.6.css"/>
  |  
  | </head>
  | <body>
  | <!-- Loading -->
  | <div kb-Hide-After-Init class = "loader" style="z-index: 3000">
  | <div class="loader-inner-big">
  | <i class="icon-spinner animate-spin"></i>
  | <div id="errorMsg"></div>
  | </div>
  | </div>
  | <!-- Page -->
  | <div class="kbContainer">
  | <div class="kbBanner">
  | <div class="kbLogoPrim"></div>
  | <div class="kbLogoSec"></div>
  | <div class="kbLanguageSelectBar" ng-controller="languageSelCtrl">
  | <div ng-repeat="language in languages">
  | <div kb-language-select-item></div>
  | </div>
  | </div>
  | </div>
  | <div class="kbPage">
  | <div class="kbDivider"></div>
  | <div class="kbNav" ng-controller="navigationCtrl">
  | <kb-navigation nodes="menu"></kb-navigation>
  | <div class="kbLogoSlogan"></div>
  | </div>
  | <div class="kbContent">
  | <div class="kbContentHeading">
  | <div class="kbInfo">
  | <div class="kbInverter">
  | <span class="inverterType"> {{inverterTypeName}}</span>
  | <span class="inverterName"> ({{inverterName}})</span>
  | </div>
  | <div class="kbUserAndDate">
  | <div><i class="icon-calendar"><span>{{appDate \| date:'short'}}</span></i></div>
  | <div><i class="icon-user"><span>{{appUserTranslationId \| translate}}</span></i></div>
  | </div>
  | </div>
  | <div class="kbNavTitle" ng-controller="navigationCtrl">
  | <kb-navigation-breadcrumb breadcrumbs="breadcrumbs"></kb-navigation-breadcrumb>
  | </div>
  | </div>
  | <div class="kbContentView">
  | <div ng-show="appPageInfo.loadingInProgress" ng-cloak class = "loader" style="z-index: 2000">
  | <div class="loader-inner">
  | <i class="icon-spinner animate-spin"></i>
  | </div>
  | </div>
  | <div ng-show="appPageInfo.loadingFailed" ng-cloak class = "loader" style="z-index: 2000">
  | <div class="loader-inner">
  | <i class="icon-error"></i>
  | </div>
  | </div>
  | <div ng-show="appPageInfo.submitInProgress" ng-cloak class = "loader-transparent" style="z-index: 2000">
  | <div class="loader-inner">
  | <i class="icon-spinner animate-spin"></i>
  | </div>
  | </div>
  | <div class="kbView" ng-view></div>
  | <div class="kbViewInfo" ng-show="appPageInfo.submitSuccessful \|\| appPageInfo.submitFailed">
  | <div ng-show="appPageInfo.submitSuccessful">
  | <i class="icon-ok info-ok">{{appPageInfo.displayMsgId \| translate}}</i>
  | </div>
  | <div ng-show="appPageInfo.submitFailed">
  | <i class="icon-error info-error">{{appPageInfo.displayMsgId \| translate}}</i>
  | </div>
  | </div>
  | </div>
  | </div>
  | </div>
  | <div class="kbFooter">
  | <div class="kbWebversion">v1.1.6</div>
  | </div>
  | </div>
  |  
  | <!-- compiled JavaScript -->
  | <script type="text/javascript" src="assets/kbApp-1.1.6.js"></script>
  |  
  | </body>
  | </html>

<!--EndFragment-->
</body>
</html><!DOCTYPE html>
<html ng-app="kbApp" ng-controller="kbAppCtrl">
<head>
   <link rel="icon" href="[/assets/favicon.ico](http://192.168.52.152/assets/favicon.ico)">
   <title ng-bind="inverterTypeName + ' <> ' + inverterName"></title>
   <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
   <meta http-equiv="X-UA-Compatible" content="IE=Edge"/>
   <!--Deaktivate Chaching to avoid problems-->
   <meta http-equiv="cache-control: private, max-age=0, no-cache" content="no-store" />
   <meta http-equiv="expires" content="0" />
   <meta http-equiv="pragma" content="no-cache" />

   <!-- compiled CSS -->
   <link rel="stylesheet" type="text/css" href="[assets/kbApp-1.1.6.css](http://192.168.52.152/assets/kbApp-1.1.6.css)"/>

</head>
<body>
<!-- Loading -->
<div kb-Hide-After-Init class = "loader" style="z-index: 3000">
   <div class="loader-inner-big">
      <i class="icon-spinner animate-spin"></i>
      <div id="errorMsg"></div>
   </div>
</div>
<!-- Page -->
<div class="kbContainer">
   <div class="kbBanner">
      <div class="kbLogoPrim"></div>
      <div class="kbLogoSec"></div>
      <div class="kbLanguageSelectBar" ng-controller="languageSelCtrl">
         <div ng-repeat="language in languages">
            <div kb-language-select-item></div>
         </div>
      </div>
   </div>
   <div class="kbPage">
      <div class="kbDivider"></div>
      <div class="kbNav" ng-controller="navigationCtrl">
         <kb-navigation nodes="menu"></kb-navigation>
         <div class="kbLogoSlogan"></div>
      </div>
      <div class="kbContent">
         <div class="kbContentHeading">
            <div class="kbInfo">
               <div class="kbInverter">
                  <span class="inverterType"> {{inverterTypeName}}</span>
                  <span class="inverterName"> ({{inverterName}})</span>
               </div>
               <div class="kbUserAndDate">
                  <div><i class="icon-calendar"><span>{{appDate | date:'short'}}</span></i></div>
                  <div><i class="icon-user"><span>{{appUserTranslationId | translate}}</span></i></div>
               </div>
            </div>
            <div class="kbNavTitle" ng-controller="navigationCtrl">
               <kb-navigation-breadcrumb breadcrumbs="breadcrumbs"></kb-navigation-breadcrumb>
            </div>
         </div>
         <div class="kbContentView">
            <div ng-show="appPageInfo.loadingInProgress" ng-cloak class = "loader" style="z-index: 2000">
               <div class="loader-inner">
                  <i class="icon-spinner animate-spin"></i>
               </div>
            </div>
            <div ng-show="appPageInfo.loadingFailed" ng-cloak class = "loader" style="z-index: 2000">
               <div class="loader-inner">
                  <i class="icon-error"></i>
               </div>
            </div>
            <div ng-show="appPageInfo.submitInProgress" ng-cloak class = "loader-transparent" style="z-index: 2000">
               <div class="loader-inner">
                  <i class="icon-spinner animate-spin"></i>
               </div>
            </div>
            <div class="kbView" ng-view></div>
            <div class="kbViewInfo" ng-show="appPageInfo.submitSuccessful || appPageInfo.submitFailed">
               <div ng-show="appPageInfo.submitSuccessful">
                  <i class="icon-ok info-ok">{{appPageInfo.displayMsgId | translate}}</i>
               </div>
               <div ng-show="appPageInfo.submitFailed">
                  <i class="icon-error info-error">{{appPageInfo.displayMsgId | translate}}</i>
               </div>
            </div>
         </div>
      </div>
   </div>
   <div class="kbFooter">
      <div class="kbWebversion">v1.1.6</div>
   </div>
</div>

<!-- compiled JavaScript -->
<script type="text/javascript" src="[assets/kbApp-1.1.6.js](http://192.168.52.152/assets/kbApp-1.1.6.js)"></script>

</body>
</html>