Growatt Inverter Mode Switch

Agreed. Speaking of which, if the example case for getting up and running with AppDaemon, what’s the basic use case that seems most value? Switch mode grid/battery priority between time period?

Personally for me:

  1. Be able to toggle battery charging on/off
  2. Be able to set a specific time to charge
  3. Be able to charge depending on a specific “sensor” (If its called that). So If sensor.kwh-Price below “xx” Then start charging. On the Dashboard be able to define “xx” as it varies over the year. (Some months/weeks 10cents/kwh is cheap and other months/weeks 25cents/kwh is cheap.
1 Like

Hi Karsten,

device_id: 5c6093279048b524c3282a0040c49398 is just an example of a context how I use the logic for setting the battery charge rate (that device is a solar production forecast - Forecast.Solar - Home Assistant (home-assistant.io)); highly recommended. This is the important which calls the python script:

- service: script.set_charge_rate
  data:
    stop_battery_soc: 30

Yes, you need only growattServer.py and set_charge_rate.py.

Martin

Hi @mjdyson,
Yes, happy to help with the wiki page. Though not a real developer myself, I can share my experience with the config part.

Can anyone explain how you “configure AppDaemon to listen to the HA instance”?

Hi @kassand, I assume there are multiple ways how to run both HA and AppDaemon alongside each other and talking to each other. I’m not great wizard at either. But in my situation - both running in Docker on my Synology NAS - these instructions worked for me: AppDaemon with Docker — AppDaemon 4.2.1 documentation

Thanks @martinm :slight_smile:

And what code do you use to make it visible on the dashboard?

Hopefully I’ll make it work sometime soon :slight_smile:

Morning all,

I’ve updated my code with something that works. If you’re able to test without much explanation, you can get on your way. mjdyson/ad-growatt (github.com)

Each file needs to be refreshed. Note, i’ve also removed a few additional files.
The HA helpers also need to be renamed to align with the input_button listeners.

Also, the wiki page has started to take shape. I’ll eat away at this over the coming days to get more in. Hopefully it explains what is going on better.

Edit: I’ve added some screenshots in the various steps to point you in the right direction until I can write more info in.

2 Likes

In my example, you’ll see how AppDaemon works with HA. Whilst I think you might be able to call the functions via a service call, my code has some listeners in the initialize function that just kick off some actions when they notice the inputs changing

2 Likes

@mjdyson you are the man!

It’s almost working a 100% now. Only some smaller stuff with formatting of time and so on. BUT it’s working :slight_smile:

Followed your wiki guide. That helped alot and gave me a much better understanding of what is actually going on.

After i did all the steps, it actually didn’t work, but after a couple of restarts i could see that appDaemon suddenly started logging some of the stuff from “AD-Growatt”, and after that it worked.

I’ll try to see if I can find out why I’m getting these 2 exclamation marks (Picture)

Edit: Got the reset_time to work, just had to add one more helper :slight_smile:

Thank you so much!

1 Like

Thank you kindly!

Let me help with those. First one (input_button.reset_time) is another helper I must’ve missed and you need to create.

Second is a script that I didn’t include. I don’t think it helps you, but it was to give me a testing shortcut to put my off peak hours into the UI elements.

I think I need to update the wiki :slight_smile: anything you think needs more clarity?

thanks from here too. i tried months ago… with no succes. will try again in a few days when the wiki is updated… looking forward. keep up the work.

1 Like

I’ve been working away the last couple of weeks so haven’t had the chance to play about with anything. I’m about as much as a novice/idiot with this so if I manage to get it working I can help point out any sticking points for people new to this like myself.
@martinm is Synology NAS more hardware you need to run this setup or can I run with what I have?

Wiki has been updated with the minor details fixed. Still a few todos with some descriptions in.

I’ve been looking at your time format issue but not found you an answer. Hopefully it’s not needed to get your automation going. In the app code, I think I need to cast the time string into a proper time format before it’s passed to HA sensor state. If this doesnt work, then I might need to create the sensors as time objects, if that’s even possible. Who knows :slight_smile: Hopefully get some better time to look at things at the weekend.

1 Like

@mjdyson, Absolutely perfect! :slight_smile:

Sorry if it gets too simple (like dummy for dummies), but I think alot of users dont know alot about HA, my inputs:

  1. Make sure AppDaemon is working properly
    To be honest I didn’t know how to do this. I just installed AppDaemon in HA (on a rpi4) and after doing all the steps and a couple of restarts it suddenly worked (I could see this by opening the AppDaemon UI, something with “AD-Growatt” was going on in the logging.). Without beeing that technical about it I guess this step can be different for a lot of users wether they are using rpi4 with HA or something else. But FYI it was plug-and-play with HA on an rpi4 by just installing AppDaemon.

  2. Create Sensors in HA (Optional)
    I dont think I created any sensors. But I would like to do this so I dont have to press the getValues button after restarts to remove the errors from my OCD :slight_smile:

(Or maybe it already does it (via “b) AppDaemon”, not sure)

  1. Helpers and Scripts
    I think that some users might have a hard time knowing where to put in the helpers and the script. (I didnt know that 2 months ago, Go to: Settings > Devices & Services > Top right, press “Helpers” > “Create Helper”, orange button). OR people could start googling a little bit :slight_smile:

  2. Create secrets.yalm entries:
    I dont know why, but i actually thought that I had to make a reference from configuration.yalm to secrets.yalm. So i spend some time trying to do this. But found out that I just had to do exactly what you had put up (I thought I had to do someting like put the password in secrets.yalm and then in configuration.yalm, I should put something like growatt_username: !secret your_username to make it “pull” the password from secrets.yalm - I might just be overthinking it.)

  3. Create AppDaemon files:
    The only thing i did was to delete all files in the appdaemon/apps folder and then put all of your files into this folder. Didn’t edit any of your files.

I dont know where you found the “AppDaemon logs” on the screenshot.

Thats all :slight_smile:

Once again thanks and keep up the good work.

Regarding time format. It’s only a visual thing, the stuff is working as intended :+1:

Oh, and if it would be possible for the app to pull values, shortly after you update the server, that could be pretty good.

Like toggle AC on, put in your timings, press “update the server” and when you press “update the server” it will also trigger “getValues” and you will get the confirmation right away.

Thanks :slight_smile:

succes, got it working here too :smiley:

I have two plants in my system, any idea how to enter a plant id for HA to use?

Glad you found the script thing. Create any one blank and add the code onto the yaml via the overflow menu.

Multiple plants is going to be something I’ll need to add. Could do all plants associated with an account, or read these into HA so they can be used through the UI to set values. I’ll have a think / chat with @muppet3000 … this is all good ground work for what people need in a longer term integration.

Great. Looking forward to that. thanks for your time

in card 1

“Battery First - Ac Charge” and “Battery First - Time slot 1 Enabled” seems to be the same entity,

sensor.battery_first_ac_charge_enabled

is this correct?

i could see a function of time slot 1 enabled and disabled would be perfect… then the time could be set from 0000-0000 and you can just toggle the time slot on and off to charge your battery and to change to load first. <<-- did i miss a function to turn time slot on and off (disable and enable)?

update: i can see both the ac charge and time slot is updated to on/off on the ac charge button - interesting.

This is just functionality that needs to be added to the core library and then you’d get multi-plant support for free.
Once I’ve finished the other backlog of stuff (first of which is to convert the existing plugin into a HACS plugin rather than a native one), then I’ll be able to extend it.

1 Like