Artificial Intelligence (AI) enables smart control and fair sharing of resources in energy communities