Active Inference and Dynamic Gaussian Bayesian Networks for Battery Optimization in Wireless Sensor Networks