cyberjunky / home-assistant-custom-components

My custom components for Home Assistant
MIT License
71 stars 19 forks source link

SolarPortal no longer working #25

Closed GoSpursGoNL closed 4 years ago

GoSpursGoNL commented 5 years ago

I'm using HA 0.91, changed the location of the files as instructed (custom_components/solarportal) and downloaded the latest files. Configuration is unchanged. But SolarPortal no longer works.

home_assistant.log shows the following errors:

2019-04-05 07:49:10 ERROR (MainThread) [homeassistant.components.sensor] Error while setting up platform solarportal
Traceback (most recent call last):
  File "/home/pi/.homeassistant/custom_components/solarportal/sensor.py", line 68, in setup_platform
    data = SolarPortalData(host, port, username, password)
  File "/home/pi/.homeassistant/custom_components/solarportal/sensor.py", line 111, in __init__
    root = ET.parse(urlopen(requesturl)).getroot()
  File "/usr/lib/python3.5/urllib/request.py", line 163, in urlopen
    return opener.open(url, data, timeout)
  File "/usr/lib/python3.5/urllib/request.py", line 472, in open
    response = meth(req, response)
  File "/usr/lib/python3.5/urllib/request.py", line 582, in http_response
    'http', request, response, code, msg, hdrs)
  File "/usr/lib/python3.5/urllib/request.py", line 510, in error
    return self._call_chain(*args)
  File "/usr/lib/python3.5/urllib/request.py", line 444, in _call_chain
    result = func(*args)
  File "/usr/lib/python3.5/urllib/request.py", line 590, in http_error_default
    raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 404: Not Found

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/helpers/entity_platform.py", line 126, in _async_setup_platform
    SLOW_SETUP_MAX_WAIT, loop=hass.loop)
  File "/usr/lib/python3.5/asyncio/tasks.py", line 400, in wait_for
    return fut.result()
  File "/usr/lib/python3.5/asyncio/futures.py", line 293, in result
    raise self._exception
  File "/usr/lib/python3.5/concurrent/futures/thread.py", line 55, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/pi/.homeassistant/custom_components/solarportal/sensor.py", line 69, in setup_platform
    except RunTimeError:
NameError: name 'RunTimeError' is not defined
cyberjunky commented 5 years ago

Can you post your config? (without username and password) I presume the API/web site urls have changed, they enabled https a while back, but couldn't get it to work by simply changing the url.

GoSpursGoNL commented 5 years ago

Yes, here it is. I did not change it since the last time the component worked.

sensor:
  - platform: solarportal
    host: www.omnikportal.com
    port: 10000
    username: MYUSERNAME
    password: MYPASSWORD
    scan_interval: 1800
    resources:
      - actualpower
      - energytoday
cyberjunky commented 5 years ago

There is a post on the website that there is a new app now, so I guessed the old API was removed:

Dear Customers,

Omnik old version APP has removed,and no running anymore. Please download new APP version (Omnik Portal) from the App Store.

If you use Android system, please go to Google play download: "Omnik Portal" https://play.google.com/store/apps/details?id=com.jialeinfo.omniksolar&hl=en

If you use iOS system, please go to iOS App store download: "Omnik Portal" https://itunes.apple.com/cn/app/id1246117091 Thank you so much for your notice. Omnik Team

I took a peek inside the new Android app, and the below urls can be found. They use a token based authentication now it seems. Did some searching, but I found no python or other code supporting this yet.


