muppet3000 / homeassistant-grott

Home Assistant Integration for Grott - MQTT
MIT License
73 stars 17 forks source link

Reverting back to stock for a non-tech... #4

Open Snux opened 1 year ago

Snux commented 1 year ago

(moved from issue #1 thread)...

With all the HA stuff I've been doing I've been mindful of what would happen if for some reason I wasn't around. My wife isn't all technical, so I've always told her that everything HA can be stopped and she can go back to manual for everything just by unplugging the Pi4 which is running it all. And she can stop all the Alexa stuff around the house by just removing all the smart plugs and using the original on-off switches on things.

Switching to grott kind of breaks that for our solar stuff though - if we unplug the HA Pi then the shine app will stop working. I might buy a second datalogger and use that for this, then if we needed to go back to standard we could just swap the original datalogger back in.

So I will go ahead and get this new integration running, but wondering if anyone has thoughts on the easiest way to revert it back for a non-tech...

jkkataja commented 1 year ago

My initial reaction would be that there is no "easy way" to revert back for a non-tech.

Main thing would be to somehow be able to reset the datalogger setting to use the Growatt servers as opposed to the local address. Doing it via Growatt site I suppose it can be relative straightforward but I do wonder if that requires that it's done before Grott is disabled.

Another option would be factory resetting the datalogger and doing initial setup again, but it can be argued whether or not that is easy for non-techs or not.

Those are the two options that come to my mind. I wonder if your idea of having two dataloggers would allow the original to retain the configuration and be able to connect normally after being offline for longer period🤔

muppet3000 commented 1 year ago

So after a discussion over on #5, specifically this comment: https://github.com/muppet3000/homeassistant-grott/issues/5#issuecomment-1545710398 it seems that it's possible to configure this setting from the growatt server website rather than having to know the IP address etc of the ShineLan box (or even worse if it's a Wifi Dongle).

The revert steps would simply be "Log into the website and set this value to 'server.growatt.com' and then click 'save'".

What do you think?

mriksman commented 1 year ago

@muppet3000 - does that actually work? I imagine Grott would need to be running for this to work..? Because the inverter/Shine-X no longer has a direct connection to the Growatt servers - it only communicates to Grott. So can Grott pass a request grom the Growatt server to the inverter/Shine-X?

muppet3000 commented 1 year ago

You may be right, in which case - you'd need to revert the growatt change first and then turn off HA. There's only one way to find out I suppose......

Snux commented 1 year ago

So can Grott pass a request grom the Growatt server to the inverter/Shine-X?

So I tested this first part. From the growatt website, I set an overnight "charge battery from grid" for 15 mins this morning and it worked fine. So the website managed to reach my settings via Grott.

In the next few days I'll switch of the Pi running HA for a little while and try to change another setting, which I guess will fail. Will comment back here after that,.

Snux commented 1 year ago

In the next few days I'll switch of the Pi running HA for a little while and try to change another setting, which I guess will fail.

So as expected, with HA removed from the network you can't reach your inverter from the Growatt website or the Shinephone app. I left it off for around 30 mins and then reconnected and it all picked up again no problem. I also show no gap in generation history, so it seems at least for my setup that the data is buffered on the inverter/datalogger side and sent when it can.

mriksman commented 1 year ago

Thanks for the info. As I expected. The inverter will send the buffered data, and Growatt will fill in the gaps. But Home Assistant will have a gap, as that doesn't support buffered data.

Snux commented 1 year ago

But Home Assistant will have a gap, as that doesn't support buffered data.

It's odd, but in HA I don't have a gap. I think we only get the gap if HA is running but the growatt site is down. I'll try turning off HA (with grott) for a longer period sometime.

mriksman commented 1 year ago

You had HA disconnected? Then there should be a gap. Grott/HA doesn't support back-filling buffered data.

Snux commented 1 year ago

My bad, you are correct. I switched off HA for 3 hours. Growatt servers caught up, but in HA I do indeed have a gap

Snux commented 1 year ago

So I had a bit of a fight with my datalogger yesterday after a network change at home. Thought I'd mention it here for reference. I have a Shine Wifi S logger.

What I should have done is reset the datalogger to point at the growatt servers before I did the change :)

I've put in new WiFi gear at home and although I kept the same SSID and password I had issues. My HA server is now running on a different IP address to previously (the new router uses a different range so I couldn't retain the old one).

