muppet3000 / homeassistant-grott

Home Assistant Integration for Grott - MQTT
MIT License
65 stars 14 forks source link

Read / Write mode. #61

Open KpjComp opened 8 months ago

KpjComp commented 8 months ago

On your homepage you have -> The future plan will be to grow this project so that it allows configuration of inverters via Grott also.

I'm currently on Intelligent Octopus, and this means that peak / off-peak rates can change dramatically. Been able to alter the TOU Charging slots using HA would be very handy, currently I keep having to use the Mobile APP, and this is a pain especially as you have to type the silly Date based password in to change it, why that is baffles me, it's not like it's a setting that can damage it, like altering voltage settings etc.

Personally I would like to take Shine Server out of the equation totally, Growatt's attitude to external API is a disgrace here. I was planning on doubling up on inverters when it comes to extend solar to front, and I doubt it will be a Growatt now.

So my question is, how is progress on making a Read / Write settings going, if it's something that's likely to happen in the near future, I will likely wait. If not my only other option I can think of is going direct Modbus and using a Raspberry PI with https://solar-assistant.io/ as that appears to have the ability to change inverter settings and links to HA..

muppet3000 commented 8 months ago

Short version: I have a very primitive implementation working with grottserver and curl requests.

Long version (because I'm currently sat on a runway waiting for a plane to take off for the next hour and have nothing better to do that to brain dump here): I too got fed up with the dependency on the Growatt servers (which are flaky AF). As part of Grott there is also a tool called grottserver which acts as if it is the Growatt servers. You can reconfigure Grott to point at grottserver and take Growatt out of the loop entirely. Now, grottserver has a very primitive rest API (usable via curl) that allows you to get and set the values of various registry values (exactly how the Growatt app and website do it). I have successfully spun up grottserver (from the 2.8.0 branch) and pointed Grott at it and have been able to run get & set commands via curl using that. My next plans are twofold:

  1. Increase the scope of this integration (or maybe create another to separate concerns) to allow sending of get/set commands
  2. Potentially contribute back to the Grott repo with functionality to allow pushing of data to both Growatt and grottserver (to allow people to continue using the app if they want to but also don't allow data collection to stall in the Growatt servers are down AGAIN).

I hope that goes done way to answer your questions, if you want something quick go for solar-assistant if you want something home grown and fully open source (if a bit clunky) wait around here and see what happens :P.

Anyway, my flight time has come forward - hooray! Time for airplane mode!

KpjComp commented 8 months ago

Hi,

Thanks for the update, that sounds fantastic. I'm happy to wait, and keep manually updating the battery first settings.

Just some ideas, seen as your already using MQTT, for HA integration this could be used via Node-Red.

All that would really be required are some MQTT messages, and of course some extra settings for MQTT server settings.

eg. MQTT messages ->

For Reading..

client sends ->

{
   "action": "read-register",
   "register":  <regNo>
}

server responds ->

{
  "action": "register-value",
  "register": <regNo>,
  "value": <regValue>
}

For Writing

client sends ->

{
   "action": "write-register",
   "register":  <regNo>,
    "value": <regValue>
}

For the above write-register ACK, the server could just implicitly send a register-value action, with the updated ..

Of course the above could be expanded for those with multiple inverters etc, and maybe msgId, to get client/server messages to sync, this might help with message filtering for ACK, and maybe possible race conditions (not sure if that would be an issue here though)..

perfrank commented 7 months ago

I would very much like the possibility to read/write to the time interval registers and/or enable/disable those. I have Node Red programming ready for optimizing grid charge. In Denmark, we have big difference in day/night tarifs. And I am not happy charging at night if prognose tells, that the sun will do it next day. So please.....