I need help on how I would go about solving this problem, my apologies for the vague title I'm a beginner in the Data Science field and I'm trying to find a way to solve this problem, but I'm not sure where to start.
Here's the situation:
I have a battery that stores and discharges energy into my house from the power grid. Energy is produced by different generation techniques throughout the day and so I have data on the emission impact of using electricity at different hours. I also have data on the energy I've used in the past year. My goal is to charge and discharge this battery in the most effective way for reducing the emission impact of my home.
If anyone can point me in the right direction for what I should know and use to solve this problem I would be greatly appreciative!
I agree that it looks like an optimization problem, but the parameters are not completely clear. Here are some vague ideas I have about the design of such a system:

Let's assume a unit of time for which you have data and by which you attempt to predict things, for instance by the hour.
I think the first part needs to be about predicting energy needs by unit of time, based on past data and using any relevant factors as features (e.g. temperature, week day or not, etc.). I think this would be a reasonably standard time series regression problem.
The second part would be the optimization of energy consumption or carbon footprint: assuming we know the energy needs for a given period of time by unit of time, what are the optimal times for storing/discharging the battery? I don't know enough about the technical factors here, but I guess it's possible to simulate the target (say carbon footprint) based on different scenarios, and then select the optimal scenario. It seems to me that the problem at this stage could be simple enough to simulate all the scenarios and find the exact optimal times, that would probably correspond to a grid search. but in case this is too complex there are ML techniques which could estimate them, for instance genetic algorithms.