[APP][Pro] GivEnergy

v1.4.0 is now in TEST

  • Multiple charge/discharge schedule slots — support for configuring more than one time slot (#26)
  • Remove duplicate energy transition trigger cards (#25)
  • Force charge & force discharge action cards (#24)
  • Trigger flow cards for energy events (e.g. battery charging/discharging, importing/exporting)
  • Capability icons & rename cumulative titles to “Total”
  • Fix inverter settings sync & charge slot indexing
  • Daily energy metrics — solar, battery, grid import/export (#20)
  • Eco mode toggle — flow action and condition card (#21)
  • Grid voltage & frequency monitoring (#22)

1.4.0 is now live in the app store, I hope you enjoy the new Flow cards & on-demand charging.

I’m using the Grid voltage card to detect power cuts - I’ve yet to have one to check it works, but it’s a great way to get a notification when things are down. My Homey SHS also runs on a UPS.

Hi,

I’ve installed the app and that seems to run fine, so that’s cool (especially with everything going on with GivEnergy!). I’ve then tried using your givenergy-modbus project to see if I can replace the current web API connection I’m using for my app (for fun, and a bit more flexibility!)

Currently testing using a completely new Homey app, I’m finding that I can call:

const devices = await ModBus.discover(‘192.168.0.6/24’);

And that correctly returns my inverter details (host, serial number, generation etc) as an item in the devices array, but when I try to connect I’m just getting a timeout error “CreateClientTimeout” when calling:

const inverter = await ModBus.GivEnergyInverter.connect({ host: devices[0].host });

I also seem to get a timeout if I call discover without supplying the IP address:

const devices = await ModBus.discover();

Just wondering if you had any thoughts or suggestions on what I might be doing wrong?

edit - I have noticed that the readings in the app seem to only update quite infrequently (every 5-10 minutes) is that expected? Thought it would be more frequent over a local connection, so wondering if the inverter is actually only succesfully responding some of the time, which maybe would explain why I’m seeing the timeout in my app.

Thanks for trying it out! A couple of things could be going on here.

CreateClientTimeoutis Homey’s own timeout on a pairing/driver callback (typically ~30s).

GivEnergyInverter.connect() doesn’t just open a socket. It does a full initial poll
before resolving, that could easily runs past 30s on the first call. It’s designed to be called once at device onInitand then kept alive streaming data events. It’s not meant to run inside a Homey pairing handler.

What to do instead
For pairing, use the lightweight identity probe — it was added for exactly this case:

const identity = await ModBus.GivEnergyInverter.identify({ host: devices[0].host });
// { serialNumber, generation, modelCode }

That’s a single Modbus request and should return in a second or two. Store the host/serial, then in the device’s onInit, call GivEnergyInverter.connect({ host })

onInit has a much longer budget, and once it resolves you subscribe to ‘data’ events for live snapshots.

To see what connect()is actually doing while you debug, attach a listener before awaiting. Note you’d need access to the instance, so easier is to temporarily use the PollManager events via the returned inverter:

const inv = await ModBus.GivEnergyInverter.connect({ host }); inv.on('debug', msg => console.log('[modbus]', msg));

(Though the debug output for the initial poll happens before connect() resolves, so for early-phase diagnosis you may want to call identify() first to confirm the device is reachable at all from inside the Homey container.)

discover() without a subnet

getLocalSubnet() calls os.networkInterfaces() and picks the first non-loopback IPv4 CIDR. Inside a Homey app container that may not be your LAN subnet (it could be the app’s internal interface, or an unexpected CIDR).

Does identify()work from your app environment?

If that returns quickly with your serial, the library is talking to the inverter fine and it’s purely a “connect() does too much for a pairing callback” problem. If identify()also times out, then something about Homey’s networking is blocking port 8899 to that host and you’d need to investigate that separately.

On the update frequency, no, that is not expected. The default is a 15-second poll (with a fuller refresh every 60s). If you’re seeing multi-minute gaps, the inverter is almost certainly only responding some of the time, and I suspect the reason is because the inverter can only reliably handle one client at a time. If two clients connect simultaneously, responses get routed to the wrong client and both sides see timeouts and missing data. This is a known quirk of the hardware, documented in GivTCP and called out in the library’s README.

Thanks for trying it out. If you’ve got any other questions on the library, please use the github issues, and I’ll keep this thread for the GivEnergy Homey app :slight_smile:

Hi there. I’m just looking at options for monitoring and control given the current issues with GivEnergy. I have my Givenergy Battery connected to Octopus Intelligent Flux; is it possible to also connect Homey via this app without upsetting my current setup? Thanks in Advance

Hey, hopefully someone can comment and verify; but I’ll give you my best guess.

I would think (a) because Octopus will connect via the cloud API and (b) because this Homey app is local - you should be fine.

There are definitely issues when you have multiple local connections - the hardware and protocol simply doesn’t handle it well - however I’ve seen no issues in concurrent cloud and local connections.

Having said that, I don’t use Octopus Intelligent Flux and my usage of the Cloud API is limited - therefore my experience may not be representative of yours.