skelgaard / homeassistant-apsystems

An APsystems Sensor for Home Assistant
Apache License 2.0
25 stars 9 forks source link

hacs_badge apsystems Maintenance

APsystems Sensor for Home Assistant

This component simplifies the integration of a APsystems inverter:

URL's Utilised

The URL called is https://apsystemsema.com/ema/ajax/getReportApiAjax/getPowerOnCurrentDayAjax It is only called from sunset to sunrise and the sensor going offline at night

Installation

Use HACS to point to this github URL: https://github.com/skelgaard/homeassistant-apsystems

Configuration

Use your apsystemsema.com to configure the configuration.yaml.

# Minimal configuration.yaml entry:
sensor:
  - platform: apsystems
    authId: apsystemsem_authid
    systemId: apsystemsema_system_id
    ecuId: apsystemsema_ecu_id
    sunset: off

1 - set "Allow visitors to access to this system" and get the authid from here

2 - your systemId is found at apsystemsema.com. See the page source code and at the Settings Menu there is a code like that:

<span>Settings</span>
<ul>
    <li onclick="managementClickCustomer('YOUR SYSTEM ID')"><a>Settings</a></li>
    <li onclick="intoFaq(10)"><a>Help</a></li>
</ul>

Get the system id inside the managementClickCustomer().

3 - There is an ecu id data at https://apsystemsema.com/ema/security/optmainmenu/intoLargeReport.action

4 - sunset attribute could be on or off

Debug

To get debug info in the logs do

logger:
  default: info
  logs:
    custom_components.apsystems: debug

and then grep the log for output

grep apsystem home-assistant.log

http request test

here is the two commands to run, todo a request test if it works

Login

GET https://www.apsystemsema.com/ema/intoDemoUser.action?id=apsystemsem_authid

Get Data

POST https://www.apsystemsema.com/ema/ajax/getReportApiAjax/getPowerOnCurrentDayAjax

queryDate=20230615&selectedValue=apsystemsema_ecu_id&systemId=apsystemsema_system_id

Thanx

Thanx to the author bgbraga(https://github.com/bgbraga/) for his work, but as he has left this is in a none working stage, i have fixed the problems

Buy me a beer!