sources/com/jialeinfo/util/Configs.java:    public static final String AccessTokenUrl = "https://api.omnikportal.com/v1/user/account_validate";
sources/com/jialeinfo/util/Configs.java:    public static final String AddDataLogger = "https://api.omnikportal.com/v1/device/datalogger/add";
sources/com/jialeinfo/util/Configs.java:    public static final String AddPlantUrl = "https://api.omnikportal.com/v1/plant/add";
sources/com/jialeinfo/util/Configs.java:    public static final String AreasUrl = "https://api.omnikportal.com/v1/plant/areas";
sources/com/jialeinfo/util/Configs.java:    public static final String C_User_ListUrl = "https://api.omnikportal.com/v1/user/c_user_list";
sources/com/jialeinfo/util/Configs.java:    public static final String DOWNLOAD = "https://play.google.com/store/apps/details?id=com.jialeinfo.omniksolar";
sources/com/jialeinfo/util/Configs.java:    public static final String DataLoggerDeleteUrl = "https://api.omnikportal.com/v1/device/datalogger/delete";
sources/com/jialeinfo/util/Configs.java:    public static final String DataLoggerListUrl = "https://api.omnikportal.com/v1/device/datalogger/list";
sources/com/jialeinfo/util/Configs.java:    public static final String DataLoggerModifyUrl = "https://api.omnikportal.com/v1/device/datalogger/modify";
sources/com/jialeinfo/util/Configs.java:    public static final String DataLoggerSimUrl = "https://api.omnikportal.com/v1/device/datalogger/sim";
sources/com/jialeinfo/util/Configs.java:    public static final String DeletePlantUrl = "https://api.omnikportal.com/v1/plant/delete";
sources/com/jialeinfo/util/Configs.java:    public static final String DeviceListUrl = "https://api.omnikportal.com/v1/device/list";
sources/com/jialeinfo/util/Configs.java:    public static final String DtailsUrl = "https://api.omnikportal.com/v1/plant/details";
sources/com/jialeinfo/util/Configs.java:    public static final String HistoryEnergyUrl = "https://api.omnikportal.com/v1/plant/energy";
sources/com/jialeinfo/util/Configs.java:    public static final String InverterAlarmModifyUrl = "https://api.omnikportal.com/v1/device/inverter/alarm_modify";
sources/com/jialeinfo/util/Configs.java:    public static final String InverterAlarmUrl = "https://api.omnikportal.com/v1/device/inverter/alarm";
sources/com/jialeinfo/util/Configs.java:    public static final String InverterDataUrl = "https://api.omnikportal.com/v1/device/inverter/data";
sources/com/jialeinfo/util/Configs.java:    public static final String ListUrl = "https://api.omnikportal.com/v1/plant/list";
sources/com/jialeinfo/util/Configs.java:    public static final String ModifyPlantUrl = "https://api.omnikportal.com/v1/plant/modify";
sources/com/jialeinfo/util/Configs.java:    public static final String ModifyUrl = "https://api.omnikportal.com/v1/user/c_user_list";
sources/com/jialeinfo/util/Configs.java:    public static final String PlantDataUrl = "https://api.omnikportal.com/v1/plant/data";
sources/com/jialeinfo/util/Configs.java:    public static final String RegisterUrl = "https://api.omnikportal.com/v1/user/b_user_register";
sources/com/jialeinfo/util/Configs.java:    public static final String StatisticUrl = "https://api.omnikportal.com/v1/plant/statistic";
sources/com/jialeinfo/util/Configs.java:    public static final String TodayPowerUrl = "https://api.omnikportal.com/v1/plant/power";
sources/com/jialeinfo/util/Configs.java:    public static final String UsageUrl = "https://api.omnikportal.com/v1/user/account_validate";
sources/com/jialeinfo/util/Configs.java:    public static final String VersionUrl = "https://api.omnikportal.com/v1/version/current";
sources/com/jialeinfo/util/Configs.java:    public static final String eUrl = "https://api.omnikportal.com/v1";
sources/com/jialeinfo/util/Configs.java:    public static final String userLogin = "https://api.omnikportal.com/v1/user/account_validate";
cyberjunky commented 4 years ago

Looks like some code can be found here https://github.com/DiedB/Homey-SolarPanels

cyberjunky commented 4 years ago

Stale issue, closing for now.