Help\how to create an app

Hi everyone,

I have a question I hope someone can help me with or at least point me to the right direction. We have PV installed and they are connected to two inverters, StecaGrid 2500 and 2000. I can check the yield via 3rd party apps but it is not live data. However, I have been able to connect to the inverters through LAN where the production\yield is live. It is a very simple “web page” that shows me the same as in the display on the inverters (see images). Would it be possible to create an app where the live data can be populated via the ip address?


Did you try all the Solar Apps that exist?
Then maybe Webhooks is something you can use?
Or else Homey Developer

Hi @JPe4619 Thanks for your reply.
It should be possible to use this app Solar Panels App for Homey | Homey. But I do not have any of the listed inverters. The only thing I could maybe use is the PVoutput, but not sure how to upload data there and how to use it :slightly_frowning_face:

Hi, did you succeed in your intent?

I also have a stecagrid inverter (coolcept 4200) labelled als solar frontier. I have tried to read out this information using homeyscript. That looked very good and must be possible. The information can be stored in a virtual device to be used in homey app’s and flows. I didn’t complete this, because I also use pv-output and a Youless on a specific kWh counter for the solar panels.

Well I found the homeyscript I was working on. It looks like it is working properly, getting current power and energy by local API-call to the inverter. It save’s these values in 2 tag’s that can be used in other flow’s/scripts.
This way you can make a flow that triggers at your liking (f.i. once every minute), call’s the script in the and part of the flow, and in the then part puts the values of the tag’s in a virtual device for your inverter.
If anyone is interested, I will share the homeyscript.

I am interested as I got a Solar Frontier that seems to listen/expose itself as a Steca. Just got news from Solar Frontier platform they will quit end of march their service. I got bash shell scripts but I recon a Homeyscript would work better.

Hello @Jeroen_Tebbens
Here you go (replace ip-address with your inverter)

// Script die voor zonnepanelen het huidige vermogen en opgewekte energie (huidige dag) ophaalt uit de SF-WR-4200 omvormer

// ophalen huidige vermogen
let url = "http://<replace inverter ip>/gen.measurements.table.js";
const response_p = await fetch(url, {
  "headers": {
  },
  "method": "GET",
})
const content_p = await response_p.text();
const start_p = content_p.indexOf('P AC') + 27;
const tmpFromStart_p = content_p.substring(start_p);
const end_p = tmpFromStart_p.indexOf('<');
const tmpDone_p = tmpFromStart_p.substring(0, end_p);
const dataInt_p = parseInt(tmpDone_p, 10);
const power = Number.isNaN(dataInt_p) ? 0 : dataInt_p;
console.log("Power: "+power);

// ophalen opgewekte vermogen
url = "http://<replace inverter ip>/gen.yield.day.chart.js";
const response_e = await fetch(url, {
  "headers": {
        'content-type': 'text/plain'
  },
  "method": "GET",
});
const content_e = await response_e.text();
const start_e = content_e.indexOf('labelValueId') + 29;
const tmpFromStart_e = content_e.substring(start_e);
const end_e = tmpFromStart_e.indexOf('Wh') - 1;
const tmpDone_e = tmpFromStart_e.substring(0, end_e);
//const dataInt_e = Math.round(parseFloat(tmpDone_e) * 1000);
const dataInt_e = parseFloat(tmpDone_e);
const energy = Number.isNaN(dataInt_e) ? 0 : dataInt_e;
console.log("Energy: " + energy);

//await setTagValue("SF-WR-4200_Vermogen", {type: "number", title: "SF-WR-4200 Vermogen"}, power ); 
//await setTagValue("SF-WR-4200_Energie", {type: "number", title: "SF-WR-4200 Energie"}, energy );


return power;

if script is working for you, uncomment the last 2 lines to create script tag’s to be used in homey flow’s etc. Or change this to anything else of your liking to fill other variables, or (virtual device) capabilities etc.
Have fun!

1 Like

Almost!

Power: 0

Energy: 2.17

Warning: setTagValue(id, opts, value) is deprecated, please use tag(id, value)

Warning: setTagValue(id, opts, value) is deprecated, please use tag(id, value)

——————————————————— :white_check_mark: Script Success

:leftwards_arrow_with_hook: Returned: undefined

Ok, almost great ;-), I assume you can solve this yourself (see example-tag.js)
I think most elegant solution is to create a virtual sola panel device and open that one in this script en set corresponding capabilities.

Fixed the tag. Yeah already have virtual solar device that I sync with webhook. Thx!

1 Like

Hi All, I’m planning doing an app submission for this.

Do you guys have any updated information on the api? I’ve just reached out to the manufactorer through a contact form, regarding api. I’m not expecting any good api description.

I have my StecaGrid connected with LAN.
The endpoints: gen.measurements.table.js and gen.yield.day.chart.js are not working for my hardware.

This is working for me: http://< inverter-ip >/yields.json?_=1700471877531

I will post my findings here.
Also I’m new to Homey

Hi all, I’ve done the app now.
Now available in app store:

Feedback appreciated.