Solar system from APsystems

Hello everybody,

I want to see my solarsystem in Homey. My solarsystem is APsystems.
Is there a app for in Homey?
I can not find anything.

Greetings Rick

5 Likes

there is not an app for at the moment, a friend of mine has the same solarsystem from APsystems. maybe you can ask an developer to make or add it to the there app? or maybe ask APsystems itself to make an app for homey

I have not done any app development but I did manage to parse the values from the internal webserver on the inverter controller and add this to a virtual device.

You will need the following:

  • HomeyScript
  • Device Capabilities (app)
  1. create a new “device capabilities” Device and give it a name.

  2. repair the device and in this screen add a numeric value:

  3. create a new homey script and past the contents below, be sure to update your IP of the APS controller:

const url = ‘http://x.x.x.x/index.php/realtimedata’; // Replace with your target URL

let totalPower = 0
fetch(url)
.then(response => response.text())
.then(html => {
// Basic HTML parsing
const tableStart = html.indexOf(‘

’);
const tableEnd = html.indexOf(‘
’, tableStart);
const tableHtml = html.substring(tableStart, tableEnd);

// Extracting data from the table
const rows = tableHtml.split('</tr>');
let tableData = rows.map(row => {
  let rowData = [];
  const cells = row.split('</td>');
  cells.forEach(cell => {
    const start = cell.lastIndexOf('>') + 1;
    rowData.push(cell.substring(start).trim());
  });
  return rowData.filter(cell => cell); // Filter out empty cells
});

// Calculate total power
let totalPower = 0;
tableData.forEach(row => {
  if (row[1] && row[1] !== '-') {
    totalPower += parseFloat(row[1]);
  }
});

global.set('SolarPowerInt', totalPower);
//console.log('Table Data:', tableData);
console.log('Total Power:', totalPower, 'Watts');

})
.catch(error => {
console.error(‘Error fetching the URL:’, error);
});

//get global variable and update tag for use in Flow
const totalPowerTag = global.get(‘SolarPowerInt’);
await tag(‘Solar Power int’, totalPowerTag);

  1. Run the script to test and to create the tag used in the flow

  2. create a flow to run the script and update the value of the virtual device:

  3. now the value should be updated in the virtual device:
    image

Hope this helps
Marco

2 Likes

Hi @MarcoL ,

great approach :slight_smile:

I tried to implement the Script, but when I test it i get this:

any idea? many thx
Scripting is new for me…

EDIT: I’m using ECU-R with 6 inverters, the realtimedata web page is working fine

Daniel

push Anyone else who made this running?

Hi Marco, did you get this working with an APsystems ECU-R unit, or do you have another ECU unit?.

Hi Daniel, Have you been able to get it to work in the meantime?

Hi Theo, no I gave up :slightly_frowning_face:

Hi Guys,
sorry to have been so off the radar. Between family and business there is just so little time for tinkering.
The script does work but I have my doubts that the text comes through as expected:

I have added the code in a txt file, hope that works better :
aps.zip

I have the ECU-R, not sure what firmware as it still states copyright 2015 in the botom of the webpage. However, if the page looks like this, i guess it should work:

If it looks different, send me an export of the html and ill see what i can do to parse it.

Marco

Sorry for my bad english i’m french , i’am very interesting for this application

Hi @ARTNOW44
Did you get it to work?

I’m getting the following response:

Error fetching the URL: FetchError: request to http://{{URL}/index.php/realtimedata failed, reason: connect ECONNREFUSED {{URL}}
    at ClientRequest.<anonymous> (/app/node_modules/node-fetch/lib/index.js:1491:11)
    at ClientRequest.emit (node:events:517:28)
    at Socket.socketErrorListener (node:_http_client:501:9)
    at Socket.emit (node:events:517:28)
    at emitErrorNT (node:internal/streams/destroy:151:8)
    at emitErrorCloseNT (node:internal/streams/destroy:116:3)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
  type: 'system',
  errno: 'ECONNREFUSED',
  code: 'ECONNREFUSED'
}

Any thoughts?

{{URL}} contains the URL of the ECU, but blurred it here :wink:

Same problem for me, and would really like to solve this :crossed_fingers:

hello , yes , thanks

Hi @MarcoL

finally I got this up and running, many thx for your work.

Daniel

what then card do I need to use?

Unfortunately not working on my side

were you able to get this working? struggling at I think the same point.

if by the way I enter this website (with my local IP address of the ECU, I should get a webpage with the table indicated above here?

Not getting any response in my case…

No did not manage to get this working. But truth be told is that I did not spend much time on it.

With the long weekend ahead, I might pick this up again :slight_smile: will keep you posted if there is progress to share :wink:

1 Like

For me though the import metric is the total produced power at eny given time, not the power per unit. Could not find that on the personal webpage on apsystemsema.com either (only the total produced be day). Still have not been able to log into the local webpage and get any of the needed numbers…