EG4 Community Forum

EG4 Web API and Hom...
 
Notifications
Clear all

EG4 Web API and Home Assistant

11 Posts
6 Users
4 Reactions
700 Views
(@twistedroutes)
Eminent Member
Joined: 6 months ago
Posts: 20
Topic starter  

There are a few projects out there that connect directly with your inverter to get some data.  Someone over on DIYSolarForums asked if there was an API for the web.  There's only a B2B API at the moment, so I decided to write a Python wrapper for people to be able to query their inverter and battery data vis the web (Monitor.eg4...).

 

Then I decided to use that to try to create my first Home Assistant integration/Custom Component.  Note that I only have access to a single 12000XP so YMMV!

 

....

ok so the first attempt at custom integration has started...Feel free to try it out

https://github.com/twistedroutes/eg4_inverter_ha
using the api from
https://github.com/twistedroutes/eg4_inverter_api

Done:

  • Inverter Runtume
  • Inverter Energy
  • Inverter Battery Data
  • Inverter Battery Unit Data
  • Inverter Read Func, Hold and Bit Parameters
  • Inverter Write Hold Parameters

ToDo:

  • Inverter Write Func and Bit Parameters
  • Obtain Value Limits for write functions
  • Build some example dashboards
  • Add Home Assistant ability to change values
  • I've got to write up some tests
  • validate the data scaling (e.g. where EG4 provide 5100 to represent 51.00 V),
  • create a few more virtual sensors (a sensor made from other sensors data, like capacity in KWh = voltage and capacity in amp-hours).
  • Then add some switches and inputs to change data
  • Then add an example dashboard (though this data can already be used in the Energy dashboard)
  • This can be loaded into your .homeassistant/custom_components (or wherever your custom_components folder is).
  • I dunno... whatever I figure I need at the time.
image
image

 


   
Tac0Meat and galvan reacted
Quote
(@galvan)
New Member
Joined: 4 months ago
Posts: 2
 

Really appreciate this! Happy to help package for HACS or just buy beer. 


   
ReplyQuote
(@twistedroutes)
Eminent Member
Joined: 6 months ago
Posts: 20
Topic starter  

@galvan TY.  I think much more testing and a bit more development is require before HACS.  Hoping some people try it out so I can make it useful for people other than myself 🙂


   
ReplyQuote
(@tac0meat)
New Member
Joined: 4 weeks ago
Posts: 1
 

I'll be checking this out!  I have a Flexboss21 so not sure how much will work 1:1, but will find out.


   
ReplyQuote
(@pesavent)
New Member
Joined: 3 weeks ago
Posts: 1
 

I can confirm this works with Flexboss18! Thanks SO much for this work!!!


   
ReplyQuote
(@lemming)
New Member
Joined: 2 weeks ago
Posts: 3
 

I just wanted to say thanks for this and I can confirm it works with my GridBoss and FlexBoss 21!

 


   
ReplyQuote
(@dougl)
Trusted Member
Joined: 6 months ago
Posts: 57
 

Nice work!  You might take a look at Python Protocol Gateway( https://github.com/HotNoob/PythonProtocolGateway ) to see if there's anything missing in your implementation. I'm using PPG with my EG4 18kPV inverter sending MQTT messages to Home Assistant. I have PPG running on an old Raspberry Pi connected to the EG4 via USB-RS485 cable.  

 

Interestingly, on my 18kPV TRadiator1 runs hotter than TRadiator2.

This post was modified 2 weeks ago by DougL

   
ReplyQuote
(@lemming)
New Member
Joined: 2 weeks ago
Posts: 3
 

I was playing with the "Lux power-distribution card Card" and it has a field for "Last updated" and was curious if that information could be scraped with your wrapper?  Here's what I got with that card, it kinda makes it look like the one that EG4 outputs.

image

   
DougL reacted
ReplyQuote
(@dougl)
Trusted Member
Joined: 6 months ago
Posts: 57
 

@lemming I've been using Python protocol Gateway(PPG) to talk to my EG4 18kPV and since it exports MQTT I'm pulling in the data to Home Assistant from MQTT.

I like the familiar animation/dashboard so might have to pull that in and setup all the data points. I also have YAMBMS running between my batteries and EG4 so i have lots of battery info too.

Thanks for pointing out the Lux Power Distribution Card.


   
ReplyQuote
(@dougl)
Trusted Member
Joined: 6 months ago
Posts: 57
 

@lemming regarding getting the Update Time data from Python Protocol Gateway, I didn't find it in the spec( EG4-18KPV-12LV-Modbus-Protocol ) for things from the inverter and don't see it in the MQTT message just to see if it's outside of the message list stated in variable_mask file.  But sounds like a message which might be of interest to others so I'll ask the PPG developer.


   
ReplyQuote
(@lemming)
New Member
Joined: 2 weeks ago
Posts: 3
 

@dougl For you it would be something you'd probably just have to code as it's not one of the data points for what you're using.  You can also just remove that entry.  I just thought it may be nice to see when the monitor.eg4electronics.com site updates the data.

You'd just remove these fields if you want to remove it:

update_time:
entities:
- sensor.
show_last_update: true

 

And it'll remove it from the card.


   
DougL reacted
ReplyQuote
Share: