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
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
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:
create a new âdevice capabilitiesâ Device and give it a name.
repair the device and in this screen add a numeric value:
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);
Run the script to test and to create the tag used in the flow
create a flow to run the script and update the value of the virtual device:
now the value should be updated in the virtual device:
Hope this helps
Marco
Hi @MarcoL ,
great approach
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
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
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
Same problem for me, and would really like to solve this