So the datalogger on my inverter could see the network but couldn't reach HA so had nowhere to send the data. I removed the datalogger from the app, reset the logger (pressed the button for 10 seconds) and tried to add it again but it failed. What I learned eventually is that the reset does not actually reset the IP address / server settings you have, so even afterwards it was still trying to reach HA on the old IP.

The trick is when adding the datalogger back in, and you tell it your SSID and password, there is an Advanced button (where you have to put in the usual growattXXXXXXXX password) and you can then reset to server.growatt.com before telling the logger to connect. That got me back up and running to the growatt servers, then I was able check all was well before pointing it to the new HA address.

All good fun.

Snux commented 1 year ago

So I've fixed this "easy revert back to stock", at least for me, so I'll document it here and then we can probably close it.

I used to run PiHole to block ads and suchlike, but reused the Pi for HA. So instead I've installed the Adguard Home add-on into HA (which basically does what PiHole does). Here's what I then did....

# If the datalogger (.56) asks for server.growatt.com, then give it the IP address of HA (.51) instead ||server.growatt.com^$client=192.168.68.56,dnsrewrite=192.168.68.51

So now the datalogger is running stock, it's just getting intercepted by the DNS and sent to HA / Grott which then forwards it on as before. All the other clients on the network (like me going to the growatt web page) go direct as before. To remove all this from the setup, all we would need to do is unplug the Pi running HA and the router will fail back to the normal DNS for resolution, meaning the datalogger will go direct to the growatt servers.

muppet3000 commented 1 year ago

So I've fixed this "easy revert back to stock", at least for me, so I'll document it here and then we can probably close it.

I used to run PiHole to block ads and suchlike, but reused the Pi for HA. So instead I've installed the Adguard Home add-on into HA (which basically does what PiHole does). Here's what I then did....

  • pointed the Growatt datalogger back to server.growatt.com
  • updated the DNS settings on my router to use the HA (Adguard) first and then the good old Google 8.8.8.8 as secondary
  • added an address reservation on the router for the datalogger so it always gets the same IP address. HA was already set that way.
  • added a custom DNS filter rule into Adguard

# If the datalogger (.56) asks for server.growatt.com, then give it the IP address of HA (.51) instead ||server.growatt.com^$client=192.168.68.56,dnsrewrite=192.168.68.51

So now the datalogger is running stock, it's just getting intercepted by the DNS and sent to HA / Grott which then forwards it on as before. All the other clients on the network (like me going to the growatt web page) go direct as before. To remove all this from the setup, all we would need to do is unplug the Pi running HA and the router will fail back to the normal DNS for resolution, meaning the datalogger will go direct to the growatt servers.

Damn that's an elegant solution! I Have my own DNS server running internally myself and I'm tempted to do the same. Although, in the event of my untimely demise I'm pretty certain my wife will have plenty of other stuff to complain about before she gets to Growatt :P

Snux commented 1 year ago

Found a little annoyance with this, but nothing major. I was doing some work on HA, so for a while Adguard wasn't running as a DNS server. My inverter therefore picked up the "proper" address for server.growatt.com and started talking direct. Seems like the datalogger caches the IP address, as nothing was hitting grott (even after Ha restart) until I restarted the data logger (from the webpage). Not sure how long the datalogger would cache that for, but something to bear in mind.

Aad3229 commented 12 months ago

image I made a DNS record in pi-hole, letting server.growatt.com pointing to my NAS where mqtt is running in docker. Also Grott is running in docker but it seems noting is coming in my mqtt. Data is incoming to server.growatt.com, as I can see uptodate solar figures. Am I doing the DNS rerouting in pihole wrong? In the grott.ini I put the ip-address of server.growatt.com: `[Generic] invtype=sph

[Growatt] ip=47.91.67.66 port=5279

[MQTT] ip = 192.168.178.201 port = 1883 topic = energy/growatt auth = False`

toukondoit commented 12 months ago

I've also gone with a DNS Rewrite so as to avoid changing the dataloger configuration, We had a lot of trouble getting it connected when our system was installed. I have an ASUS AiMesh network. For the dataloger I ended up creating a separate 2.4GHz guest network solely for it's use.

As I didn't want to change any of my current network configurations I've also installed Adguard home in my HA. I do already use Adguard but wanted something separate. I already used static IPs for both HA and the dataloger, By default my main router DHCP allocates addresses which use the same DNS but can use indvidual DNS settings for static IPs. So I've changed the entry for the datalogger to specify the HA address for the DNS setting. I've got a similar rewrite rule to @Snux - thanks for the idea.