Magnetometry with two coupled Dicke models